GQCP
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType > Class Template Reference

#include <EvaluableLinearCombination.hpp>

Inheritance diagram for GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >:
Inheritance graph
Collaboration diagram for GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >:
Collaboration graph

Public Types

using Coefficient = _Coefficient
 
using FunctionType = _FunctionType
 
using OutputType = sum_t< Coefficient, typename FunctionType::OutputType >
 
using InputType = typename FunctionType::InputType
 
using Self = EvaluableLinearCombination< Coefficient, FunctionType >
 
- Public Types inherited from GQCP::Function< sum_t< _Coefficient, _FunctionType::OutputType >, _FunctionType::InputType >
using OutputType = sum_t< _Coefficient, _FunctionType::OutputType >
 
using InputType = _FunctionType::InputType
 
- Public Types inherited from GQCP::CRTP< _Derived >
using Derived = _Derived
 

Public Member Functions

 EvaluableLinearCombination (const std::vector< Coefficient > &coefficients, const std::vector< FunctionType > &functions)
 
 EvaluableLinearCombination ()
 
 EvaluableLinearCombination (const Coefficient coefficient, const FunctionType &function)
 
 EvaluableLinearCombination (const FunctionType &function)
 
 EvaluableLinearCombination (const int zero)
 
Selfoperator+= (const Self &rhs) override
 
Selfoperator*= (const Coefficient &a) override
 
std::string description () const
 
size_t length () const
 
const Coefficientcoefficient (const size_t i) const
 
const std::vector< Coefficient > & coefficients () const
 
const FunctionTypefunction (const size_t i) const
 
const std::vector< FunctionType > & functions () const
 
OutputType operator() (const InputType &in) const override
 
bool operator== (const Self &other) const
 
void append (const Coefficient &coefficient, const FunctionType &function)
 
void appendWithThreshold (const Coefficient &coefficient, const FunctionType &function, const double threshold=1.0e-16)
 
void append (const std::vector< Coefficient > &coefficients, const std::vector< FunctionType > &functions)
 
- Public Member Functions inherited from GQCP::Function< sum_t< _Coefficient, _FunctionType::OutputType >, _FunctionType::InputType >
virtual ~Function ()=default
 
virtual OutputType operator() (const InputType &in) const=0
 
- Public Member Functions inherited from GQCP::VectorSpaceArithmetic< EvaluableLinearCombination< _Coefficient, _FunctionType >, _Coefficient >
virtual EvaluableLinearCombination< _Coefficient, _FunctionType > & operator+= (const EvaluableLinearCombination< _Coefficient, _FunctionType > &rhs)=0
 
virtual EvaluableLinearCombination< _Coefficient, _FunctionType > & operator*= (const _Coefficient &a)=0
 
EvaluableLinearCombination< _Coefficient, _FunctionType > & operator-= (const EvaluableLinearCombination< _Coefficient, _FunctionType > &rhs)
 
EvaluableLinearCombination< _Coefficient, _FunctionType > operator- () const
 
- Public Member Functions inherited from GQCP::CRTP< _Derived >
Derivedderived ()
 
const Derivedderived () const
 

Protected Attributes

std::vector< Coefficientm_coefficients
 
std::vector< FunctionTypem_functions
 

Detailed Description

template<typename _Coefficient, typename _FunctionType>
class GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >

A type that represents a linear combination of (homogeneous) mathematical functions.

Template Parameters
_CoefficientThe type of a coefficient.
_FunctionTypeThe type of the function.
Note
The type of the functions must derive from GQCP::Function, i.e. it must be evaluable.

Member Typedef Documentation

◆ Coefficient

template<typename _Coefficient , typename _FunctionType >
using GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::Coefficient = _Coefficient

◆ FunctionType

template<typename _Coefficient , typename _FunctionType >
using GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::FunctionType = _FunctionType

◆ InputType

template<typename _Coefficient , typename _FunctionType >
using GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::InputType = typename FunctionType::InputType

◆ OutputType

template<typename _Coefficient , typename _FunctionType >
using GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::OutputType = sum_t<Coefficient, typename FunctionType::OutputType>

◆ Self

template<typename _Coefficient , typename _FunctionType >
using GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::Self = EvaluableLinearCombination<Coefficient, FunctionType>

Constructor & Destructor Documentation

◆ EvaluableLinearCombination() [1/5]

template<typename _Coefficient , typename _FunctionType >
GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::EvaluableLinearCombination ( const std::vector< Coefficient > &  coefficients,
const std::vector< FunctionType > &  functions 
)
inline
Parameters
coefficientsThe coefficients of the linear combination.
functionsThe functions of the linear combination.

◆ EvaluableLinearCombination() [2/5]

template<typename _Coefficient , typename _FunctionType >
GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::EvaluableLinearCombination ( )
inline

The default constructor. Construct a 'zero vector', i.e. an empty linear combination.

◆ EvaluableLinearCombination() [3/5]

template<typename _Coefficient , typename _FunctionType >
GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::EvaluableLinearCombination ( const Coefficient  coefficient,
const FunctionType function 
)
inline

Construct a 'linear combination' of just one function.

Parameters
coefficientThe one coefficient that belongs to the function.
functionThe one single function.

◆ EvaluableLinearCombination() [4/5]

template<typename _Coefficient , typename _FunctionType >
GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::EvaluableLinearCombination ( const FunctionType function)
inline

Construct a 'linear combination' of just one function, setting the coefficient to 1.0.

Parameters
functionThe one single function.

◆ EvaluableLinearCombination() [5/5]

template<typename _Coefficient , typename _FunctionType >
GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::EvaluableLinearCombination ( const int  zero)
inline

Construct a 'zero vector' given the '0' integer literal.

Parameters
zeroThe '0' integer literal.

Member Function Documentation

◆ append() [1/2]

template<typename _Coefficient , typename _FunctionType >
void GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::append ( const Coefficient coefficient,
const FunctionType function 
)
inline

Append the given coefficient and function to this linear combination.

Parameters
coefficientsThe coefficient that should be appended to this linear combination.
functionsThe function that should be appended to this linear combination.

◆ append() [2/2]

template<typename _Coefficient , typename _FunctionType >
void GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::append ( const std::vector< Coefficient > &  coefficients,
const std::vector< FunctionType > &  functions 
)
inline

Append the given coefficients and functions to this linear combination.

Parameters
coefficientsThe coefficients that should be appended to this linear combination.
functionsThe functions that should be appended to this linear combination.

◆ appendWithThreshold()

template<typename _Coefficient , typename _FunctionType >
void GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::appendWithThreshold ( const Coefficient coefficient,
const FunctionType function,
const double  threshold = 1.0e-16 
)
inline

Append the given coefficient and function to this linear combination, but only if the coefficients are larger than the given threshold.

Parameters
coefficientsThe coefficient that should be appended to this linear combination.
functionsThe function that should be appended to this linear combination.
thresholdThe threshold for the (absolute value of the) coefficient in order to be included in this linear combination.

◆ coefficient()

template<typename _Coefficient , typename _FunctionType >
const Coefficient & GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::coefficient ( const size_t  i) const
inline

Access a coefficient.

Parameters
iAn index.
Returns
A read-only reference to the coefficient of this linear combination that corresponds to the given index.

◆ coefficients()

template<typename _Coefficient , typename _FunctionType >
const std::vector< Coefficient > & GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::coefficients ( ) const
inline
Returns
All the coefficients of the linear combination.

◆ description()

template<typename _Coefficient , typename _FunctionType >
std::string GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::description ( ) const
inline
Returns
A textual description of this linear combination.

◆ function()

template<typename _Coefficient , typename _FunctionType >
const FunctionType & GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::function ( const size_t  i) const
inline

Access a function.

Parameters
iAn index.
Returns
A read-only reference to the function of this linear combination that corresponds to the given index.

◆ functions()

template<typename _Coefficient , typename _FunctionType >
const std::vector< FunctionType > & GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::functions ( ) const
inline
Returns
All the scalar functions of this linear combination.

◆ length()

template<typename _Coefficient , typename _FunctionType >
size_t GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::length ( ) const
inline
Returns
The length of the linear combination, i.e. the number of coefficients/functions inside it.

◆ operator()()

template<typename _Coefficient , typename _FunctionType >
OutputType GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::operator() ( const InputType in) const
inlineoverride

Evaluate this linear combination.

Parameters
inThe argument for which the function is to be evaluated.
Returns
The function value of this linear combination for the given argument.

◆ operator*=()

template<typename _Coefficient , typename _FunctionType >
Self & GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::operator*= ( const Coefficient a)
inlineoverridevirtual

◆ operator+=()

template<typename _Coefficient , typename _FunctionType >
Self & GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::operator+= ( const Self rhs)
inlineoverride

Addition-assignment.

◆ operator==()

template<typename _Coefficient , typename _FunctionType >
bool GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::operator== ( const Self other) const
inline
Parameters
otherThe linear combination that this one is compared to.
Returns
Whether this linear combination is equal to the other.

Member Data Documentation

◆ m_coefficients

template<typename _Coefficient , typename _FunctionType >
std::vector<Coefficient> GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::m_coefficients
protected

◆ m_functions

template<typename _Coefficient , typename _FunctionType >
std::vector<FunctionType> GQCP::EvaluableLinearCombination< _Coefficient, _FunctionType >::m_functions
protected

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