libROM  v1.0
Data-driven physical simulation library
SVD.h
1 
11 // Description: An abstract class defining the interface to the generic SVD
12 // algorithm.
13 
14 #ifndef included_SVD_h
15 #define included_SVD_h
16 
17 #include "linalg/Matrix.h"
18 #include "linalg/Options.h"
19 #include <vector>
20 
21 namespace CAROM {
22 
28 class SVD
29 {
30 public:
38  SVD(
39  Options options);
40 
52  virtual
53  bool
55  double* u_in,
56  bool add_without_increase) = 0;
57 
63  int
64  getDim() const
65  {
66  return d_dim;
67  }
68 
74  virtual
75  std::shared_ptr<const Matrix>
77 
83  virtual
84  std::shared_ptr<const Matrix>
86 
92  virtual
93  std::shared_ptr<const Vector>
95 
101  virtual
102  std::shared_ptr<const Matrix>
104 
109  int getNumSamples() const
110  {
111  return d_num_samples;
112  }
113 
119  int getMaxNumSamples() const
120  {
121  return d_max_num_samples;
122  }
123 
124 protected:
132  bool
134  {
135  return (d_num_samples == 0);
136  }
137 
141  const int d_dim;
142 
147 
152 
156  const int d_max_num_samples;
157 
164  std::shared_ptr<Matrix> d_basis;
165 
172  std::shared_ptr<Matrix> d_basis_right;
173 
180  std::shared_ptr<Matrix> d_U;
181 
188  std::shared_ptr<Matrix> d_W;
189 
196  std::shared_ptr<Vector> d_S;
197 
204  std::shared_ptr<Matrix> d_snapshots;
205 
211 
212 private:
216  SVD();
217 
221  SVD(
222  const SVD& other);
223 
227  SVD&
228  operator = (
229  const SVD& rhs);
230 };
231 
232 }
233 
234 #endif
Definition: SVD.h:29
int getNumSamples() const
Get the number of samples taken.
Definition: SVD.h:109
int d_num_rows_of_W
Number of rows in right singular matrix.
Definition: SVD.h:151
virtual std::shared_ptr< const Matrix > getSpatialBasis()=0
Returns the basis vectors for the current time interval.
int getMaxNumSamples() const
Get the maximum number of samples that can be taken. SVD class will return an error if the number of ...
Definition: SVD.h:119
std::shared_ptr< Matrix > d_basis_right
The globalized right basis vectors for the current time interval.
Definition: SVD.h:172
std::shared_ptr< Matrix > d_basis
The globalized basis vectors for the current time interval.
Definition: SVD.h:164
bool isFirstSample() const
Returns true if the next sample will result in a new time interval.
Definition: SVD.h:133
const int d_max_num_samples
The maximum number of samples.
Definition: SVD.h:156
int d_num_samples
Number of samples stored for the current time interval.
Definition: SVD.h:146
bool d_debug_algorithm
Flag to indicate if results of algorithm should be printed for debugging purposes.
Definition: SVD.h:210
int getDim() const
Returns the dimension of the system on this processor.
Definition: SVD.h:64
std::shared_ptr< Matrix > d_snapshots
The globalized snapshot vectors for the current time interval.
Definition: SVD.h:204
std::shared_ptr< Matrix > d_W
The matrix U which is large.
Definition: SVD.h:188
const int d_dim
Dimension of the system.
Definition: SVD.h:141
std::shared_ptr< Vector > d_S
The vector S which is small.
Definition: SVD.h:196
std::shared_ptr< Matrix > d_U
The matrix U which is large.
Definition: SVD.h:180
virtual std::shared_ptr< const Matrix > getTemporalBasis()=0
Returns the temporal basis vectors for the current time interval.
virtual std::shared_ptr< const Vector > getSingularValues()=0
Returns the singular values for the current time interval.
virtual bool takeSample(double *u_in, bool add_without_increase)=0
Collect the new sample, u_in at supplied time.
virtual std::shared_ptr< const Matrix > getSnapshotMatrix()=0
Returns the singular values for the current time interval.