libROM  v1.0
Data-driven physical simulation library
StaticSVD.h
1 
11 // Description: A class implementing interface of SVD for the static SVD
12 // algorithm.
13 
14 #ifndef included_StaticSVD_h
15 #define included_StaticSVD_h
16 
17 #include "SVD.h"
18 #include "linalg/Options.h"
19 #include "linalg/scalapack_wrapper.h"
20 
21 #include <limits>
22 #include <memory>
23 #include <vector>
24 
25 namespace CAROM {
26 
32 class StaticSVD : public SVD
33 {
34 public:
38  ~StaticSVD();
39 
50  virtual
51  bool
52  takeSample(
53  double* u_in,
54  bool add_without_increase = false);
55 
64  virtual
65  const Matrix*
67 
76  virtual
77  const Matrix*
79 
87  virtual
88  const Vector*
90 
96  virtual
97  const Matrix*
99 
100 protected:
101 
109  StaticSVD(
110  Options options
111  );
112 
117  virtual void
118  computeSVD();
119 
125  bool
127  {
128  return d_basis_is_current;
129  }
130 
134  std::unique_ptr<SLPK_Matrix> d_samples;
135 
139  std::unique_ptr<SVDManager> d_factorizer;
140 
146 
150  int d_rank;
151 
156 
162  std::vector<int> d_istarts;
163 
169  std::vector<int> d_dims;
170 
175 
179  int d_nprow;
180 
184  int d_npcol;
185 
190 
195  void get_global_info();
196 
201 
206 
210  void delete_samples();
214  void delete_factorizer();
215 
219  void broadcast_sample(const double* u_in);
220 
221 private:
222 
223  friend class BasisGenerator;
224 
228  StaticSVD();
229 
233  StaticSVD(
234  const StaticSVD& other);
235 
239  StaticSVD&
240  operator = (
241  const StaticSVD& rhs);
242 
246  bool d_preserve_snapshot;
247 };
248 
249 }
250 
251 #endif
Definition: SVD.h:29
double d_singular_value_tol
The tolerance for singular values below which to drop vectors.
Definition: StaticSVD.h:205
virtual bool takeSample(double *u_in, bool add_without_increase=false)
Collect the new sample, u_in at the supplied time.
Definition: StaticSVD.cpp:101
int d_rank
The rank of the process this object belongs to.
Definition: StaticSVD.h:150
int d_nprow
The number of processor rows in the grid.
Definition: StaticSVD.h:179
virtual void computeSVD()
Gathers samples from all other processors to form complete sample of system and computes the SVD.
Definition: StaticSVD.cpp:238
int d_npcol
The number of processor columns in the grid.
Definition: StaticSVD.h:184
void delete_factorizer()
Delete the factorizer from ScaLAPACK.
Definition: StaticSVD.cpp:82
void get_global_info()
Get the system's total row dimension and where my rows sit in the matrix.
Definition: StaticSVD.cpp:388
void delete_samples()
Delete the samples from ScaLAPACK.
Definition: StaticSVD.cpp:74
void broadcast_sample(const double *u_in)
Broadcast the sample to all processors.
Definition: StaticSVD.cpp:378
bool d_basis_is_current
Flag to indicate if the basis vectors for the current time interval are up to date.
Definition: StaticSVD.h:145
virtual const Vector * getSingularValues()
Returns the singular values for the current time interval.
Definition: StaticSVD.cpp:191
std::vector< int > d_istarts
The starting row (0-based) of the matrix that each process owns. Stored to avoid an MPI operation to ...
Definition: StaticSVD.h:162
int d_total_dim
The total dimension of the system (row dimension)
Definition: StaticSVD.h:174
int d_max_basis_dimension
The max number of basis vectors to return.
Definition: StaticSVD.h:200
std::unique_ptr< SLPK_Matrix > d_samples
Current samples of the system.
Definition: StaticSVD.h:134
std::unique_ptr< SVDManager > d_factorizer
Factorization manager object used to compute the SVD.
Definition: StaticSVD.h:139
int d_blocksize
The block size used internally for computing the SVD.
Definition: StaticSVD.h:189
virtual const Matrix * getSpatialBasis()
Returns the basis vectors for the current time interval as a Matrix.
Definition: StaticSVD.cpp:141
virtual const Matrix * getSnapshotMatrix()
Returns the snapshot matrix for the current time interval.
Definition: StaticSVD.cpp:216
bool isBasisCurrent()
Checks if the basis vectors are computed from the current snapshot.
Definition: StaticSVD.h:126
virtual const Matrix * getTemporalBasis()
Returns the temporal basis vectors for the current time interval as a Matrix.
Definition: StaticSVD.cpp:166
int d_num_procs
The number of processors being run on.
Definition: StaticSVD.h:155
std::vector< int > d_dims
The number of rows that each process owns. Stored to avoid an MPI operation to get this operation eve...
Definition: StaticSVD.h:169