DACE 2.0 API Manual
Differential Algebra Core Engine
Public Member Functions
DACE::compiledDA Class Reference

#include <dace/compiledDA.h>

Public Member Functions

 compiledDA (const compiledDA &cda)
 Copy constructor. More...
 
 compiledDA (const DA &da)
 Constructor from a single DA. More...
 
 compiledDA (const std::vector< DA > &da)
 Constructor from a vector of DA. More...
 
 ~compiledDA () throw ()
 Default destructor. More...
 
compiledDAoperator= (const compiledDA &cda)
 Copy assignment. More...
 
template<class V >
eval (const V &args) const
 Evaluate the compiled polynomial with a vector of any arithmetic type and return vector of results. More...
 
template<class T >
std::vector< T > eval (const std::initializer_list< T > l) const
 Evaluate the compiled polynomial with a braced initializer list and return a vector of results. More...
 
template<class T >
std::vector< T > eval (const T args[], const unsigned int length) const
 Evaluate the compiled polynomial with an array of any arithmetic type and return vector of results. More...
 
template<class T >
std::vector< T > evalScalar (const T &arg) const
 Evaluate the compiled polynomial with a single variable of arithmetic type and return vector of results. More...
 
template<class T >
void eval (const std::vector< T > &args, std::vector< T > &res) const
 Evaluate the compiled polynomial with a vector of any arithmetic type and store results in provided vector. More...
 
const double * getAc () const
 Return a pointer to the internal coefficient array. More...
 
unsigned int getDim () const
 Return the number of polynomials. More...
 
unsigned int getOrd () const
 Return the maximum order in all polynomials. More...
 
unsigned int getVars () const
 Return the number of independent variables in all polynomials. More...
 
unsigned int getTerms () const
 Return the number of terms. More...
 
template<>
void eval (const std::vector< double > &args, std::vector< double > &res) const
 
template<>
void eval (const std::vector< DA > &args, std::vector< DA > &res) const
 
template<>
DACE_API void eval (const std::vector< DA > &args, std::vector< DA > &res) const
 
template<>
DACE_API void eval (const std::vector< double > &args, std::vector< double > &res) const
 

Detailed Description

compiledDA class representing a precomputed representation of a polynomial for efficient evaluation.

Constructor & Destructor Documentation

◆ compiledDA() [1/3]

DACE::compiledDA::compiledDA ( const compiledDA cda)

Copy constructor.

Create a copy of a compiledDA object.

Parameters
[in]cdacompiled DA object to be copied.

◆ compiledDA() [2/3]

DACE::compiledDA::compiledDA ( const DA da)

Constructor from a single DA.

Create a compiledDA object from a DA object.

Parameters
[in]davector.
Exceptions
DACE::DACEException

◆ compiledDA() [3/3]

DACE::compiledDA::compiledDA ( const std::vector< DA > &  da)

Constructor from a vector of DA.

Create a vector of compiledDA objects from a vector of DA objects.

Parameters
[in]davector of DA objects.
Exceptions
DACE::DACEException

◆ ~compiledDA()

DACE::compiledDA::~compiledDA ( )
throw (
)

Default destructor.

Destructor.

Member Function Documentation

◆ eval() [1/8]

template<class V >
V DACE::compiledDA::eval ( const V &  args) const

Evaluate the compiled polynomial with a vector of any arithmetic type and return vector of results.

Evaluate the compiled polynomial with a vector of any arithmetic type (such as DA or double) and return vector of results.

Parameters
[in]argsthe values of the independent DA variables to evaluate with. Must be a std::vector<> (or derived class) of an arithmetic type. If less than the number of independent DA variables defined during the DACE initialization are given, the missing entries are assumed to be zero.
Returns
Vector with the result of the evaluation. The vector is of the same type as the argument args.

◆ eval() [2/8]

template<class T >
std::vector< T > DACE::compiledDA::eval ( const std::initializer_list< T >  l) const

Evaluate the compiled polynomial with a braced initializer list and return a vector of results.

Evaluate the compiled polynomial with a braced initializer list of any arithmetic type (such as DA or double) and return vector of results.

Parameters
[in]lthe values of the independent DA variables to evaluate with. Must be a braced initializer list of an arithmetic type. If less than the number of independent DA variables defined during the DACE initialization are given, the missing entries are assumed to be zero.
Returns
std::vector with the result of the evaluation.
Note
C++ is not able to derive the type of elements of an initializer list automatically. That means eval() must be called explicitly as e.g. eval<double>({1.0, 2.0, 3.0}) when used with initializer lists.

◆ eval() [3/8]

template<class T >
std::vector< T > DACE::compiledDA::eval ( const T  args[],
const unsigned int  length 
) const

Evaluate the compiled polynomial with an array of any arithmetic type and return vector of results.

Evaluate the compiled polynomial with an array of any arithmetic type (such as DA or double) and return vector of results.

Parameters
[in]argsarray of the values of the independent DA variables to evaluate with.
[in]lengthSize of the array args[]. If less than the number of variables defined during the DACE initialization are given, the missing entries are assumed to be zero.
Returns
Vector with the result of the evaluation. The vector is of type std::vector<V>.

◆ eval() [4/8]

template<class T >
void DACE::compiledDA::eval ( const std::vector< T > &  args,
std::vector< T > &  res 
) const

Evaluate the compiled polynomial with a vector of any arithmetic type and store results in provided vector.

◆ eval() [5/8]

template<>
DACE_API void DACE::compiledDA::eval ( const std::vector< DA > &  args,
std::vector< DA > &  res 
) const

◆ eval() [6/8]

template<>
DACE_API void DACE::compiledDA::eval ( const std::vector< double > &  args,
std::vector< double > &  res 
) const

◆ eval() [7/8]

template<>
void DACE::compiledDA::eval ( const std::vector< double > &  args,
std::vector< double > &  res 
) const

◆ eval() [8/8]

template<>
void DACE::compiledDA::eval ( const std::vector< DA > &  args,
std::vector< DA > &  res 
) const

◆ evalScalar()

template<class T >
std::vector< T > DACE::compiledDA::evalScalar ( const T &  arg) const

Evaluate the compiled polynomial with a single variable of arithmetic type and return vector of results.

Evaluate the compiled polynomial with a single argument of any arithmetic type (such as DA or double) and return vector of results.

Parameters
[in]argThe value of the first independent DA variable to evaluate with. All remaining independent DA variables are assumed to be zero.
Returns
Vector with the result of the evaluation. The vector is of type std::vector<V>.

◆ getAc()

const double * DACE::compiledDA::getAc ( ) const

Return a pointer to the internal coefficient array.

◆ getDim()

unsigned int DACE::compiledDA::getDim ( ) const

Return the number of polynomials.

◆ getOrd()

unsigned int DACE::compiledDA::getOrd ( ) const

Return the maximum order in all polynomials.

◆ getTerms()

unsigned int DACE::compiledDA::getTerms ( ) const

Return the number of terms.

◆ getVars()

unsigned int DACE::compiledDA::getVars ( ) const

Return the number of independent variables in all polynomials.

◆ operator=()

compiledDA & DACE::compiledDA::operator= ( const compiledDA cda)

Copy assignment.

Copy the content of a given compiledDA object into the current compiledDA (the one the method belongs to).

Parameters
[in]cdacompiledDA vector to be copied.
Returns
The compiledDA object with the same content of the given compiledDA.

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