SVD.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::SVD
26 
27 Description
28  Singular value decomposition of a rectangular matrix.
29 
30 SourceFiles
31  SVDI.H
32  SVD.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef SVD_H
37 #define SVD_H
38 
39 #include "scalarMatrices.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 
49 /*---------------------------------------------------------------------------*\
50  Class SVD Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class SVD
54 {
55  // Private data
56 
57  //- Rectangular matrix with the same dimensions as the input
59 
60  //- Square matrix V
62 
63  //- The singular values
65 
66  //- The matrix product V S^(-1) U^T
68 
69  //- The number of zero singular values
70  label nZeros_;
71 
72 
73  // Private Member Functions
74 
75  //- Disallow default bitwise copy construct
76  SVD(const SVD&);
77 
78  //- Disallow default bitwise assignment
79  void operator=(const SVD&);
80 
81  template<class T>
82  inline const T sign(const T& a, const T& b);
83 
84 
85 public:
86 
87  // Constructors
88 
89  //- Construct from a rectangular Matrix
90  SVD(const scalarRectangularMatrix& A, const scalar minCondition = 0);
91 
92 
93  // Access functions
94 
95  //- Return U
96  inline const scalarRectangularMatrix& U() const;
97 
98  //- Return the square matrix V
99  inline const scalarRectangularMatrix& V() const;
100 
101  //- Return the singular values
102  inline const scalarDiagonalMatrix& S() const;
103 
104  //- Return VSinvUt (the pseudo inverse)
105  inline const scalarRectangularMatrix& VSinvUt() const;
106 
107  //- Return the number of zero singular values
108  inline label nZeros() const;
109 
110  //- Return the minimum non-zero singular value
111  inline scalar minNonZeroS() const;
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #include "SVDI.H"
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
Foam::SVD::minNonZeroS
scalar minNonZeroS() const
Return the minimum non-zero singular value.
Definition: SVDI.H:62
Foam::SVD::nZeros_
label nZeros_
The number of zero singular values.
Definition: SVD.H:69
Foam::SVD::SVD
SVD(const SVD &)
Disallow default bitwise copy construct.
Foam::SVD::VSinvUt_
scalarRectangularMatrix VSinvUt_
The matrix product V S^(-1) U^T.
Definition: SVD.H:66
Foam::SVD::sign
const T sign(const T &a, const T &b)
Definition: SVDI.H:29
Foam::SVD::S_
DiagonalMatrix< scalar > S_
The singular values.
Definition: SVD.H:63
A
simpleMatrix< scalar > A(Nc)
Foam::DiagonalMatrix< scalar >
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:28
SVDI.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::SVD::operator=
void operator=(const SVD &)
Disallow default bitwise assignment.
Foam::RectangularMatrix< scalar >
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::SVD::S
const scalarDiagonalMatrix & S() const
Return the singular values.
Definition: SVDI.H:47
Foam::SVD::V_
scalarRectangularMatrix V_
Square matrix V.
Definition: SVD.H:60
Foam::SVD::U_
scalarRectangularMatrix U_
Rectangular matrix with the same dimensions as the input.
Definition: SVD.H:57
Foam::SVD::VSinvUt
const scalarRectangularMatrix & VSinvUt() const
Return VSinvUt (the pseudo inverse)
Definition: SVDI.H:52
Foam::SVD
Singular value decomposition of a rectangular matrix.
Definition: SVD.H:52
scalarMatrices.H
Foam::SVD::nZeros
label nZeros() const
Return the number of zero singular values.
Definition: SVDI.H:57
Foam::SVD::V
const scalarRectangularMatrix & V() const
Return the square matrix V.
Definition: SVDI.H:42
Foam::SVD::U
const scalarRectangularMatrix & U() const
Return U.
Definition: SVDI.H:37