Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
ComputeContext Class Referenceabstract

#include <qle/math/computeenvironment.hpp>

+ Inheritance diagram for ComputeContext:
+ Collaboration diagram for ComputeContext:

Classes

struct  DebugInfo
 
struct  Settings
 

Public Member Functions

virtual ~ComputeContext ()
 
virtual void init ()=0
 
virtual std::pair< std::size_t, boolinitiateCalculation (const std::size_t n, const std::size_t id=0, const std::size_t version=0, const Settings settings={})=0
 
virtual void disposeCalculation (const std::size_t id)=0
 
virtual std::size_t createInputVariable (double v)=0
 
virtual std::size_t createInputVariable (double *v)=0
 
virtual std::vector< std::vector< std::size_t > > createInputVariates (const std::size_t dim, const std::size_t steps)=0
 
virtual std::size_t applyOperation (const std::size_t randomVariableOpCode, const std::vector< std::size_t > &args)=0
 
virtual void freeVariable (const std::size_t id)=0
 
virtual void declareOutputVariable (const std::size_t id)=0
 
virtual void finalizeCalculation (std::vector< double * > &output)=0
 
virtual std::vector< std::pair< std::string, std::string > > deviceInfo () const
 
virtual bool supportsDoublePrecision () const
 
virtual const DebugInfodebugInfo () const =0
 
void finalizeCalculation (std::vector< std::vector< double > > &output)
 

Detailed Description

Definition at line 64 of file computeenvironment.hpp.

Constructor & Destructor Documentation

◆ ~ComputeContext()

virtual ~ComputeContext ( )
virtual

Definition at line 84 of file computeenvironment.hpp.

84{}

Member Function Documentation

◆ init()

virtual void init ( )
pure virtual
+ Here is the caller graph for this function:

◆ initiateCalculation()

virtual std::pair< std::size_t, bool > initiateCalculation ( const std::size_t  n,
const std::size_t  id = 0,
const std::size_t  version = 0,
const Settings  settings = {} 
)
pure virtual
+ Here is the caller graph for this function:

◆ disposeCalculation()

virtual void disposeCalculation ( const std::size_t  id)
pure virtual

◆ createInputVariable() [1/2]

virtual std::size_t createInputVariable ( double  v)
pure virtual
+ Here is the caller graph for this function:

◆ createInputVariable() [2/2]

virtual std::size_t createInputVariable ( double *  v)
pure virtual

◆ createInputVariates()

virtual std::vector< std::vector< std::size_t > > createInputVariates ( const std::size_t  dim,
const std::size_t  steps 
)
pure virtual
+ Here is the caller graph for this function:

◆ applyOperation()

virtual std::size_t applyOperation ( const std::size_t  randomVariableOpCode,
const std::vector< std::size_t > &  args 
)
pure virtual
+ Here is the caller graph for this function:

◆ freeVariable()

virtual void freeVariable ( const std::size_t  id)
pure virtual
+ Here is the caller graph for this function:

◆ declareOutputVariable()

virtual void declareOutputVariable ( const std::size_t  id)
pure virtual
+ Here is the caller graph for this function:

◆ finalizeCalculation() [1/2]

virtual void finalizeCalculation ( std::vector< double * > &  output)
pure virtual
+ Here is the caller graph for this function:

◆ deviceInfo()

virtual std::vector< std::pair< std::string, std::string > > deviceInfo ( ) const
virtual

Definition at line 106 of file computeenvironment.hpp.

106{ return {}; }

◆ supportsDoublePrecision()

virtual bool supportsDoublePrecision ( ) const
virtual

Definition at line 107 of file computeenvironment.hpp.

107{ return false; }
+ Here is the caller graph for this function:

◆ debugInfo()

virtual const DebugInfo & debugInfo ( ) const
pure virtual

◆ finalizeCalculation() [2/2]

void finalizeCalculation ( std::vector< std::vector< double > > &  output)

Definition at line 73 of file computeenvironment.cpp.

73 {
74 std::vector<double*> outputPtr(output.size());
75 std::transform(output.begin(), output.end(), outputPtr.begin(),
76 [](std::vector<double>& v) -> double* { return &v[0]; });
77 finalizeCalculation(outputPtr);
78}
virtual void finalizeCalculation(std::vector< double * > &output)=0
+ Here is the call graph for this function: