OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
|
SolveFactory is a factory class for solving a set of linear equations to generate a polynomial based on nearby points. More...
#include <SolveFactory.h>
Public Member Functions | |
SolveFactory (int smoothing_order, int point_dim, int value_dim, std::vector< std::vector< double > > positions, std::vector< std::vector< double > > deriv_positions, std::vector< std::vector< int > > &deriv_indices) | |
~SolveFactory () | |
SquarePolynomialVector * | PolynomialSolve (const std::vector< std::vector< double > > &values, const std::vector< std::vector< double > > &deriv_values) |
std::vector< double > | MakeSquareVector (std::vector< double > position) |
std::vector< double > | MakeSquareDerivVector (std::vector< double > position, std::vector< int > derivIndices) |
Private Member Functions | |
void | BuildHInvMatrix (std::vector< std::vector< double > > positions, std::vector< std::vector< double > > deriv_positions, std::vector< std::vector< int > > &deriv_indices) |
Private Attributes | |
int | n_poly_coeffs_ |
std::vector< std::vector< int > > | square_points_ |
std::vector< std::vector< int > > | square_deriv_nearby_points_ |
SquarePolynomialVector | square_temp_ |
MMatrix< double > | h_inv_ |
SolveFactory is a factory class for solving a set of linear equations to generate a polynomial based on nearby points.
See also PPSolveFactory for more details
Definition at line 44 of file SolveFactory.h.
interpolation::SolveFactory::SolveFactory | ( | int | smoothing_order, |
int | point_dim, | ||
int | value_dim, | ||
std::vector< std::vector< double > > | positions, | ||
std::vector< std::vector< double > > | deriv_positions, | ||
std::vector< std::vector< int > > & | deriv_indices | ||
) |
Construct a new SolveFactory.
polynomial_order | Order of the polynomial part of the fit |
smoothing_order | Order of the smoothing part of the fit; should always be >= polynomial_order |
point_dim | Dimension of the points (i.e. space of x), for y = f(x) |
value_dim | Dimension of the values (i.e. space of y), for y = f(x) |
positions | Position of the values; should be a vector of length polynomial_order^point_dim. Each element should be a vector of length point_dim |
deriv_positions | Position of the derivatives; should be a vector of length smoothing_order^point_dim - polynomial_order^point_dim. Each element should be a vector of length point_dim. |
deriv_indices | Index the derivatives. Should be a vector with same length as deriv_positions. Each element should be a vector of length point_dim. Each element tells us what derivative will be defined, indexing by the order of the derivative. |
The constructor takes the set of positions; then performs a matrix inversion. Each call to PolynomialSolve uses the same matrix inversion in solution of the linear equations (hence when we do this lots of times as in PolynomialPatch, we get a lot faster). The matrix inversion can fail for badly formed sets of positions/deriv_positions; caveat emptor!
Definition at line 39 of file SolveFactory.cpp.
References BuildHInvMatrix(), interpolation::PPSolveFactory::getNearbyPointsSquares(), n_poly_coeffs_, interpolation::SquarePolynomialVector::NumberOfPolynomialCoefficients(), square_points_, and square_temp_.
|
inline |
Destructor; does nothing
Definition at line 82 of file SolveFactory.h.
|
private |
Definition at line 61 of file SolveFactory.cpp.
References h_inv_, interpolation::MMatrix< Tmplt >::invert(), MakeSquareDerivVector(), MakeSquareVector(), and n_poly_coeffs_.
Referenced by SolveFactory().
std::vector< double > interpolation::SolveFactory::MakeSquareDerivVector | ( | std::vector< double > | position, |
std::vector< int > | derivIndices | ||
) |
Convert a position vector to a derivative of a set of polynomial products
position | a position vector \( x_{b} \) |
derivIndices | indexes the derivative, \(\vec{q} \) |
Return value is a set of derivatives of polynomial products \( p_j!/(p_j-q_j)! x_{b_j}^{p_j-q_j} \)
Definition at line 94 of file SolveFactory.cpp.
References square_points_.
Referenced by BuildHInvMatrix().
std::vector< double > interpolation::SolveFactory::MakeSquareVector | ( | std::vector< double > | position | ) |
Convert a position vector to a set of polynomial products
position | a position vector \( x_{b} \) |
Return value is a set of polynomial products \( x_{b}^{p} \)
Definition at line 84 of file SolveFactory.cpp.
References square_points_.
Referenced by BuildHInvMatrix().
SquarePolynomialVector * interpolation::SolveFactory::PolynomialSolve | ( | const std::vector< std::vector< double > > & | values, |
const std::vector< std::vector< double > > & | deriv_values | ||
) |
Solve to get a SquarePolynomialVector
values | Set of y values for the solve, giving function values at the positions defined in the constructor |
deriv_values | Set of y derivatives for the solve, giving q^th derivatives, q defined by deriv_indices, at positions defined by deriv_positions (in constructor) |
Definition at line 125 of file SolveFactory.cpp.
References h_inv_, n_poly_coeffs_, interpolation::SquarePolynomialVector::SetCoefficients(), and square_temp_.
Referenced by interpolation::PPSolveFactory::solve().
|
private |
Definition at line 123 of file SolveFactory.h.
Referenced by BuildHInvMatrix(), and PolynomialSolve().
|
private |
Definition at line 118 of file SolveFactory.h.
Referenced by BuildHInvMatrix(), PolynomialSolve(), and SolveFactory().
|
private |
Definition at line 120 of file SolveFactory.h.
|
private |
Definition at line 119 of file SolveFactory.h.
Referenced by MakeSquareDerivVector(), MakeSquareVector(), and SolveFactory().
|
private |
Definition at line 122 of file SolveFactory.h.
Referenced by PolynomialSolve(), and SolveFactory().