|
Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
Classes | |
| struct | dg::LeastSquaresExtrapolation< ContainerType0, ContainerType1 > |
| Evaluate a least squares fit More... | |
| struct | dg::Extrapolation< ContainerType > |
| Extrapolate a polynomial passing through up to three points. More... | |
Functions | |
| template<class ContainerType0 , class ContainerType1 , class ContainerType2 > | |
| std::vector< double > | dg::least_squares (const std::vector< ContainerType0 > &bs, const ContainerType1 &b, const ContainerType2 &weights) |
| Compute \( a = (B^T W B)^{-1} WB^T b\) for given \( B\), weights \( W\) and right hand side \( b\). | |
| template<class ContainerType0 , class ContainerType1 > | |
| std::vector< double > | dg::least_squares (const std::vector< ContainerType0 > &bs, const ContainerType1 &b) |
An alias for least_squares( bs, b, 1.) | |
| std::vector< double > dg::least_squares | ( | const std::vector< ContainerType0 > & | bs, |
| const ContainerType1 & | b ) |
An alias for least_squares( bs, b, 1.)
| std::vector< double > dg::least_squares | ( | const std::vector< ContainerType0 > & | bs, |
| const ContainerType1 & | b, | ||
| const ContainerType2 & | weights ) |
Compute \( a = (B^T W B)^{-1} WB^T b\) for given \( B\), weights \( W\) and right hand side \( b\).
This is the normal form of a least squares problem: given vectors \( b_i\) find coefficients \( a_i\) such that \( a_i b_i\) is as close as possible to a target vector \( b\), i.e. \( \min_a || B a - b||_W \) where the \( b_i\) constitute the columns of the matrix \( B\) and \( W\) are weights. This can be transformed into the solution of the normal equation
\[ B^T W B a = B^T W b\]
| bs | a number of input vectors all with the same size |
| b | must have the same size as the bs |
| weights | define the norm that is minimized |
| ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag. Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |