|
|
|
SVD.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Foam::SVD 00027 00028 Description 00029 Singular value decomposition of a rectangular matrix. 00030 00031 SourceFiles 00032 SVDI.H 00033 SVD.C 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef SVD_H 00038 #define SVD_H 00039 00040 #include "scalarMatrices.H" 00041 00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00043 00044 namespace Foam 00045 { 00046 00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00048 00049 00050 /*---------------------------------------------------------------------------*\ 00051 Class SVD Declaration 00052 \*---------------------------------------------------------------------------*/ 00053 00054 class SVD 00055 { 00056 // Private data 00057 00058 //- Rectangular matrix with the same dimensions as the input 00059 scalarRectangularMatrix U_; 00060 00061 //- square matrix V 00062 scalarRectangularMatrix V_; 00063 00064 //- The singular values 00065 DiagonalMatrix<scalar> S_; 00066 00067 //- The matrix product V S^(-1) U^T 00068 scalarRectangularMatrix VSinvUt_; 00069 00070 //- The number of zero singular values 00071 label nZeros_; 00072 00073 00074 // Private Member Functions 00075 00076 //- Disallow default bitwise copy construct 00077 SVD(const SVD&); 00078 00079 //- Disallow default bitwise assignment 00080 void operator=(const SVD&); 00081 00082 template<class T> 00083 inline const T sign(const T& a, const T& b); 00084 00085 00086 public: 00087 00088 // Constructors 00089 00090 //- Construct from a rectangular Matrix 00091 SVD(const scalarRectangularMatrix& A, const scalar minCondition = 0); 00092 00093 00094 // Access functions 00095 00096 //- Return U 00097 inline const scalarRectangularMatrix& U() const; 00098 00099 //- Return the square matrix V 00100 inline const scalarRectangularMatrix& V() const; 00101 00102 //- Return the singular values 00103 inline const scalarDiagonalMatrix& S() const; 00104 00105 //- Return VSinvUt (the pseudo inverse) 00106 inline const scalarRectangularMatrix& VSinvUt() const; 00107 00108 //- Return the number of zero singular values 00109 inline label nZeros() const; 00110 00111 //- Return the minimum non-zero singular value 00112 inline scalar minNonZeroS() const; 00113 }; 00114 00115 00116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00117 00118 } // End namespace Foam 00119 00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00121 00122 #include "SVDI.H" 00123 00124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00125 00126 #endif 00127 00128 // ************************************************************************* // |