13 #include "manifold_interp/PCHIPInterpolator.h"
14 #include "SnapshotDMD.h"
15 #include "linalg/Matrix.h"
16 #include "linalg/Vector.h"
17 #include "utils/CSVDatabase.h"
36 CAROM_VERIFY(f_snapshots->numColumns() > 1);
37 CAROM_VERIFY(k > 0 && k <= f_snapshots->numColumns() - 1);
52 std::vector<std::shared_ptr<Vector>> new_snapshots;
53 std::vector<Vector> new_times;
55 std::unique_ptr<std::vector<Vector>> times = scalarsToVectors(
d_sampled_times);
57 new_times, new_snapshots);
60 for (
int i=0; i<new_times.size(); ++i)
d_sampled_times[i] = new_times[i](0);
void constructDMD(const Matrix &f_snapshots, int rank, int num_procs, const Matrix *W0, double linearity_tol)
Construct the DMD object.
double d_energy_fraction
The energy fraction used to obtain the DMD modes.
virtual void train(double energy_fraction, const Matrix *W0=NULL, double linearity_tol=0.0)
Train the DMD model with energy fraction criterion.
std::unique_ptr< const Matrix > getSnapshotMatrix()
Get the snapshot matrix contained within d_snapshots.
double d_dt
The time step size between samples.
std::vector< double > d_sampled_times
The stored times of each sample.
std::vector< std::shared_ptr< Vector > > d_snapshots
std::vector holding the snapshots.
int d_rank
The rank of the process this object belongs to.
int d_num_procs
The number of processors being run on.
int d_k
The number of columns used after obtaining the SVD decomposition.
void interpolate(std::vector< Vector > &snapshot_ts, std::vector< std::shared_ptr< Vector >> &snapshots, std::vector< Vector > &output_ts, std::vector< std::shared_ptr< Vector >> &output_snapshots)
Compute new snapshots interpolated from snapshot_ts to output_ts.
void interpolateToNSnapshots(int n)
Interpolate the current snapshots to n, new snapshots distributed uniformly over the currently sample...
~SnapshotDMD()
Destroy the SnapshotDMD object.
void train(int k, const Matrix *W0=NULL, double linearity_tol=0.0)
Train the DMD model with specified reduced dimension. If k is too large then new snapshots are comput...