BSplinebasis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
bspline::Spline< T, order > Class Template Referencefinal

The central Spline class of the library. More...

#include <Spline.h>

Public Types

using data_type = T
 The data type T of the spline.
 

Public Member Functions

 Spline (Support< T > support, std::vector< std::array< T, ARRAY_SIZE > > coefficients)
 Constructor setting the data. Performs sanity checks.
 
 Spline (Grid< T > grid)
 Constructs an empty spline on the global grid.
 
const Support< T > & getSupport () const noexcept
 Returns the spline's support.
 
const std::vector< std::array< T, ARRAY_SIZE > > & getCoefficients () const noexcept
 The spline's polynomial coefficients.
 
T operator() (const T &x) const
 Evaluates the spline at point x.
 
const Tfront () const
 Returns the begin of the spline's support.
 
const Tback () const
 Returns the end of the spline's support.
 
template<size_t order2>
bool checkOverlap (const Spline< T, order2 > &m2) const
 Checks whether the supports of the two splines overlap.
 
bool isZero () const
 Checks whether this spline is a zero over the whole number line.
 
Spline< T, orderoperator/ (const T &d) const
 Scalar-division operator.
 
Spline< T, orderoperator* (const T &d) const
 Scalar-multiplication operator.
 
Spline< T, order > & operator*= (const T &d)
 In-place scalar-multiplication operator.
 
Spline< T, order > & operator/= (const T &d)
 In-place scalar-division operator.
 
Spline< T, orderoperator- () const
 Unary minus operator.
 
template<size_t ordera>
Spline< T, order > & operator= (const Spline< T, ordera > &a)
 Copy assign operator.
 
template<size_t ordera>
Spline< T, order+orderaoperator* (const Spline< T, ordera > &a) const
 Spline-spline multiplication operator.
 
template<size_t ordera>
Spline< T, std::max(order, ordera)> operator+ (const Spline< T, ordera > &a) const
 Spline addition operator.
 
template<size_t ordera>
Spline< T, order > & operator+= (const Spline< T, ordera > &a)
 In-place addition operator.
 
template<size_t ordera>
Spline< T, order > & operator-= (const Spline< T, ordera > &a)
 Binary in-place subtraction operator.
 
template<size_t ordera>
Spline< T, std::max(order, ordera)> operator- (const Spline< T, ordera > &a) const
 Binary subtraction operator.
 
bool operator== (const Spline &other) const
 Compares two splines for equality.
 
bool operator!= (const Spline &other) const
 Compares two splines for inequality.
 

Static Public Attributes

static constexpr size_t spline_order = order
 The order of the spline.
 

Detailed Description

template<typename T, size_t order>
class bspline::Spline< T, order >

The central Spline class of the library.

Spline class representing spline of datatype T and order order. The coefficients of the spline are defined with respect to the center point xm of each interval.

Template Parameters
TDatatype of the spline.
orderOrder of the spline.

Constructor & Destructor Documentation

◆ Spline() [1/2]

template<typename T , size_t order>
bspline::Spline< T, order >::Spline ( Support< T support,
std::vector< std::array< T, ARRAY_SIZE > >  coefficients 
)
inline

Constructor setting the data. Performs sanity checks.

Parameters
supportThe spline's support.
coefficientsPolynomial coefficients of the spline on each interval.

◆ Spline() [2/2]

template<typename T , size_t order>
bspline::Spline< T, order >::Spline ( Grid< T grid)
inlineexplicit

Constructs an empty spline on the global grid.

Parameters
gridThe global grid.

Member Function Documentation

◆ back()

template<typename T , size_t order>
const T & bspline::Spline< T, order >::back ( ) const
inline

Returns the end of the spline's support.

Returns the end of the support of this spline. If the spline is empty, an exception is thrown.

Exceptions
BSplineExceptionIf the spline's support is empty.
Returns
The end of the spline's support.

◆ checkOverlap()

template<typename T , size_t order>
template<size_t order2>
bool bspline::Spline< T, order >::checkOverlap ( const Spline< T, order2 > &  m2) const
inline

Checks whether the supports of the two splines overlap.

Parameters
m2Other spline against which to check.
Template Parameters
order2Order of spline m2.
Returns
True if the intersection of the supports of the two splines is not empty or point-like.

◆ front()

template<typename T , size_t order>
const T & bspline::Spline< T, order >::front ( ) const
inline

Returns the begin of the spline's support.

Returns the beginning of the support of this spline. If the spline is empty, an exception is thrown.

Exceptions
BSplineExceptionIf the spline's support is empty.
Returns
The begin of the spline's support.

◆ getCoefficients()

template<typename T , size_t order>
const std::vector< std::array< T, ARRAY_SIZE > > & bspline::Spline< T, order >::getCoefficients ( ) const
inlinenoexcept

The spline's polynomial coefficients.

Returns the polynomial coefficients of the spline for each interval.

Returns
A refrence to a vector of arrays containing this spline's polynomial coefficients.

◆ getSupport()

template<typename T , size_t order>
const Support< T > & bspline::Spline< T, order >::getSupport ( ) const
inlinenoexcept

Returns the spline's support.

Returns
This spline's support.

◆ isZero()

template<typename T , size_t order>
bool bspline::Spline< T, order >::isZero ( ) const
inline

Checks whether this spline is a zero over the whole number line.

Checks whether this spline returns zero for all x. Can be the case, either if the support contains no intervals (i.e. the vector intervals is empty) or if all coefficients are zero.

Returns
True if the evaluation of the spline returns zero for all input values.

◆ operator!=()

template<typename T , size_t order>
bool bspline::Spline< T, order >::operator!= ( const Spline< T, order > &  other) const
inline

Compares two splines for inequality.

Parameters
otherThe spline to compare this spline to.
Returns
false if the splines are identical, true otherwise.

◆ operator()()

template<typename T , size_t order>
T bspline::Spline< T, order >::operator() ( const T x) const
inline

Evaluates the spline at point x.

Parameters
xPoint at which to evaluate the spline. If x is outside of the support of the spline, zero is returned.
Returns
The value of the spline at point x. If x is outside the spline's support, zero is returned.

◆ operator*() [1/2]

template<typename T , size_t order>
template<size_t ordera>
Spline< T, order+ordera > bspline::Spline< T, order >::operator* ( const Spline< T, ordera > &  a) const
inline

Spline-spline multiplication operator.

Spline-spline multiplication operator. Returns a spline of order order + ordera.

Parameters
aSpline to be multiplied with this spline.
Template Parameters
orderaOrder of spline a.
Exceptions
BSplineExceptionIf the two splines are defined on different grids.
Returns
A new spline representing the product of this spline and spline a.

◆ operator*() [2/2]

template<typename T , size_t order>
Spline< T, order > bspline::Spline< T, order >::operator* ( const T d) const
inline

Scalar-multiplication operator.

Scalar-multiplication operator. Multiplies this spline with the scalar d.

Parameters
dScalar by which to multiply this spline.
Returns
A new, scaled spline.

◆ operator*=()

template<typename T , size_t order>
Spline< T, order > & bspline::Spline< T, order >::operator*= ( const T d)
inline

In-place scalar-multiplication operator.

In-place scalar-multiplication operator. Multiplies this spline with the scalar d in-place.

Parameters
dScalar by which to multiply this spline.
Returns
A reference to this spline.

◆ operator+()

template<typename T , size_t order>
template<size_t ordera>
Spline< T, std::max(order, ordera)> bspline::Spline< T, order >::operator+ ( const Spline< T, ordera > &  a) const
inline

Spline addition operator.

Addition operator. Adds spline a to this spline.

Parameters
aSpline to be added.
Template Parameters
orderaOrder of spline a.
Exceptions
BSplineExceptionIf the two splines are defined on different grids.
Returns
A new spline representing the sum of this spline and spline a.

◆ operator+=()

template<typename T , size_t order>
template<size_t ordera>
Spline< T, order > & bspline::Spline< T, order >::operator+= ( const Spline< T, ordera > &  a)
inline

In-place addition operator.

In-place addition operator. Adds spline a to this spline. The operation is only well defined if the order of spline a is lower than or equal to the order of this spline object.

Parameters
aSpline to be added.
Template Parameters
orderaOrder of spline a.
Exceptions
BSplineExceptionIf the two splines are defined on different grids.
Returns
A reference to this spline.

◆ operator-() [1/2]

template<typename T , size_t order>
Spline< T, order > bspline::Spline< T, order >::operator- ( ) const
inline

Unary minus operator.

Returns
A new, scaled spline.

◆ operator-() [2/2]

template<typename T , size_t order>
template<size_t ordera>
Spline< T, std::max(order, ordera)> bspline::Spline< T, order >::operator- ( const Spline< T, ordera > &  a) const
inline

Binary subtraction operator.

Binary subtraction operator. Subtracts spline a from this spline.

Parameters
aSpline to be subtracted.
Template Parameters
orderaOrder of spline a.
Exceptions
BSplineExceptionIf the two splines are defined on different grids.
Returns
A new spline representing the difference of this spline and spline a.

◆ operator-=()

template<typename T , size_t order>
template<size_t ordera>
Spline< T, order > & bspline::Spline< T, order >::operator-= ( const Spline< T, ordera > &  a)
inline

Binary in-place subtraction operator.

Binary in-place subtraction operator. Subtracts spline a from this spline. The operation is only well defined if the order of the spline to be subtracted is lower than or equal to the order of this spline object.

Parameters
aSpline to be subtracted.
Template Parameters
orderaOrder of spline a.
Exceptions
BSplineExceptionIf the two splines are defined on different grids.
Returns
A reference to this spline.

◆ operator/()

template<typename T , size_t order>
Spline< T, order > bspline::Spline< T, order >::operator/ ( const T d) const
inline

Scalar-division operator.

Scalar-division operator. Divides this spline by the scalar d.

Parameters
dScalar by which to divide this spline.
Returns
A new, scaled spline.

◆ operator/=()

template<typename T , size_t order>
Spline< T, order > & bspline::Spline< T, order >::operator/= ( const T d)
inline

In-place scalar-division operator.

In-place scalar-division operator. Divides this spline by the scalar d in-place.

Parameters
dScalar by which to divide this spline.
Returns
A reference to this spline.

◆ operator=()

template<typename T , size_t order>
template<size_t ordera>
Spline< T, order > & bspline::Spline< T, order >::operator= ( const Spline< T, ordera > &  a)
inline

Copy assign operator.

Copy assign of spline to this spline object. The operation is only well defined if the order of the spline to be assigned is lower than or equal to the order of this spline object.

Parameters
aSpline to be assigned.
Template Parameters
orderaOrder of spline a.
Returns
A reference to this spline.

◆ operator==()

template<typename T , size_t order>
bool bspline::Spline< T, order >::operator== ( const Spline< T, order > &  other) const
inline

Compares two splines for equality.

Parameters
otherThe spline to compare this spline to.
Returns
true if the splines are identical, false otherwise.

The documentation for this class was generated from the following file: