CoolProp 8.0.0
An open-source fluid property and humid air property database
SVDBuilder.h
Go to the documentation of this file.
1#ifndef COOLPROP_SVD_SVD_BUILDER_H
2#define COOLPROP_SVD_SVD_BUILDER_H
3
4#include <cstddef>
5#include <vector>
6
8
9namespace CoolProp {
10namespace svd {
11
12// Offline construction of a rank-r SVD decomposition from a 2D grid of
13// values.
14//
15// The input matrix M is assumed to be *already transformed* — i.e. if
16// the caller wants exp() applied at evaluation time, they pass log(M)
17// here and set out_transform = OutputTransform::EXP. The builder
18// itself never logs or exps; it just SVD-truncates and fits 1D slopes
19// per mode.
21{
22 std::int32_t rank = 0; // r; required, > 0, <= min(NX, NY)
25};
26
27// Build a rank-r decomposition.
28//
29// M is a flattened NX-by-NY matrix in row-major order: M[i*NY + j] is
30// the value at (x_grid[i], y_grid[j]).
31//
32// x_grid and y_grid must be strictly increasing. No NaN entries are
33// tolerated; callers responsible for filling holes (e.g. dome cells)
34// before calling.
35SVDDecomposition build_svd(const std::vector<double>& x_grid, const std::vector<double>& y_grid, const std::vector<double>& M,
36 const SVDBuildOptions& opts);
37
38} // namespace svd
39} // namespace CoolProp
40
41#endif // COOLPROP_SVD_SVD_BUILDER_H