CppADCodeGen  2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
CppAD::cg::LlvmModel< Base > Class Template Reference
Inheritance diagram for CppAD::cg::LlvmModel< Base >:
Inheritance graph
Collaboration diagram for CppAD::cg::LlvmModel< Base >:
Collaboration graph

Public Member Functions

 LlvmModel (const LlvmModel &)=delete
 
LlvmModeloperator= (const LlvmModel &)=delete
 
const std::string & getName () const override
 
const std::vector< std::string > & getAtomicFunctionNames () override
 
bool addAtomicFunction (atomic_base< Base > &atomic) override
 
bool addExternalModel (GenericModel< Base > &atomic) override
 
bool isJacobianSparsityAvailable () override
 
std::vector< bool > JacobianSparsityBool () override
 
std::vector< std::set< size_t > > JacobianSparsitySet () override
 
void JacobianSparsity (std::vector< size_t > &equations, std::vector< size_t > &variables) override
 
bool isHessianSparsityAvailable () override
 
std::vector< bool > HessianSparsityBool () override
 
std::vector< bool > HessianSparsityBool (size_t i) override
 
std::vector< std::set< size_t > > HessianSparsitySet () override
 
std::vector< std::set< size_t > > HessianSparsitySet (size_t i) override
 
void HessianSparsity (std::vector< size_t > &rows, std::vector< size_t > &cols) override
 
void HessianSparsity (size_t i, std::vector< size_t > &rows, std::vector< size_t > &cols) override
 
bool isEquationHessianSparsityAvailable () override
 
size_t Domain () const override
 number of independent variables
 
size_t Range () const override
 number of dependent variables
 
bool isForwardZeroAvailable () override
 
void ForwardZero (ArrayView< const Base > x, ArrayView< Base > dep) override
 calculate the dependent values (zero order)
 
void ForwardZero (const std::vector< const Base * > &x, ArrayView< Base > dep) override
 
void ForwardZero (const CppAD::vector< bool > &vx, CppAD::vector< bool > &vy, ArrayView< const Base > tx, ArrayView< Base > ty) override
 
bool isJacobianAvailable () override
 
void Jacobian (ArrayView< const Base > x, ArrayView< Base > jac) override
 calculate entire Jacobian
 
bool isHessianAvailable () override
 
void Hessian (ArrayView< const Base > x, ArrayView< const Base > w, ArrayView< Base > hess) override
 calculate Hessian for one component of f
 
bool isForwardOneAvailable () override
 
void ForwardOne (ArrayView< const Base > tx, ArrayView< Base > ty) override
 
void ForwardOne (ArrayView< const Base > x, size_t tx1Nnz, const size_t idx[], const Base tx1[], ArrayView< Base > ty1) override
 
bool isSparseForwardOneAvailable () override
 
bool isReverseOneAvailable () override
 
void ReverseOne (ArrayView< const Base > tx, ArrayView< const Base > ty, ArrayView< Base > px, ArrayView< const Base > py) override
 
void ReverseOne (ArrayView< const Base > x, ArrayView< Base > px, size_t pyNnz, const size_t idx[], const Base py[]) override
 
bool isSparseReverseOneAvailable () override
 
bool isReverseTwoAvailable () override
 
void ReverseTwo (ArrayView< const Base > tx, ArrayView< const Base > ty, ArrayView< Base > px, ArrayView< const Base > py) override
 
void ReverseTwo (ArrayView< const Base > x, size_t tx1Nnz, const size_t idx[], const Base tx1[], ArrayView< Base > px2, ArrayView< const Base > py2) override
 
bool isSparseReverseTwoAvailable () override
 
bool isSparseJacobianAvailable () override
 
void SparseJacobian (ArrayView< const Base > x, ArrayView< Base > jac) override
 calculate sparse Jacobians
 
void SparseJacobian (const std::vector< Base > &x, std::vector< Base > &jac, std::vector< size_t > &row, std::vector< size_t > &col) override
 
void SparseJacobian (ArrayView< const Base > x, ArrayView< Base > jac, size_t const **row, size_t const **col) override
 
void SparseJacobian (const std::vector< const Base * > &x, ArrayView< Base > jac, size_t const **row, size_t const **col) override
 
bool isSparseHessianAvailable () override
 
void SparseHessian (ArrayView< const Base > x, ArrayView< const Base > w, ArrayView< Base > hess) override
 calculate sparse Hessians
 
void SparseHessian (const std::vector< Base > &x, const std::vector< Base > &w, std::vector< Base > &hess, std::vector< size_t > &row, std::vector< size_t > &col) override
 
void SparseHessian (ArrayView< const Base > x, ArrayView< const Base > w, ArrayView< Base > hess, size_t const **row, size_t const **col) override
 
void SparseHessian (const std::vector< const Base * > &x, ArrayView< const Base > w, ArrayView< Base > hess, size_t const **row, size_t const **col) override
 

Protected Member Functions

 LlvmModel (LlvmModelLibrary< Base > *dynLib, const std::string &name)
 
void * loadFunction (const std::string &functionName, bool required=true) override
 
void modelLibraryClosed () override
 
virtual void init ()
 
virtual void validate ()
 
virtual void loadFunctions ()
 
template<class VectorSet >
void loadSparsity (bool set_type, VectorSet &s, unsigned long nrows, unsigned long ncols, unsigned long const *rows, unsigned long const *cols, unsigned long nnz)
 
template<class VectorSet >
void loadSparsity (const std::set< size_t > &set_type, VectorSet &s, unsigned long nrows, unsigned long ncols, unsigned long const *rows, unsigned long const *cols, unsigned long nnz)
 
void createDenseFromSparse (const CppAD::vector< Base > &compressed, unsigned long nrows, unsigned long ncols, unsigned long const *rows, unsigned long const *cols, unsigned long nnz, ArrayView< Base > mat) const
 

Protected Attributes

LlvmModelLibrary< Base > * _dynLib
 the dynamic library
 
bool _isLibraryReady
 
const std::string _name
 the model name
 
size_t _m
 
size_t _n
 
std::vector< const Base * > _in
 
std::vector< const Base * > _inHess
 
std::vector< Base * > _out
 
LangCAtomicFun _atomicFuncArg
 
std::vector< std::string > _atomicNames
 
std::vector< ExternalFunctionWrapper< Base > * > _atomic
 
size_t _missingAtomicFunctions
 
CppAD::vector< Base > _tx
 
CppAD::vector< Base > _ty
 
CppAD::vector< Base > _px
 
CppAD::vector< Base > _py
 
void(* _zero )(Base const *const *, Base *const *, LangCAtomicFun)
 
int(* _forwardOne )(Base const tx[], Base ty[], LangCAtomicFun)
 
int(* _reverseOne )(Base const tx[], Base const ty[], Base px[], Base const py[], LangCAtomicFun)
 
int(* _reverseTwo )(Base const tx[], Base const ty[], Base px[], Base const py[], LangCAtomicFun)
 
void(* _jacobian )(Base const *const *, Base *const *, LangCAtomicFun)
 
void(* _hessian )(Base const *const *, Base *const *, LangCAtomicFun)
 
int(* _sparseForwardOne )(unsigned long, Base const *const *, Base *const *, LangCAtomicFun)
 
int(* _sparseReverseOne )(unsigned long, Base const *const *, Base *const *, LangCAtomicFun)
 
int(* _sparseReverseTwo )(unsigned long, Base const *const *, Base *const *, LangCAtomicFun)
 
void(* _sparseJacobian )(Base const *const *, Base *const *, LangCAtomicFun)
 
void(* _sparseHessian )(Base const *const *, Base *const *, LangCAtomicFun)
 
void(* _forwardOneSparsity )(unsigned long, unsigned long const **, unsigned long *)
 
void(* _reverseOneSparsity )(unsigned long, unsigned long const **, unsigned long *)
 
void(* _reverseTwoSparsity )(unsigned long, unsigned long const **, unsigned long *)
 
void(* _jacobianSparsity )(unsigned long const **row, unsigned long const **col, unsigned long *nnz)
 
void(* _hessianSparsity )(unsigned long const **row, unsigned long const **col, unsigned long *nnz)
 
void(* _hessianSparsity2 )(unsigned long i, unsigned long const **row, unsigned long const **col, unsigned long *nnz)
 
void(* _atomicFunctions )(const char ***names, unsigned long *n)
 

Static Protected Attributes

static constexpr const char * ERROR_LIBRARY_NOT_READY
 

Friends

class LlvmModelLibrary< Base >
 

Detailed Description

template<class Base>
class CppAD::cg::LlvmModel< Base >

Useful class to call the JIT'ed models with LLVM.

Author
Joao Leal

Definition at line 28 of file llvm_model.hpp.

Constructor & Destructor Documentation

◆ LlvmModel()

template<class Base >
CppAD::cg::LlvmModel< Base >::LlvmModel ( LlvmModelLibrary< Base > *  dynLib,
const std::string &  name 
)
inlineprotected

Creates a new model

Parameters
nameThe model name

Definition at line 51 of file llvm_model.hpp.

Member Function Documentation

◆ loadFunctions()

template<class Base >
virtual void CppAD::cg::FunctorGenericModel< Base >::loadFunctions ( )
inlineprotectedvirtualinherited

Prepare the atomic functions argument

Definition at line 927 of file functor_generic_model.hpp.

◆ validate()

template<class Base >
virtual void CppAD::cg::FunctorGenericModel< Base >::validate ( )
inlineprotectedvirtualinherited

Check the data type

Definition at line 895 of file functor_generic_model.hpp.

Member Data Documentation

◆ ERROR_LIBRARY_NOT_READY

template<class Base >
constexpr const char* CppAD::cg::FunctorGenericModel< Base >::ERROR_LIBRARY_NOT_READY
staticconstexprprotectedinherited
Initial value:
= "The model library is not ready. The model library that"
" provided this model might have been closed or deleted."

Definition at line 36 of file functor_generic_model.hpp.


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