#include <qle/ad/computationgraph.hpp>
Public Types | |
enum class | VarDoesntExist { Nan , Create , Throw } |
Public Member Functions | |
void | clear () |
std::size_t | size () const |
std::size_t | insert (const std::string &label=std::string()) |
std::size_t | insert (const std::vector< std::size_t > &predecessors, const std::size_t opId, const std::string &label=std::string()) |
const std::vector< std::size_t > & | predecessors (const std::size_t node) const |
std::size_t | opId (const std::size_t node) const |
std::size_t | maxNodeRequiringArg (const std::size_t node) const |
std::size_t | constant (const double c) |
const std::map< double, std::size_t > & | constants () const |
bool | isConstant (const std::size_t node) const |
double | constantValue (const std::size_t node) const |
std::size_t | variable (const std::string &name, const VarDoesntExist v=VarDoesntExist::Throw) |
const std::map< std::string, std::size_t > & | variables () const |
void | setVariable (const std::string &name, const std::size_t node) |
void | enableLabels (const bool b=true) |
const std::map< std::size_t, std::set< std::string > > & | labels () const |
void | startRedBlock () |
void | endRedBlock () |
std::size_t | redBlockId (const std::size_t node) const |
const std::vector< std::pair< std::size_t, std::size_t > > & | redBlockRanges () const |
const std::set< std::size_t > & | redBlockDependencies () const |
Static Public Attributes | |
static std::size_t | nan = std::numeric_limits<std::size_t>::max() |
Private Attributes | |
std::vector< std::vector< std::size_t > > | predecessors_ |
std::vector< std::size_t > | opId_ |
std::vector< bool > | isConstant_ |
std::vector< double > | constantValue_ |
std::vector< std::size_t > | maxNodeRequiringArg_ |
std::vector< std::size_t > | redBlockId_ |
std::map< double, std::size_t > | constants_ |
std::map< std::string, std::size_t > | variables_ |
std::map< std::string, std::size_t > | variableVersion_ |
bool | enableLabels_ = false |
std::map< std::size_t, std::set< std::string > > | labels_ |
std::size_t | currentRedBlockId_ = 0 |
std::size_t | nextRedBlockId_ = 0 |
std::vector< std::pair< std::size_t, std::size_t > > | redBlockRange_ |
std::set< std::size_t > | redBlockDependencies_ |
Definition at line 35 of file computationgraph.hpp.
|
strong |
Enumerator | |
---|---|
Nan | |
Create | |
Throw |
Definition at line 37 of file computationgraph.hpp.
void clear | ( | ) |
Definition at line 32 of file computationgraph.cpp.
std::size_t size | ( | ) | const |
std::size_t insert | ( | const std::string & | label = std::string() | ) |
Definition at line 47 of file computationgraph.cpp.
std::size_t insert | ( | const std::vector< std::size_t > & | predecessors, |
const std::size_t | opId, | ||
const std::string & | label = std::string() |
||
) |
Definition at line 60 of file computationgraph.cpp.
const std::vector< std::size_t > & predecessors | ( | const std::size_t | node | ) | const |
std::size_t opId | ( | const std::size_t | node | ) | const |
std::size_t maxNodeRequiringArg | ( | const std::size_t | node | ) | const |
Definition at line 90 of file computationgraph.cpp.
std::size_t constant | ( | const double | c | ) |
Definition at line 92 of file computationgraph.cpp.
const std::map< double, std::size_t > & constants | ( | ) | const |
Definition at line 111 of file computationgraph.cpp.
bool isConstant | ( | const std::size_t | node | ) | const |
double constantValue | ( | const std::size_t | node | ) | const |
std::size_t variable | ( | const std::string & | name, |
const VarDoesntExist | v = VarDoesntExist::Throw |
||
) |
Definition at line 113 of file computationgraph.cpp.
const std::map< std::string, std::size_t > & variables | ( | ) | const |
Definition at line 140 of file computationgraph.cpp.
void setVariable | ( | const std::string & | name, |
const std::size_t | node | ||
) |
Definition at line 142 of file computationgraph.cpp.
void enableLabels | ( | const bool | b = true | ) |
Definition at line 158 of file computationgraph.cpp.
const std::map< std::size_t, std::set< std::string > > & labels | ( | ) | const |
Definition at line 160 of file computationgraph.cpp.
void startRedBlock | ( | ) |
Definition at line 162 of file computationgraph.cpp.
void endRedBlock | ( | ) |
Definition at line 169 of file computationgraph.cpp.
std::size_t redBlockId | ( | const std::size_t | node | ) | const |
const std::vector< std::pair< std::size_t, std::size_t > > & redBlockRanges | ( | ) | const |
Definition at line 175 of file computationgraph.cpp.
const std::set< std::size_t > & redBlockDependencies | ( | ) | const |
Definition at line 179 of file computationgraph.cpp.
|
static |
Definition at line 38 of file computationgraph.hpp.
|
private |
Definition at line 70 of file computationgraph.hpp.
|
private |
Definition at line 71 of file computationgraph.hpp.
|
private |
Definition at line 72 of file computationgraph.hpp.
|
private |
Definition at line 73 of file computationgraph.hpp.
|
private |
Definition at line 74 of file computationgraph.hpp.
|
private |
Definition at line 75 of file computationgraph.hpp.
|
private |
Definition at line 77 of file computationgraph.hpp.
|
private |
Definition at line 79 of file computationgraph.hpp.
|
private |
Definition at line 80 of file computationgraph.hpp.
|
private |
Definition at line 82 of file computationgraph.hpp.
|
private |
Definition at line 83 of file computationgraph.hpp.
|
private |
Definition at line 85 of file computationgraph.hpp.
|
private |
Definition at line 86 of file computationgraph.hpp.
|
private |
Definition at line 87 of file computationgraph.hpp.
|
private |
Definition at line 88 of file computationgraph.hpp.