MC++
Construction, Manipulation and Evaluation of DAGs for Factorable Functions

Typedefs

typedef std::pair< TYPE, long > mc::FFVar::pt_idVar
 Typedef for variable identifier in factorable function.
 

Enumerations

enum  mc::FFVar::TYPE { mc::FFVar::VAR =0, mc::FFVar::AUX, mc::FFVar::CINT, mc::FFVar::CREAL }
 Enumeration type for variables in factorable function. More...
 

Variables

static const long mc::FFVar::NOREF = -33
 Index for 'free' variables in factorable function.
 
 mc::FFVar::FFVar (FFGraph *dag)
 Constructor for variable in DAG *dag
 
FFVar & mc::FFVar::set (FFGraph *dag)
 Attach variable to DAG *dag.
 
 mc::FFVar::FFVar (const int i=0)
 Constructor for integer constant.
 
 mc::FFVar::FFVar (const double d)
 Constructor for real parameter.
 
 mc::FFVar::FFVar (const FFVar &Var)
 Copy constructor.
 
const std::pair< TYPE, long > mc::FFVar::id () const
 Get variable identifier.
 
std::pair< TYPE, long > & mc::FFVar::id ()
 Get reference to variable identifier.
 
const FFNum & mc::FFVar::num () const
 Get const reference to variable numeric field.
 
const FFDep & mc::FFVar::dep () const
 Get const reference to variable dependencies.
 
FFDep & mc::FFVar::dep ()
 Get reference to variable dependencies.
 
const pt_Ops mc::FFVar::ops () const
 Get const pointer to defining operation.
 
pt_Ops & mc::FFVar::ops ()
 Get pointer to defining operation.
 
const FFGraph * mc::FFVar::dag () const
 Get const pointer to factorable function.
 
FFGraph *& mc::FFVar::dag ()
 Get pointer to factorable function dag.
 
void *& mc::FFVar::val ()
 Get pointer to value field.
 
template<typename U >
void mc::FFVar::reset_val (const U &U_dum)
 Get pointer to value field.
 
std::string mc::FFVar::name () const
 Get variable name.
 
 mc::FFGraph::FFGraph ()
 Default Constructor.
 
virtual mc::FFGraph::~FFGraph ()
 Destructor.
 
unsigned long mc::FFGraph::nvar () const
 Number of original variables in DAG.
 
unsigned long mc::FFGraph::naux () const
 Number of auxiliary variables in DAG.
 
const t_Vars & mc::FFGraph::Vars () const
 Reference to set of (all) variables in factorable function.
 
void mc::FFGraph::clear ()
 Clear DAG (all variables and operations)
 
std::list< const FFOp * > mc::FFGraph::subgraph (const unsigned int nDep, const FFVar *pDep) const
 Extract list of operations corresponding to nDep dependents in array pDep
 
std::list< const FFOp * > mc::FFGraph::subgraph (const std::vector< const FFVar * > &vDep) const
 Extract list of operations corresponding to dependents vDep
 
CPPL::dssmatrix mc::FFGraph::depmap (const unsigned nDep, const FFVar *const pDep, const unsigned nIndep, const FFVar *const pIndep)
 Create dependency map corresponding to nDep dependents in array pDep and nIndep independents in array pIndep
 
CPPL::dssmatrix mc::FFGraph::depmap (std::list< const FFOp * > &opDep, const unsigned nDep, const FFVar *const pDep, const unsigned nIndep, const FFVar *const pIndep)
 Create dependency map corresponding to nDep dependents in array pDep and nIndep independents in array pIndep – This function uses the subgraph for the dependents given in opDep
 
CPPL::dssmatrix mc::FFGraph::depmap (const std::vector< const FFVar * > &vDep, const std::vector< const FFVar * > &vIndep)
 Create dependency map corresponding to the dependent variables pDep and independent variables pIndep
 
CPPL::dssmatrix mc::FFGraph::depmap (std::list< const FFOp * > &opDep, const std::vector< const FFVar * > &vDep, const std::vector< const FFVar * > &vIndep)
 Create dependency map corresponding to the dependent variables pDep and independent variables pIndep – This function uses the subgraph for the dependents given in opDep
 
void mc::FFGraph::dot_script (const unsigned int nDep, const FFVar *pDep, std::ostream &os=std::cout) const
 Generate script for DAG visualization of factors *F using DOT.
 
void mc::FFGraph::dot_script (const std::vector< const FFVar * > &vDep, std::ostream &os=std::cout) const
 Generate script for DAG visualization of factors *F using DOT.
 
std::vector< const FFVar * > mc::FFGraph::FAD (const std::vector< const FFVar * > &vDep, const std::vector< const FFVar * > &vIndep)
 Expand DAG with derivatives of dependents vDep with respect to independents vIndep using fadbad::F – Returns a vector with the entries of the Jacobian matrix ordered row-wise.
 
const FFVar * mc::FFGraph::FAD (const unsigned nDep, const FFVar *const pDep, const unsigned nIndep, const FFVar *const pIndep, const bool transp=false)
 Expand DAG with derivatives of nDep dependents in array pDep with respect to nIndep independents in array pIndep using fadbad::F – Returns an array with entries of the Jacobian matrix ordered row-wise.
 
std::vector< const FFVar * > mc::FFGraph::BAD (const std::vector< const FFVar * > &vDep, const std::vector< const FFVar * > &vIndep)
 Expand DAG with derivatives of dependents vDep with respect to independents vIndep using fadbad::B – Returns a vector with the entries of the Jacobian matrix ordered row-wise.
 
const FFVar * mc::FFGraph::BAD (const unsigned nDep, const FFVar *const pDep, const unsigned nIndep, const FFVar *const pIndep, const bool transp=false)
 Expand DAG with derivatives of nDep dependents in array pDep with respect to nIndep independents in array pIndep using fadbad::B – Returns an array with entries of the Jacobian matrix ordered row-wise.
 
std::vector< const FFVar * > mc::FFGraph::TAD (const unsigned int ordermax, const std::vector< const FFVar * > &vDep, const std::vector< const FFVar * > &vVar, const FFVar *const pIndep=0)
 Expand DAG with Taylor coefficients of dependents vDep with respect to independents vIndep using fadbad::T – Same number of dependents and independent is required, e.g. for expansion of ODE solutions – Return a vector with the 0th, 1st, ..., ordermax'th order Taylor coefficients ordered sequentially.
 
const FFVar * mc::FFGraph::TAD (const unsigned int ordermax, const unsigned nDep, const FFVar *const pDep, const unsigned nVar, const FFVar *const pVar, const FFVar *const pIndep=0)
 Expand DAG with Taylor coefficients of nDep dependents in array pDep with respect to nIndep independents in array pIndep using fadbad::T – Same number of dependents and independent is required, e.g. for expansion of ODE solutions – Returns an array with the 0th, 1st, ..., ordermax'th order Taylor coefficients ordered sequentially.
 
std::vector< const FFVar * > mc::FFGraph::compose (const std::vector< const FFVar * > &vDepOut, const std::vector< std::pair< const FFVar *, const FFVar * > > &vDepIn)
 Compose the dependents in vDepOut with those in vDepIn – This function creates the subgraph for the outer dependent variables internally.
 
const FFVar * mc::FFGraph::compose (const unsigned nDepOut, const FFVar *pDepOut, const unsigned nDepIn, const FFVar *pVarOut, const FFVar *pDepIn)
 Compose the nDepOut dependents in array pDepOut with the nDepIn dependents in array pDepIn for the variables pVarOut – This function creates the subgraph for the outer dependent variables internally.
 
template<typename U >
std::vector< U > mc::FFGraph::eval (const std::vector< const FFVar * > &vDep, const std::vector< std::pair< const FFVar *, U > > &vVar)
 Evaluate the dependents in vDep in U arithmetic for the variable values specified in vVar – This function creates the subgraph for the dependent variables internally.
 
template<typename U >
std::vector< U > mc::FFGraph::eval (std::list< const FFOp * > &opDep, const std::vector< const FFVar * > &vDep, const std::vector< std::pair< const FFVar *, U > > &vVar)
 Evaluate the dependents in vDep in U arithmetic for the variable values specified in vVar – This function uses the subgraph for the dependent variables given in opDep
 
template<typename U >
std::vector< U > mc::FFGraph::eval (std::list< const FFOp * > &opDep, U *opRes, const std::vector< const FFVar * > &vDep, const std::vector< std::pair< const FFVar *, U > > &vVar)
 Evaluate the dependents in vDep in U arithmetic for the variable values specified in vVar – This function uses the subgraph for the dependent variables given in opDep as well as the preallocated array opRes of size opDep.size() to store intermediate results during the evaluation.
 
template<typename U >
void mc::FFGraph::eval (const unsigned nDep, const FFVar *pDep, U *vDep, const unsigned nVar, const FFVar *pVar, U *vVar, const bool add=false)
 Evaluate the nDep dependents in array pDep in U arithmetic for the nVar variable in array pVar whose values are specified in vVar and write the result in vDep (or add the result to vDep if add==true) – This function creates the subgraph for the dependent variables internally.
 
template<typename U >
void mc::FFGraph::eval (std::list< const FFOp * > &opDep, const unsigned nDep, const FFVar *pDep, U *vDep, const unsigned nVar, const FFVar *pVar, U *vVar, const bool add=false)
 Evaluate the nDep dependents in array pDep in U arithmetic for the nVar variable in array pVar whose values are specified in vVar and write the result in vDep (or add the result to vDep if add==true) – This function uses the subgraph for the dependent variables given in opDep
 
template<typename U >
void mc::FFGraph::eval (std::list< const FFOp * > &opDep, U *opRes, const unsigned nDep, const FFVar *pDep, U *vDep, const unsigned nVar, const FFVar *pVar, U *vVar, const bool add=false)
 Evaluate the nDep dependents in array pDep in U arithmetic for the nVar variable in array pVar whose values are specified in vVar and write the result in vDep (or add the result to vDep if add==true) – This function uses the subgraph for the dependent variables given in opDep as well as the preallocated array opRes of size opDep.size() to store intermediate results during the evaluation.
 
static void mc::FFGraph::output (const std::list< const FFOp * > &Ops, std::ostream &os=std::cout)
 Output list of nodes in Ops to os
 
static double mc::FFGraph::cpuclock ()
 Return current clock time.
 

Detailed Description

Enumeration Type Documentation

Enumerator
VAR 

Original variable.

AUX 

Auxiliary variable.

CINT 

Integer constant.

CREAL 

Real constant.