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 
44  ~SVD();
45 
57  virtual
58  bool
60  double* u_in,
61  bool add_without_increase) = 0;
62 
68  int
69  getDim() const
70  {
71  return d_dim;
72  }
73 
79  virtual
80  const Matrix*
82 
88  virtual
89  const Matrix*
91 
97  virtual
98  const Vector*
100 
106  virtual
107  const Matrix*
109 
114  int getNumSamples() const
115  {
116  return d_num_samples;
117  }
118 
124  int getMaxNumSamples() const
125  {
126  return d_max_num_samples;
127  }
128 
129 protected:
137  bool
139  {
140  return (d_num_samples == 0);
141  }
142 
146  const int d_dim;
147 
152 
157 
161  const int d_max_num_samples;
162 
170 
178 
186 
194 
202 
210 
216 
217 private:
221  SVD();
222 
226  SVD(
227  const SVD& other);
228 
232  SVD&
233  operator = (
234  const SVD& rhs);
235 };
236 
237 }
238 
239 #endif
Definition: SVD.h:29
Matrix * d_basis
The globalized basis vectors for the current time interval.
Definition: SVD.h:169
Matrix * d_snapshots
The globalized snapshot vectors for the current time interval.
Definition: SVD.h:209
int getNumSamples() const
Get the number of samples taken.
Definition: SVD.h:114
int d_num_rows_of_W
Number of rows in right singular matrix.
Definition: SVD.h:156
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:124
virtual const Matrix * getTemporalBasis()=0
Returns the temporal basis vectors for the current time interval.
~SVD()
Definition: SVD.cpp:35
Matrix * d_basis_right
The globalized right basis vectors for the current time interval.
Definition: SVD.h:177
bool isFirstSample() const
Returns true if the next sample will result in a new time interval.
Definition: SVD.h:138
const int d_max_num_samples
The maximum number of samples.
Definition: SVD.h:161
Vector * d_S
The vector S which is small.
Definition: SVD.h:201
int d_num_samples
Number of samples stored for the current time interval.
Definition: SVD.h:151
Matrix * d_U
The matrix U which is large.
Definition: SVD.h:185
bool d_debug_algorithm
Flag to indicate if results of algorithm should be printed for debugging purposes.
Definition: SVD.h:215
virtual const Matrix * getSnapshotMatrix()=0
Returns the singular values for the current time interval.
int getDim() const
Returns the dimension of the system on this processor.
Definition: SVD.h:69
virtual const Matrix * getSpatialBasis()=0
Returns the basis vectors for the current time interval.
virtual const Vector * getSingularValues()=0
Returns the singular values for the current time interval.
const int d_dim
Dimension of the system.
Definition: SVD.h:146
Matrix * d_W
The matrix U which is large.
Definition: SVD.h:193
virtual bool takeSample(double *u_in, bool add_without_increase)=0
Collect the new sample, u_in at supplied time.