Minsky
minsky::MinskyTensorOp< op > Struct Template Reference
Inheritance diagram for minsky::MinskyTensorOp< op >:
Inheritance graph
Collaboration diagram for minsky::MinskyTensorOp< op >:
Collaboration graph

Public Member Functions

 MinskyTensorOp ()
 
void setState (const OperationPtr &state) override
 
void setArguments (const std::vector< TensorPtr > &a, const Args &) override
 
double dFlow (size_t ti, size_t fi) const override
 
double dStock (size_t ti, size_t si) const override
 
- Public Member Functions inherited from civita::ElementWiseOp
template<class F >
 ElementWiseOp (F f, const std::shared_ptr< ITensor > &arg={})
 
void setArgument (const TensorPtr &a, const ITensor::Args &) override
 
const Hypercube & hypercube () const override
 information describing the axes, types and labels of this tensor More...
 
const Index & index () const override
 the index vector - assumed to be ordered and unique More...
 
double operator[] (std::size_t i) const override
 return or compute data at a location More...
 
std::size_t size () const override
 return number of elements in tensor - maybe less than hypercube.numElements if sparse More...
 
Timestamp timestamp () const override
 timestamp indicating how old the dependendent data might be. Used in CachedTensorOp to determine when to invalidate the cache More...
 
- Public Member Functions inherited from civita::ITensor
 CLASSDESC_ACCESS (ITensor)
 
 ITensor ()
 
 ITensor (const Hypercube &hc)
 
 ITensor (Hypercube &&hc)
 
 ITensor (const std::vector< unsigned > &dims)
 
 ITensor (const ITensor &)=default
 
 ITensor (ITensor &&)=default
 
ITensoroperator= (const ITensor &)=default
 
ITensoroperator= (ITensor &&)=default
 
virtual ~ITensor ()
 
virtual const Hypercube & hypercube (const Hypercube &hc)
 
virtual const Hypercube & hypercube (Hypercube &&hc)
 
std::size_t rank () const
 
std::vector< unsigned > shape () const
 
void imposeDimensions (const Dimensions &dimensions)
 impose dimensions according to dimension map dimensions More...
 
double atHCIndex (std::size_t hcIdx) const
 returns the data value at hypercube index hcIdx, or NaN if More...
 
template<class T >
std::size_t hcIndex (const std::initializer_list< T > &indices) const
 
template<class T >
double operator() (const std::initializer_list< T > &indices) const
 
virtual void setArguments (const TensorPtr &, const TensorPtr &, const ITensor::Args &args={})
 
virtual void setArguments (const std::vector< TensorPtr > &a1, const std::vector< TensorPtr > &a2, const ITensor::Args &args={"", 0})
 
- Public Member Functions inherited from minsky::DerivativeMixin
virtual double dFlow (std::size_t ti, std::size_t fi) const =0
 partial derivative of tensor component ti wrt flow variable fi More...
 
virtual double dStock (std::size_t ti, std::size_t si) const =0
 partial derivative of tensor component ti wrt stock variable si More...
 
- Public Member Functions inherited from minsky::SetState
virtual ~SetState ()
 

Public Attributes

EvalOp< opeo
 
- Public Attributes inherited from civita::ElementWiseOp
std::function< double(double)> f
 
std::shared_ptr< ITensorarg
 

Additional Inherited Members

- Public Types inherited from civita::ITensor
using Timestamp = std::chrono::time_point< std::chrono::high_resolution_clock >
 
- Protected Member Functions inherited from civita::ITensor
void notImpl () const
 
- Protected Attributes inherited from civita::ITensor
Hypercube m_hypercube
 
Index m_index
 

Detailed Description

template<OperationType::Type op>
struct minsky::MinskyTensorOp< op >

Definition at line 76 of file minskyTensorOps.cc.

Constructor & Destructor Documentation

◆ MinskyTensorOp()

template<OperationType::Type op>
minsky::MinskyTensorOp< op >::MinskyTensorOp ( )
inline

Definition at line 79 of file minskyTensorOps.cc.

References minsky::EvalOp< T >::evaluate().

79 : ElementWiseOp([this](double x){return eo.evaluate(x);}) {}
ElementWiseOp(F f, const std::shared_ptr< ITensor > &arg={})
Definition: tensorOp.h:38
double evaluate(double in1=0, double in2=0) const override
Here is the call graph for this function:

Member Function Documentation

◆ dFlow()

template<OperationType::Type op>
double minsky::MinskyTensorOp< op >::dFlow ( size_t  ti,
size_t  fi 
) const
inlineoverride

Definition at line 83 of file minskyTensorOps.cc.

References minsky::EvalOp< T >::d1().

83  {
84  auto deriv=dynamic_cast<DerivativeMixin*>(arg.get());
85  if (!deriv) throw DerivativeNotDefined();
86  if (const double df=deriv->dFlow(ti,fi))
87  return eo.d1((*arg)[ti])*df;
88  return 0;
89  }
double d1(double x1=0, double x2=0) const override
std::shared_ptr< ITensor > arg
Definition: tensorOp.h:36
Here is the call graph for this function:

◆ dStock()

template<OperationType::Type op>
double minsky::MinskyTensorOp< op >::dStock ( size_t  ti,
size_t  si 
) const
inlineoverride

Definition at line 90 of file minskyTensorOps.cc.

References minsky::EvalOp< T >::d1().

90  {
91  auto deriv=dynamic_cast<DerivativeMixin*>(arg.get());
92  if (!deriv) throw DerivativeNotDefined();
93  if (const double ds=deriv->dStock(ti,si))
94  return eo.d1((*arg)[ti])*ds;
95  return 0;
96  }
double d1(double x1=0, double x2=0) const override
std::shared_ptr< ITensor > arg
Definition: tensorOp.h:36
Here is the call graph for this function:

◆ setArguments()

template<OperationType::Type op>
void minsky::MinskyTensorOp< op >::setArguments ( const std::vector< TensorPtr > &  a,
const Args  
)
inlineoverridevirtual

Reimplemented from civita::ITensor.

Definition at line 81 of file minskyTensorOps.cc.

82  {if (!a.empty()) setArgument(a[0],{"",0});}
void setArgument(const TensorPtr &a, const ITensor::Args &) override
Definition: tensorOp.h:39

◆ setState()

template<OperationType::Type op>
void minsky::MinskyTensorOp< op >::setState ( const OperationPtr state)
inlineoverridevirtual

Implements minsky::SetState.

Definition at line 80 of file minskyTensorOps.cc.

80 {eo.state=state;}

Member Data Documentation

◆ eo

template<OperationType::Type op>
EvalOp<op> minsky::MinskyTensorOp< op >::eo

Definition at line 78 of file minskyTensorOps.cc.


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