CAPD DynSys Library
5.2.0
|
Class Function represents a function . More...
#include <capd/map/Function.h>
Public Types | |
typedef VectorType::ScalarType | ScalarType |
typedef BasicFunction< ScalarType > | BaseFunction |
typedef BaseFunction::size_type | size_type |
typedef capd::autodiff::DagIndexer< ScalarType > | DAG |
typedef capd::autodiff::Node | NodeType |
Public Member Functions | |
Function () | |
creates an univariate constant function f(x)=0 More... | |
Function (const std::string &s) | |
parses expression from given string. Allocates memory for ODE solver of order 'order' More... | |
Function (const char *s) | |
parses expression from given string. Allocates memory for ODE solver of order 'order' More... | |
Function (const Function &f) | |
copying constructor More... | |
template<typename Functional > | |
Function (Functional f, int dimIn, int noParam, size_type degree=1) | |
parses expression from given routine. More... | |
Function & | operator= (const std::string &) |
substitution from string. Parse expression and compute new DAG. More... | |
Function & | operator= (const char *) |
substitution from string. Parse expression and compute new DAG. More... | |
Function & | operator= (const Function &f) |
assignment from an object More... | |
ScalarType | operator() (const ScalarType &v) const |
evaluates function (for univariate case) More... | |
ScalarType | operator() (const VectorType &v) const |
evaluates function at a given vector More... | |
VectorType | gradient (VectorType u) const |
returns gradient of the function computed at vector u More... | |
void | setParameters (const VectorType &values) |
simultaneously sets values of many parameters. It is assumed that given vector contains values of subsequent parameters. More... | |
void | setOrder (size_type) |
allocates necessary memory for ODE solver of order 'order' More... | |
void | setParameter (size_type d, const VectorType::ScalarType &value) |
sets new value of a parameter of index d. More... | |
void | setParameter (const std::string &name, const ScalarType &value) |
sets new value of a parameter. If parameter not found there is no effect. More... | |
void | setParameters (const VectorType::ScalarType *values, size_type d) |
simultaneously sets values of many parameters. It is assumed that given vector contains values of subsequent parameters. More... | |
ScalarType | getParameter (size_type d) const |
ScalarType | getParameter (const std::string &name) const |
void | setCurrentTime (const ScalarType &a_time) const |
sets actual value of variable that represents time in an ODE. More... | |
const ScalarType & | getCurrentTime () const |
returns actual value of variable that represents time in an ODE More... | |
void | differentiateTime () const |
sets first derivative of time with respect to time equal to 1 More... | |
void | setMask (Iterator b, Iterator e) |
The iterator range [b,e) should contain a range of Multiinideces the user requires to compute. More... | |
void | addMultiindexToMask (const capd::vectalg::Multiindex &mi) |
Adds new multiindex (along with dependencies) to the existing mask. More... | |
void | resetMask () |
Resets the mask of derivatives. More... | |
const bool * | getMask () const |
bool | getMask (size_type i) const |
bool | getMask (size_type i, size_type j) const |
Protected Member Functions | |
void | check (const std::string &s) |
void | reset (Function f, int dimIn, int dimOut, int noParam) |
parses expression from given routine. More... | |
void | createDefault () |
used to create a default object without expression. Creates a univariate constant function f(x)=0 More... | |
void | createFromText (std::string s) |
parses expression from given string. Allocates memory for ODE solver of order 'order' More... | |
void | copyObject (const BasicFunction &f) |
an auxiliary function used in copying constructor and assignment operator More... | |
void | clean () |
resets all allocated data More... | |
void | realloc (size_type degree) |
reallocates memory for computation of derivatives up to order 'degree' More... | |
void | setArgument (const V &v) const |
void | applyC1Mask () const |
void | evalHomogenousPolynomial () const |
void | evalHomogenousPolynomial (size_type degree, size_type coeffNo=0) const |
void | eval (size_type coeffNo) const |
void | eval (size_type degree, size_type coeffNo) const |
void | deleteNodes () |
Protected Attributes | |
std::vector< capd::autodiff::AbstractNode< ScalarType > * > | m_nodes |
std::vector< capd::autodiff::Node > | m_fullGraph |
graph representing the expression More... | |
std::vector< capd::autodiff::MyNode > | m_evalPath |
reduced graph - only nodes with nontrivial evaluations are left More... | |
std::vector< int > | m_pos |
indices of roots of expressions for each component More... | |
std::vector< std::string > | m_var |
variables, time and parameters More... | |
DAG | m_dag |
data structure that stores all the coefficients. Provides suitable indexing and evaluation of expression. More... | |
size_type | m_indexOfFirstParam |
if equal to m_var.size() then no parameters specified More... | |
Class Function represents a function .
It provides methods for computation of value, gradient and normalized derivatives (Taylor coefficients) of this function at a given point.
The function is internally represented as an optimized array that encodes Direct Acyclic Graph associated to the expression defining function. The expression defining function can be specified as a human readable string or a routine.
The template parameter is a Vector that satisfies capd::vectalg::Vector interface. This includes:
typedef BasicFunction<ScalarType> capd::map::Function< VectorType >::BaseFunction |
|
inherited |
|
inherited |
typedef VectorType::ScalarType capd::map::Function< VectorType >::ScalarType |
typedef BaseFunction::size_type capd::map::Function< VectorType >::size_type |
capd::map::Function< VectorType >::Function |
creates an univariate constant function f(x)=0
capd::map::Function< VectorType >::Function | ( | const std::string & | s | ) |
parses expression from given string. Allocates memory for ODE solver of order 'order'
capd::map::Function< VectorType >::Function | ( | const char * | s | ) |
parses expression from given string. Allocates memory for ODE solver of order 'order'
capd::map::Function< VectorType >::Function | ( | const Function< VectorType > & | f | ) |
copying constructor
|
inline |
parses expression from given routine.
Allocates memory for jet propagation of degree 'degree'
f | - routine that defines function, its signature is: void (NodeType time, NodeType in[], int dimIn, NodeType out[], int dimOut, NodeType param[], int noParam) |
dimIn | - number of input variables (dimension of domain) |
dimOut | - number of output variables (dimension of codomain) |
noParam | - number of parameters |
|
inlineinherited |
Adds new multiindex (along with dependencies) to the existing mask.
mi | multiindex to be added to the mask |
|
protectedinherited |
|
protected |
|
protectedinherited |
resets all allocated data
|
protectedinherited |
an auxiliary function used in copying constructor and assignment operator
|
protectedinherited |
used to create a default object without expression. Creates a univariate constant function f(x)=0
|
protectedinherited |
parses expression from given string. Allocates memory for ODE solver of order 'order'
|
protectedinherited |
|
inherited |
sets first derivative of time with respect to time equal to 1
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inherited |
returns actual value of variable that represents time in an ODE
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
inherited |
VectorType capd::map::Function< VectorType >::gradient | ( | VectorType | u | ) | const |
returns gradient of the function computed at vector u
Function< VectorType >::ScalarType capd::map::Function< VectorType >::operator() | ( | const ScalarType & | v | ) | const |
evaluates function (for univariate case)
Function< VectorType >::ScalarType capd::map::Function< VectorType >::operator() | ( | const VectorType & | v | ) | const |
evaluates function at a given vector
Function< VectorType > & capd::map::Function< VectorType >::operator= | ( | const char * | s | ) |
substitution from string. Parse expression and compute new DAG.
Function< VectorType > & capd::map::Function< VectorType >::operator= | ( | const Function< VectorType > & | f | ) |
assignment from an object
Function< VectorType > & capd::map::Function< VectorType >::operator= | ( | const std::string & | s | ) |
substitution from string. Parse expression and compute new DAG.
|
protectedinherited |
reallocates memory for computation of derivatives up to order 'degree'
|
protectedinherited |
parses expression from given routine.
Assignment of new function parsed from a routine.
Allocates memory for jet propagation of degree 'degree'
f | - routine that defines function, its signature is: void (NodeType time, NodeType in[], int dimIn, NodeType out[], int dimOut, NodeType param[], int noParam) |
dimIn | - number of input variables (dimension of domain) |
dimOut | - number of output variables (dimension of codomain) |
noParam | - number of parameters |
|
inlineinherited |
Resets the mask of derivatives.
In consequence, full jet of derivatives will be computed after call to any method that computes derivative, hessian or jet.
|
protectedinherited |
|
inherited |
sets actual value of variable that represents time in an ODE.
|
inlineinherited |
The iterator range [b,e) should contain a range of Multiinideces the user requires to compute.
The method automatically adds all the depending partial derivatives to this collection and defines a mask for computation of partial derivtives.
[b,e) | iterator range which contains collection of multiindices |
|
inherited |
allocates necessary memory for ODE solver of order 'order'
|
inherited |
sets new value of a parameter. If parameter not found there is no effect.
|
inherited |
sets new value of a parameter of index d.
void capd::map::Function< VectorType >::setParameters | ( | const VectorType & | values | ) |
simultaneously sets values of many parameters. It is assumed that given vector contains values of subsequent parameters.
|
inherited |
simultaneously sets values of many parameters. It is assumed that given vector contains values of subsequent parameters.
|
mutableprotectedinherited |
data structure that stores all the coefficients. Provides suitable indexing and evaluation of expression.
|
protectedinherited |
reduced graph - only nodes with nontrivial evaluations are left
|
protectedinherited |
graph representing the expression
|
protectedinherited |
if equal to m_var.size() then no parameters specified
|
protectedinherited |
|
protectedinherited |
indices of roots of expressions for each component
|
protectedinherited |
variables, time and parameters