#include <Monomials_fwd.hpp>
A class representing Monomial basis.
This class satisfies the Basis function concept.
Usage example:
Definition at line 38 of file Monomials_fwd.hpp.
Public Member Functions | |
Monomials ()=default | |
Construct empty monomial basis with size = 0 . More... | |
Monomials (int order) | |
Construct a basis of all monomials of combined order lower or equal to order . More... | |
Monomials (const std::vector< std::vector< int >> &powers) | |
Construct monomial basis from monomials with specific powers. More... | |
int | size () const |
Return number of monomials in this basis. More... | |
const Eigen::Matrix< int, dim, Eigen::Dynamic > & | powers () const |
Get saved monomial powers. More... | |
scalar_t | eval (int index, const vector_t &point, const std::vector< vector_t > &={}) const |
Evaluates index -th monomial' at point . More... | |
template<typename operator_t > | |
scalar_t | evalOp (int index, const vector_t &point, operator_t op, const std::vector< vector_t > &support={}, scalar_t scale=1) const |
Apply an operator at a given point. More... | |
scalar_t | evalOp (int index, const vector_t &point, Lap< dim > op, const std::vector< vector_t > &support={}, scalar_t scale=1) const |
Evaluate Laplacian. More... | |
scalar_t | evalOp (int index, const vector_t &point, Der1< dim > op, const std::vector< vector_t > &support={}, scalar_t scale=1) const |
Evaluate 1st derivative. More... | |
scalar_t | evalOp (int index, const vector_t &point, Der2< dim > op, const std::vector< vector_t > &support={}, scalar_t scale=1) const |
Evaluate 2nd derivative. More... | |
scalar_t | evalOp (int index, const vector_t &point, Derivative< dim > op, const std::vector< vector_t > &support={}, scalar_t scale=1) const |
Evaluate general derivative. More... | |
scalar_t | evalAt0 (int index, const std::vector< vector_t > &={}) const |
Evaluate index -th monomial at zero. More... | |
template<typename operator_t > | |
scalar_t | evalOpAt0 (int index, const operator_t&op, const std::vector< vector_t > &support={}, scalar_t scale=1) const |
Evaluate an operator on index -th monomial at zero. More... | |
scalar_t | evalOpAt0 (int index, const Lap< dim > &lap, const std::vector< vector_t > &={}, scalar_t scale=1) const |
Evaluate Laplacian lap at zero. More... | |
scalar_t | evalOpAt0 (int index, const Der1< dim > &der1, const std::vector< vector_t > &={}, scalar_t scale=1) const |
Evaluate first derivative operator der1 at zero. More... | |
scalar_t | evalOpAt0 (int index, const Der2< dim > &der2, const std::vector< vector_t > &={}, scalar_t scale=1) const |
Evaluate second derivative operator der2 at zero. More... | |
scalar_t | evalOpAt0 (int index, const Derivative< dim > &der, const std::vector< vector_t > &={}, scalar_t scale=1) const |
Evaluate general derivative operator at zero. More... | |
Static Public Member Functions | |
static Monomials< vec_t > | tensorBasis (int order) |
Construct a tensor basis of monomials ranging from 0 up to order (inclusive) in each dimension. More... | |
Public Types | |
enum | { dim = vec_t::dim } |
Store dimension of the domain. More... | |
typedef vec_t | vector_t |
Vector type. More... | |
typedef vector_t::scalar_t | scalar_t |
Scalar type. More... | |
Friends | |
template<class V > | |
std::ostream & | operator<< (std::ostream &os, const Monomials< V > &m) |
Output basic info about given Monomial basis. More... | |
Private Member Functions | |
void | setFromPowers (const std::vector< std::vector< int >> &powers) |
Constructs basis from a vector of powers. More... | |
Static Private Member Functions | |
static std::vector< std::vector< int > > | generatePowers (int max_order, int dim) |
Generate powers for dim -d monomials up to max_order . More... | |
Private Attributes | |
Eigen::Matrix< int, dim, Eigen::Dynamic > | powers_ |
A vector describing monomials with the powers of every coordinate. More... | |
anonymous enum |
Store dimension of the domain.
Enumerator | |
---|---|
dim | Dimensionality of the function domain. |
Definition at line 43 of file Monomials_fwd.hpp.
|
default |
Construct empty monomial basis with size = 0
.
mm::Monomials< vec_t >::Monomials | ( | int | order | ) |
Construct a basis of all monomials of combined order lower or equal to order
.
order | Maximal combined order of monomials to be used. If order is -1 then empty basis is constructed. |
Example: If you call this with an order = 2
parameter and Vec2d template parameter, your basis will consist of \( \{1, x, y, x^2, xy, y^2\} \) (not necessarily in that order).
Definition at line 18 of file Monomials.hpp.
|
inline |
Construct monomial basis from monomials with specific powers.
powers | List of lists of size dim , each representing powers of a monomial. For example {{1, 2}, {0, 3}, {2, 0}} in 2D represents monomials \(\{x y^2, y^3, x^2\}\). |
Definition at line 75 of file Monomials_fwd.hpp.
vec_t::scalar_t mm::Monomials< vec_t >::eval | ( | int | index, |
const vector_t & | point, | ||
const std::vector< vector_t > & | = {} |
||
) | const |
Evaluates index
-th monomial' at point
.
index | A number in [0, size()) specifying the index of a monomial to evaluate. |
point | Point in which to evaluate the monomial. |
Assertion | fails if index is out of range or if an invalid derivative is requested. |
Definition at line 67 of file Monomials.hpp.
vec_t::scalar_t mm::Monomials< vec_t >::evalAt0 | ( | int | index, |
const std::vector< vector_t > & | = {} |
||
) | const |
Evaluate index
-th monomial at zero.
Definition at line 173 of file Monomials.hpp.
vec_t::scalar_t mm::Monomials< vec_t >::evalOp | ( | int | index, |
const vector_t & | point, | ||
Der1< dim > | op, | ||
const std::vector< vector_t > & | support = {} , |
||
scalar_t | scale = 1 |
||
) | const |
vec_t::scalar_t mm::Monomials< vec_t >::evalOp | ( | int | index, |
const vector_t & | point, | ||
Der2< dim > | op, | ||
const std::vector< vector_t > & | support = {} , |
||
scalar_t | scale = 1 |
||
) | const |
vec_t::scalar_t mm::Monomials< vec_t >::evalOp | ( | int | index, |
const vector_t & | point, | ||
Derivative< dim > | op, | ||
const std::vector< vector_t > & | support = {} , |
||
scalar_t | scale = 1 |
||
) | const |
vec_t::scalar_t mm::Monomials< vec_t >::evalOp | ( | int | index, |
const vector_t & | point, | ||
Lap< dim > | op, | ||
const std::vector< vector_t > & | support = {} , |
||
scalar_t | scale = 1 |
||
) | const |
scalar_t mm::Monomials< vec_t >::evalOp | ( | int | index, |
const vector_t & | point, | ||
operator_t | op, | ||
const std::vector< vector_t > & | support = {} , |
||
scalar_t | scale = 1 |
||
) | const |
Apply an operator at a given point.
For \(\frac{d}{dx}\), the function computes \( \frac{d}{dx} p_i(x_s), x_s = \frac{x - c}{s} \).
index | A number in [0, size()) specifying the index of a monomial to evaluate. |
point | Translated and scaled point \(x_s\) at which the basis function is evaluated. |
op | The differential operator. |
support | Translated and scaled values of nodes in the support domain. Unused. |
scale | The scaling factor \(s\). |
index
-th basis function at point point
. Assertion | fails if index is out of range. |
vec_t::scalar_t mm::Monomials< vec_t >::evalOpAt0 | ( | int | index, |
const Der1< dim > & | der1, | ||
const std::vector< vector_t > & | = {} , |
||
scalar_t | scale = 1 |
||
) | const |
Evaluate first derivative operator der1
at zero.
Definition at line 207 of file Monomials.hpp.
vec_t::scalar_t mm::Monomials< vec_t >::evalOpAt0 | ( | int | index, |
const Der2< dim > & | der2, | ||
const std::vector< vector_t > & | = {} , |
||
scalar_t | scale = 1 |
||
) | const |
Evaluate second derivative operator der2
at zero.
Definition at line 228 of file Monomials.hpp.
vec_t::scalar_t mm::Monomials< vec_t >::evalOpAt0 | ( | int | index, |
const Derivative< dim > & | der, | ||
const std::vector< vector_t > & | support = {} , |
||
scalar_t | scale = 1 |
||
) | const |
Evaluate general derivative operator at zero.
Definition at line 262 of file Monomials.hpp.
vec_t::scalar_t mm::Monomials< vec_t >::evalOpAt0 | ( | int | index, |
const Lap< dim > & | lap, | ||
const std::vector< vector_t > & | = {} , |
||
scalar_t | scale = 1 |
||
) | const |
|
inline |
Evaluate an operator on index
-th monomial at zero.
Definition at line 136 of file Monomials_fwd.hpp.
|
staticprivate |
Generate powers for dim
-d monomials up to max_order
.
Definition at line 24 of file Monomials.hpp.
|
inline |
Get saved monomial powers.
Definition at line 90 of file Monomials_fwd.hpp.
|
private |
Constructs basis from a vector of powers.
Definition at line 54 of file Monomials.hpp.
|
inline |
Return number of monomials in this basis.
Definition at line 87 of file Monomials_fwd.hpp.
|
static |
Construct a tensor basis of monomials ranging from 0 up to order
(inclusive) in each dimension.
If order
is -1
then empty basis is constructed.
Example: tensorBasis(2)
in 2D constructs the set \(\{1, x, x^2, y, yx, yx^2, y^2, y^2x, y^2x^2\}\).
Definition at line 41 of file Monomials.hpp.
|
friend |
Output basic info about given Monomial basis.
Definition at line 269 of file Monomials.hpp.
|
private |
A vector describing monomials with the powers of every coordinate.
Definition at line 47 of file Monomials_fwd.hpp.