Minsky
minsky::EvalOpBase Struct Referenceabstract

#include <evalOp.h>

Inheritance diagram for minsky::EvalOpBase:
Inheritance graph
Collaboration diagram for minsky::EvalOpBase:
Collaboration graph

Classes

struct  Support
 

Public Types

typedef OperationType::Type Type
 
- Public Types inherited from minsky::OperationType
enum  Type {
  constant, time, integrate, differentiate,
  data, ravel, euler, pi,
  zero, one, inf, percent,
  add, subtract, multiply, divide,
  min, max, and_, or_,
  log, pow, polygamma, lt,
  le, eq, userFunction, copy,
  sqrt, exp, ln, sin,
  cos, tan, asin, acos,
  atan, sinh, cosh, tanh,
  abs, floor, frac, not_,
  Gamma, fact, sum, product,
  infimum, supremum, any, all,
  infIndex, supIndex, runningSum, runningProduct,
  difference, differencePlus, innerProduct, outerProduct,
  index, gather, meld, merge,
  slice, size, shape, mean,
  median, stdDev, moment, histogram,
  covariance, correlation, linearRegression, numOps
}
 
enum  Group {
  general, constop, binop, function,
  reduction, scan, tensor, statistics
}
 

Public Attributes

int out =-1
 indexes into the flow/stock variables vector More...
 

Static Public Attributes

static double t
 
static std::string timeUnit
 
std::vector< unsigned > in1
 
std::vector< std::vector< Support > > in2
 
bool flow1 =true
 indicate whether in1/in2 are flow variables (out is always a flow variable) More...
 
bool flow2 =true
 
bool xflow =true
 
std::shared_ptr< OperationBasestate
 state data (for those ops that need it) More...
 
void throw_error (const std::string &msg) const
 
virtual ~EvalOpBase ()
 
virtual void deriv (double df[], std::size_t n, const double ds[], const double sv[], const double fv[])=0
 
virtual void eval (double fv[]=ValueVector::flowVars.data(), std::size_t n=ValueVector::flowVars.size(), const double sv[]=ValueVector::stockVars.data())=0
 evaluate expression on sv and current value of fv, storing result in output variable (of fv) More...
 
virtual void setTensorParams (const VariableValue &, const OperationBase &)
 set additional tensor operation related parameters More...
 

Additional Inherited Members

- Static Public Member Functions inherited from minsky::OperationType
static std::string typeName (int type)
 return the symbolic name of type More...
 
static Group classify (Type t)
 

Detailed Description

Definition at line 46 of file evalOp.h.

Member Typedef Documentation

◆ Type

Definition at line 50 of file evalOp.h.

Constructor & Destructor Documentation

◆ ~EvalOpBase()

virtual minsky::EvalOpBase::~EvalOpBase ( )
inlinevirtual

in1 - indices describing input 1's vector in2 - indices describing input 2's vector (if double op) in2b/interp - interpolation support: out[i]=op(inp[in1[i]], interp*inp[in2[i]]+(1-interp)*inp[in2b[i]])

Definition at line 82 of file evalOp.h.

82 {}

Member Function Documentation

◆ deriv()

virtual void minsky::EvalOpBase::deriv ( double  df[],
std::size_t  n,
const double  ds[],
const double  sv[],
const double  fv[] 
)
pure virtual

total derivate with respect to a variable, which is a function of the stock variables.

Parameters
sv- stock variables
fv- flow variables (function of stock variables, computed by eval)
ds- derivative of stock variables
df- derivative of flow variables (updated by this function)
n- size of df array

To compute the partial derivatives with respect to stock variable i, seed ds with 1 in the ith position, 0 every else, and initialise df to zero.

Implemented in minsky::ScalarEvalOp.

◆ eval()

virtual void minsky::EvalOpBase::eval ( double  fv[] = ValueVector::flowVars.data(),
std::size_t  n = ValueVector::flowVars.size(),
const double  sv[] = ValueVector::stockVars.data() 
)
pure virtual

evaluate expression on sv and current value of fv, storing result in output variable (of fv)

Parameters
n- size of fv array

Implemented in minsky::ScalarEvalOp.

◆ setTensorParams()

virtual void minsky::EvalOpBase::setTensorParams ( const VariableValue ,
const OperationBase  
)
inlinevirtual

set additional tensor operation related parameters

Definition at line 107 of file evalOp.h.

107 {}

◆ throw_error()

void minsky::EvalOpBase::throw_error ( const std::string &  msg) const
inline

in1 - indices describing input 1's vector in2 - indices describing input 2's vector (if double op) in2b/interp - interpolation support: out[i]=op(inp[in1[i]], interp*inp[in2[i]]+(1-interp)*inp[in2b[i]])

Definition at line 78 of file evalOp.h.

78  {
79  if (state) state->throw_error(msg);
80  else throw std::runtime_error(msg);
81  }
std::shared_ptr< OperationBase > state
state data (for those ops that need it)
Definition: evalOp.h:77

Member Data Documentation

◆ flow1

bool minsky::EvalOpBase::flow1 =true

indicate whether in1/in2 are flow variables (out is always a flow variable)

Definition at line 74 of file evalOp.h.

◆ flow2

bool minsky::EvalOpBase::flow2 =true

in1 - indices describing input 1's vector in2 - indices describing input 2's vector (if double op) in2b/interp - interpolation support: out[i]=op(inp[in1[i]], interp*inp[in2[i]]+(1-interp)*inp[in2b[i]])

Definition at line 74 of file evalOp.h.

◆ in1

std::vector<unsigned> minsky::EvalOpBase::in1

in1 - indices describing input 1's vector in2 - indices describing input 2's vector (if double op) in2b/interp - interpolation support: out[i]=op(inp[in1[i]], interp*inp[in2[i]]+(1-interp)*inp[in2b[i]])

Definition at line 64 of file evalOp.h.

◆ in2

std::vector<std::vector<Support> > minsky::EvalOpBase::in2

in1 - indices describing input 1's vector in2 - indices describing input 2's vector (if double op) in2b/interp - interpolation support: out[i]=op(inp[in1[i]], interp*inp[in2[i]]+(1-interp)*inp[in2b[i]])

Definition at line 72 of file evalOp.h.

◆ out

int minsky::EvalOpBase::out =-1

indexes into the flow/stock variables vector

Definition at line 57 of file evalOp.h.

◆ state

std::shared_ptr<OperationBase> minsky::EvalOpBase::state

state data (for those ops that need it)

Definition at line 77 of file evalOp.h.

◆ t

double minsky::EvalOpBase::t
static

Definition at line 53 of file evalOp.h.

◆ timeUnit

string minsky::EvalOpBase::timeUnit
static

Definition at line 54 of file evalOp.h.

◆ xflow

bool minsky::EvalOpBase::xflow =true

in1 - indices describing input 1's vector in2 - indices describing input 2's vector (if double op) in2b/interp - interpolation support: out[i]=op(inp[in1[i]], interp*inp[in2[i]]+(1-interp)*inp[in2b[i]])

Definition at line 74 of file evalOp.h.


The documentation for this struct was generated from the following files: