Doxygen
1.9.1
|
Functions | |
bool | TasGrid::hasGPUBasis (TasmanianSparseGrid const &grid) |
Returns true if the grid has a GPU algorithm for computing the hierarchical basis. More... | |
template<typename scalar_type > | |
void | TasGrid::generateCoefficientsGPU (double const data_points[], int num_data, scalar_type model_values[], double tolerance, TasmanianSparseGrid &grid) |
Generates the coefficients and solves the least-squares problem. More... | |
template<typename scalar_type > | |
Data2D< scalar_type > | TasGrid::generateCoefficients (double const data_points[], int num_data, double const model_values[], double tolerance, TasmanianSparseGrid &grid) |
Generates the coefficients and solves the least-squares problem. More... | |
template<typename scalar_type > | |
void | TasGrid::loadUnstructuredDataL2tmpl (double const data_points[], int num_data, double const model_values[], double tolerance, TasmanianSparseGrid &grid) |
Template implementation that handles the case of Fourier grids vs. all other types. More... | |
void | TasGrid::loadUnstructuredDataL2 (double const data_points[], int num_data, double const model_values[], double tolerance, TasmanianSparseGrid &grid) |
Construct a sparse grid surrogate using a least-squares fit. More... | |
void | TasGrid::loadUnstructuredDataL2 (std::vector< double > const &data_points, std::vector< double > const &model_values, double tolerance, TasmanianSparseGrid &grid) |
Overload that used vectors and infers the number of data points from the size of the vectors. More... | |
Templates that infer sparse grid coefficients from a set of unstructured points and model values. These work very similar to TasGrid::loadNeededPoints(), but the data is not assumed to align to the sparse grid. While removing some of the restrictions, the unstructured approach always requires more data to achieve the same level of accuracy compared to the carefully chosen points, and the approximation is valid only in the convex hull of the data, i.e., extrapolating outside of the data-cloud is not mathematically stable. In the interior of the data-cloud, the accuracy of the surrogate is very sensitive to the distribution of the points and good accuracy can be achieved only in areas where the points are sufficiently dense.
The inference usually relies on solving some linear or non-linear problem which may not be stable and may require additional regularization, especially if the data is not sufficient to provide values for all hierarchical coefficients, e.g., all data falls outside of the support of some locally supported basis functions.
|
inline |
Returns true if the grid has a GPU algorithm for computing the hierarchical basis.
void TasGrid::generateCoefficientsGPU | ( | double const | data_points[], |
int | num_data, | ||
scalar_type | model_values[], | ||
double | tolerance, | ||
TasmanianSparseGrid & | grid | ||
) |
Generates the coefficients and solves the least-squares problem.
The template assumes that the arrays are allocated on the GPU device and the model_values are set to the correct size that would include padding needed for the regularization (note that the padded may not be initialized). The basis matrix will be constructed on the GPU and must fit in memory.
Data2D<scalar_type> TasGrid::generateCoefficients | ( | double const | data_points[], |
int | num_data, | ||
double const | model_values[], | ||
double | tolerance, | ||
TasmanianSparseGrid & | grid | ||
) |
Generates the coefficients and solves the least-squares problem.
The template assumes that the arrays are allocated on the CPU. The basis matrix is build on the CPU, unless MAGMA acceleration is enabled; in the magma case, the matrix will be build on the GPU by using several rows at a time as to avoid overfilling the GPU memory (out-of-core).
|
inline |
Template implementation that handles the case of Fourier grids vs. all other types.
Fourier grids require complex arithmetic while the other grid works with real types. This template operates on the double or std::complex<double> specified by scalar_type.
|
inline |
Construct a sparse grid surrogate using a least-squares fit.
Constructs the coefficients of the grid using a least-squares fit , where c indicates the hierarchical coefficients of the grid, x indicates the data-points and Y is the associated model outputs. The problem is set as a linear system of equations so that
where H is the matrix of hierarchical coefficients. Depending on the distribution of the points and/or the type of grid, the system may not be well posed, hence the simple regularization option to add tolerance multiplied by the norm of c.
data_points | array of data points similar to TasmanianSparseGrid::loadConstructedPoints() with size grid.getNumDimensions() by num_data |
num_data | the number of data points |
model_values | array of model values corresponding to the data_points, the size is grid.getNumOutputs() by num_data |
tolerance | if positive, will add regularization to the least-squares problem, must be less than the accuracy of the surrogate so that it will not affect the approximation error; if set to zero or less, no regularization will be used but depending on the type of grid and the distribution of the points, the problem may not be well posed |
grid | is a non-empty grid, if a refinement has been set, it will be merged with the existing points before inference |
std::runtime_error | if the grid is empty or accel_none is used |
std::runtime_error | on various cuda errors, e.g., not enough GPU memory, or if the matrix G_c does not have a full column rank, e.g., regularization tolerance is 0 and the data is not sufficient to provide coefficients for all basis functions |
The problem requires the QR factorization of G_c and the solution against multiple right hand sides corresponding to the model outputs. This is computationally very expensive and cannot be done without an appropriate acceleration mode:
The cuda and cublas modes, require that the data and the associated matrices fit in the memory of the GPU device, MAGMA does not have that restriction.
|
inline |
Overload that used vectors and infers the number of data points from the size of the vectors.
See TasGrid::loadUnstructuredDataL2() for details, in addition
std::runtime_error | if the sizes of the data_points and model_values do not match |