QUGaR 0.0.4
|
Base class for tensor-product polynomial functions. More...
#include <polynomial_tp.hpp>
Public Types | |
using | CoefsType = std::conditional_t<range == 1, real, Point<range>> |
Coefs type. | |
![]() | |
template<int N> | |
using | Interval = ::algoim::Interval<N> |
Algoim's interval alias. | |
template<typename T > | |
using | Value = std::conditional_t<range == 1, T, Vector<T, range>> |
Value type. | |
template<typename T > | |
using | Gradient = Vector<Value<T>, dim> |
Gradient type. | |
template<typename T > | |
using | Hessian = Vector<Value<T>, num_hessian> |
Hessian (symmetric type). | |
Public Member Functions | |
PolynomialTP (const TensorSizeTP< dim > &order) | |
Constructor. | |
PolynomialTP (const TensorSizeTP< dim > &order, const CoefsType &value) | |
Constructs a constant value PolynomialTP object with the specified order. | |
PolynomialTP (const TensorSizeTP< dim > &order, const std::vector< CoefsType > &coefs) | |
Constructor. | |
std::size_t | get_num_coefs () const |
Get the number of coeficients. | |
const std::vector< CoefsType > & | get_coefs () const |
Gets the polynomial coefficients. | |
const TensorSizeTP< dim > & | get_order () const |
Gets the polynomial order along the parametric directions. | |
int | get_order (int dir) const |
Gets the polynomial order (degree + 1) along the direction dir . | |
const CoefsType & | get_coef (int index) const |
Retrieves the coefficients at the specified index. | |
CoefsType & | get_coef (int index) |
Retrieves the coefficients at the specified index. | |
const CoefsType & | get_coef (const TensorIndexTP< dim > &index) const |
Retrieves the coefficient associated with the given tensor index. | |
CoefsType & | get_coef (const TensorIndexTP< dim > &index) |
Retrieves the coefficient associated with the given tensor index. | |
int | get_degree (int dir) const |
Gets the polynomial degree (order - 1) along the direction dir . | |
void | transform_image (const BoundBox< range > &old_domain, const BoundBox< range > &new_domain) |
Transforms (in place) the coefficients of the polynomial from old_domain to new_domain . | |
void | coefs_linear_transform (const real scale, const CoefsType &shift) |
Applies a linear transformation to every coefficient. | |
![]() | |
DomainFunc ()=default | |
Default constructor. | |
DomainFunc (const DomainFunc &)=default | |
Default copy constructor. | |
DomainFunc (DomainFunc &&)=default | |
Default move constructor. | |
DomainFunc & | operator= (const DomainFunc &)=default |
Default copy assignment operator. | |
DomainFunc & | operator= (DomainFunc &&)=default |
Default move assignment operator. | |
virtual | ~DomainFunc ()=default |
Default virtual destructor. | |
virtual Value< real > | operator() (const Point< dim > &point) const =0 |
Evaluator operator. | |
virtual Value< Interval< dim > > | operator() (const Point< dim, Interval< dim > > &point) const =0 |
Evaluator operator. | |
virtual Gradient< real > | grad (const Point< dim > &point) const =0 |
Gradient evaluator operator. | |
virtual Gradient< Interval< dim > > | grad (const Point< dim, Interval< dim > > &point) const =0 |
Gradient evaluator operator. | |
virtual Hessian< real > | hessian (const Point< dim > &point) const =0 |
Hessian evaluator operator. | |
Protected Attributes | |
TensorSizeTP< dim > | order_ |
Order of the polynomial along each parametric direction. | |
std::vector< CoefsType > | coefs_ |
Additional Inherited Members | |
![]() | |
static const int | num_hessian = dim * (dim + 1) / 2 |
Number of Hessian (symmetric) components. | |
Base class for tensor-product polynomial functions.
dim | Dimension of the parametric domain. |
range | Dimension of the image. |
using qugar::impl::PolynomialTP< dim, range >::CoefsType = std::conditional_t<range == 1, real, Point<range>> |
Coefs type.
|
explicit |
Constructor.
The coefficients vector is allocated by the constructor.
order | Order of the polynomial along each parametric direction. |
qugar::impl::PolynomialTP< dim, range >::PolynomialTP | ( | const TensorSizeTP< dim > & | order, |
const CoefsType & | value ) |
Constructs a constant value PolynomialTP object with the specified order.
order | The order of the polynomial tensor. |
value | Constant value for all the coefficients. |
qugar::impl::PolynomialTP< dim, range >::PolynomialTP | ( | const TensorSizeTP< dim > & | order, |
const std::vector< CoefsType > & | coefs ) |
Constructor.
coefs | Coefficients of the polynomial. The ordering is such that dimension 0 is inner-most, i.e., iterates the fastest, while dimension dim-1 is outer-most and iterates the slowest. |
order | Order of the polynomial along each parametric direction. |
void qugar::impl::PolynomialTP< dim, range >::coefs_linear_transform | ( | const real | scale, |
const CoefsType & | shift ) |
Applies a linear transformation to every coefficient.
It modifies every coefficient as coef = scale * coef + shift.
scale | Scale of every coefficient. |
shift | Shift of every coefficient. |
|
nodiscard |
Retrieves the coefficient associated with the given tensor index.
This function returns a reference to the coefficient corresponding to the specified tensor index. The coefficient is part of the polynomial tensor product representation.
dim | The dimension of the tensor index. |
index | The tensor index for which the coefficient is to be retrieved. |
|
nodiscard |
Retrieves the coefficient associated with the given tensor index.
This function returns a reference to the coefficient corresponding to the specified tensor index. The coefficient is part of the polynomial tensor product representation.
dim | The dimension of the tensor index. |
index | The tensor index for which the coefficient is to be retrieved. |
|
nodiscard |
Retrieves the coefficients at the specified index.
This function returns a constant reference to the coefficients of the polynomial at the given index. The coefficients are of type CoefsType.
index | The index of the coefficients to retrieve. |
|
nodiscard |
Retrieves the coefficients at the specified index.
This function returns a constant reference to the coefficients of the polynomial at the given index. The coefficients are of type CoefsType.
index | The index of the coefficients to retrieve. |
|
nodiscard |
Gets the polynomial coefficients.
|
nodiscard |
Gets the polynomial degree (order - 1) along the direction dir
.
dir | Direction along which the order is retrieved. |
dir
.
|
nodiscard |
Get the number of coeficients.
|
nodiscard |
Gets the polynomial order along the parametric directions.
|
nodiscard |
Gets the polynomial order (degree + 1) along the direction dir
.
dir | Direction along which the order (degree + 1) is retrieved. |
dir
. void qugar::impl::PolynomialTP< dim, range >::transform_image | ( | const BoundBox< range > & | old_domain, |
const BoundBox< range > & | new_domain ) |
Transforms (in place) the coefficients of the polynomial from old_domain
to new_domain
.
old_domain | Domain from which polynomial coefficients are transformed from. |
new_domain | Domain to which polynomial coefficients are transformed to. |
|
protected |
Coefficients of the polynomial. The ordering is such that dimension param_di-1 is inner-most, i.e., iterates the fastest, while dimension 0 is outer-most and iterates the slowest.
|
protected |
Order of the polynomial along each parametric direction.