1 #include "nearest_neighbors.h"     7 namespace ProperOrthogonalDecomposition {
    31         std::vector<int> index(distances.size());
    32         std::iota(index.begin(), index.end(), 0);
    34         std::sort(index.begin(), index.end(),
    35                   [&](
const int& a, 
const int& b) {
    36                       return distances[a] < distances[b];
    39         for (
int i = 1 ; i < snapshot.cols() + 2 ; i++) { 
    40             midpoints.conservativeResize(midpoints.rows()+1, midpoints.cols());
    51     std::vector<int> index(distances.size());
    52     std::iota(index.begin(), index.end(), 0);
    54     std::sort(index.begin(), index.end(),
    55               [&](
const int& a, 
const int& b) {
    56                   return distances[a] < distances[b];
    60     MatrixXd midpoints(point.cols()+1, point.cols());
    61     for (
int i = 0 ; i < point.cols()+1 ; i++) {
    68 dealii::LinearAlgebra::distributed::Vector<double> NearestNeighbors::nearestNeighborMidpointSolution(
const RowVectorXd& point){
    72     std::vector<int> index(distances.size());
    73     std::iota(index.begin(), index.end(), 0);
    75     std::sort(index.begin(), index.end(),
    76               [&](
const int& a, 
const int& b) {
    77                   return distances[a] < distances[b];
    80     dealii::LinearAlgebra::distributed::Vector<double> interpolated_solution = 
snapshots[index[0]];
    81     interpolated_solution += 
snapshots[index[1]];
    82     interpolated_solution /= 2;
    83     return interpolated_solution;
 MinMaxScaler scaler
Scaler. 
NearestNeighbors()
Constructor. 
void update_snapshots(const MatrixXd &snapshot_parameters, dealii::LinearAlgebra::distributed::Vector< double > snapshot)
Add snapshot. 
MatrixXd snapshot_params
Snapshot parameters. 
Files for the baseline physics. 
MatrixXd scaled_snapshot_params
Scaled snapshot parameters. 
std::vector< dealii::LinearAlgebra::distributed::Vector< double > > snapshots
Vector containing all snapshots. 
MatrixXd kPairwiseNearestNeighborsMidpoint()
Find midpoint of all snapshot locations. 
MatrixXd fit_transform(const MatrixXd &snapshot_parameters)
Fit and transform data. 
MatrixXd kNearestNeighborsMidpoint(const RowVectorXd &point)
Given a point, returns midpoint between point and k nearest snapshots, where k is 1+num_parameters...
MatrixXd inverse_transform(const MatrixXd &snapshot_parameters)
Unscale data. 
MatrixXd transform(const MatrixXd &snapshot_parameters)
Transform data to previously fitted dataset.