Minsky
MathDAG::OperationDAG< T > Struct Template Reference

#include <equations.h>

Inheritance diagram for MathDAG::OperationDAG< T >:
Inheritance graph
Collaboration diagram for MathDAG::OperationDAG< T >:
Collaboration graph

Public Member Functions

Type type () const override
 
 OperationDAG (const string &name="")
 
int BODMASlevel () const override
 algebraic heirarchy level, used for working out whether brackets are necessary. More...
 
ostream & latex (ostream &) const override
 writes LaTeX representation of this DAG to the stream More...
 
ostream & matlab (ostream &o) const override
 writes a matlab representation of this DAG to the stream More...
 
void render (ecolab::cairo::Surface &surf) const override
 renders a visual representation of this node to surf graphic extends right from the current pen position (which needs to be defined), and pen is moved to the right edge of the graphic. The determine bounding box, render into a recording surface, and use width()/height() More...
 
NodePtr derivative (SystemOfEquations &) const override
 support for the derivative operator. More...
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &s) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &s) const
 
template<>
void render (Surface &s) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &s) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
void render (Surface &surf) const
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & latex (ostream &o) const
 writes LaTeX representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
template<>
ostream & matlab (ostream &o) const
 writes a matlab representation of this DAG to the stream More...
 
virtual ostream & latex (ostream &) const=0
 writes LaTeX representation of this DAG to the stream More...
 
LaTeXManip latex () const
 used within io streaming More...
 
virtual ostream & matlab (ostream &) const=0
 writes a matlab representation of this DAG to the stream More...
 
MatlabManip matlab () const
 
- Public Member Functions inherited from MathDAG::OperationDAGBase
 OperationDAGBase (const string &name="")
 
int order (unsigned maxOrder) const override
 returns evaluation order in sequence of variable defintions More...
 
bool tensorEval (std::set< const Node *> &) const override
 returns true if the evaluation of this involves tensor processing More...
 
VariableValuePtr addEvalOps (EvalOpVector &, const VariableValuePtr &) override
 adds EvalOps to an EvalOpVector representing this node. More...
 
void checkArg (unsigned i, unsigned j) const
 
virtual bool tensorEval (std::set< const Node * > &visited) const=0
 returns true if the evaluation of this involves tensor processing More...
 
bool tensorEval ()
 returns true if the evaluation of this involves tensor processing More...
 
- Public Member Functions inherited from MathDAG::Node
virtual ~Node ()
 
std::string latexStr () const
 
std::string matlabStr () const
 
bool tensorEval ()
 returns true if the evaluation of this involves tensor processing More...
 
LaTeXManip latex () const
 used within io streaming More...
 
MatlabManip matlab () const
 

Additional Inherited Members

- 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
}
 
- Static Public Member Functions inherited from MathDAG::OperationDAGBase
static OperationDAGBasecreate (Type type, const string &name="")
 factory method More...
 
- 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)
 
- Public Attributes inherited from MathDAG::OperationDAGBase
vector< vector< WeakNodePtr > > arguments
 
string name
 
string init ="0"
 
ItemPtr state
 
- Public Attributes inherited from MathDAG::Node
int cachedOrder =-1
 
VariableValuePtr result
 reference to where this node's value is stored More...
 

Detailed Description

template<OperationType::Type T>
struct MathDAG::OperationDAG< T >

Definition at line 236 of file equations.h.

Constructor & Destructor Documentation

◆ OperationDAG()

template<OperationType::Type T>
MathDAG::OperationDAG< T >::OperationDAG ( const string &  name = "")
inline

Definition at line 239 of file equations.h.

240  {arguments.resize(OperationTypeInfo::numArguments<T>());}
OperationDAGBase(const string &name="")
Definition: equations.h:223
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

Member Function Documentation

◆ BODMASlevel()

template<OperationType::Type T>
int MathDAG::OperationDAG< T >::BODMASlevel ( ) const
inlineoverridevirtual

algebraic heirarchy level, used for working out whether brackets are necessary.

Implements MathDAG::Node.

Definition at line 241 of file equations.h.

241  {
242  switch (type())
243  {
246  case OperationType::and_:
247  return 1;
249  case OperationType::add:
250  case OperationType::or_:
251  return 2;
252  case OperationType::constant: // varies, depending on what's in it
253  if (name.find_first_of("+-")!=string::npos)
254  return 2;
255  else
256  return 1;
257  default:
258  return 0;
259  }
260  }
Type type() const override
Definition: equations.h:238

◆ derivative()

template<OperationType::Type T>
NodePtr MathDAG::OperationDAG< T >::derivative ( SystemOfEquations ) const
overridevirtual

support for the derivative operator.

Implements MathDAG::Node.

Definition at line 438 of file equations.h.

◆ latex() [1/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::constant >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 106 of file node_latex.cc.

107  {
108  return o<<mathrm(name);
109  }
string mathrm(const string &nm)
wraps in if nm has more than one letter - and also takes into account LaTeX subscript/superscripts ...
Definition: node_latex.cc:41

◆ latex() [2/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::data >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 112 of file node_latex.cc.

113  {
114  checkArg(0,0);
115  return o<<mathrm(name)<<"("<<arguments[0][0]->latex()<<")";
116  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219
string mathrm(const string &nm)
wraps in if nm has more than one letter - and also takes into account LaTeX subscript/superscripts ...
Definition: node_latex.cc:41

◆ latex() [3/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::ravel >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 119 of file node_latex.cc.

120  {
121  o<<mathrm(name);
122  if (!arguments.empty() && !arguments[0].empty())
123  return o<<"("<<arguments[0][0]->latex()<<")";
124  return o;
125  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219
string mathrm(const string &nm)
wraps in if nm has more than one letter - and also takes into account LaTeX subscript/superscripts ...
Definition: node_latex.cc:41

◆ latex() [4/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::add >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 128 of file node_latex.cc.

129  {
130  for (size_t i=0; !arguments.empty() && i<arguments[0].size(); ++i)
131  {
132  checkArg(0,i);
133  if (i>0) o<<"+";
134  o<<arguments[0][i]->latex();
135  }
136  if (arguments.size()>1 && !arguments[0].empty() && !arguments[1].empty()) o<<"+";
137  for (size_t i=0; arguments.size()>1 && i<arguments[1].size(); ++i)
138  {
139  checkArg(1,i);
140  if (i>0) o<<"+";
141  o<<arguments[1][i]->latex();
142  }
143  return o;
144  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [5/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::subtract >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 147 of file node_latex.cc.

148  {
149  for (size_t i=0; !arguments.empty() && i<arguments[0].size(); ++i)
150  {
151  checkArg(0,i);
152  if (i>0) o<<"+";
153  o<<arguments[0][i]->latex();
154  }
155  if (arguments.size()>1 && !arguments[1].empty())
156  {
157  checkArg(1,0);
158  o<<"-";
159  const ParenIf p(o, (arguments[1].size()>1 ||
160  BODMASlevel() == arguments[1][0]->BODMASlevel()));
161  for (size_t i=0; i<arguments[1].size(); ++i)
162  {
163  checkArg(1,i);
164  if (i>0) o<<"+";
165  o<<arguments[1][i]->latex();
166  }
167  }
168  return o;
169  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [6/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::multiply >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 172 of file node_latex.cc.

173  {
174  for (size_t i=0; !arguments.empty() && i<arguments[0].size(); ++i)
175  {
176  checkArg(0,i);
177  if (i>0) o<<"\\times ";
178  const ParenIf p(o, arguments[0][i]->BODMASlevel()>BODMASlevel());
179  o<<arguments[0][i]->latex();
180  }
181  if (arguments.size()>1 && !arguments[0].empty() && !arguments[1].empty()) o<<"\\times ";
182  for (size_t i=0; arguments.size()>1 && i<arguments[1].size(); ++i)
183  {
184  checkArg(1,i);
185  if (i>0) o<<"\\times ";
186  const ParenIf p(o, arguments[1][i]->BODMASlevel()>BODMASlevel());
187  o<<arguments[1][i]->latex();
188  }
189  return o;
190  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [7/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::divide >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 193 of file node_latex.cc.

194  {
195  if (arguments.empty()) return o;
196  if (arguments.size()>1) o<< "\\frac{";
197  if (arguments[0].empty()) o<<"1";
198  for (size_t i=0; i<arguments[0].size(); ++i)
199  {
200  checkArg(0,i);
201  if (i>0) o<<"\\times ";
202  const ParenIf p(o, i>0 && arguments[0][i]->BODMASlevel()>BODMASlevel());
203  o<<arguments[0][i]->latex();
204  }
205  if (arguments.size()>1)
206  {
207  o<<"}{";
208  if (arguments[1].empty()) o<<"1";
209  for (size_t i=0; i<arguments[1].size(); ++i)
210  {
211  checkArg(1,i);
212  if (i>0) o<<"\\times ";
213  const ParenIf p(o, i>0 && arguments[1][i]->BODMASlevel()>BODMASlevel());
214  o<<arguments[1][i]->latex();
215  }
216  o<<"}";
217  }
218  return o;
219  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [8/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::log >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 222 of file node_latex.cc.

223  {
224  checkArg(0,0); checkArg(1,0);
225  return o<<"\\log_{"<<arguments[1][0]->latex()<<"}\\left("<<
226  arguments[0][0]->latex()<<"\\right)";
227  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [9/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::pow >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 230 of file node_latex.cc.

231  {
232  checkArg(0,0); checkArg(1,0);
233  {
234  const ParenIf p(o, arguments[0][0]->BODMASlevel()>BODMASlevel());
235  o<<arguments[0][0]->latex();
236  }
237  return o<<"^{"<<arguments[1][0]->latex()<<"}";
238  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [10/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::lt >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 241 of file node_latex.cc.

242  {
243  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
244  {
245  o<<"\\theta\\left(";
246  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
247  o<<arguments[1][0]->latex()<<"-";
248  else
249  o<<"-";
250  {
251  const ParenIf p(o, arguments[0][0]->BODMASlevel()>1);
252  o<<arguments[0][0]->latex();
253  }
254  o<<"\\right)";
255  }
256  else
257  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
258  o<<"\\theta\\left("<<arguments[1][0]->latex()<<"\\right)";
259  else
260  o<<"0";
261  return o;
262  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [11/78]

template<OperationType::Type T>
ostream& MathDAG::OperationDAG< T >::latex ( ostream &  ) const
overridevirtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Referenced by MathDAG::OperationDAG< OperationType::subtract >::latex().

Here is the caller graph for this function:

◆ latex() [12/78]

template<OperationType::Type T>
virtual ostream& MathDAG::Node::latex

writes LaTeX representation of this DAG to the stream

◆ latex() [13/78]

template<OperationType::Type T>
LaTeXManip MathDAG::Node::latex
inline

used within io streaming

Definition at line 119 of file equations.h.

119 {return LaTeXManip(*this);}

◆ latex() [14/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::eq >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 265 of file node_latex.cc.

266  {
267  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
268  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
269  {
270  o<<"\\delta\\left("<<arguments[0][0]->latex()<<"-";
271  {
272  const ParenIf p(o, arguments[1][0]->BODMASlevel()>BODMASlevel());
273  o<<arguments[1][0]->latex();
274  }
275  o <<"\\right)";
276  }
277  else
278  o<<"\\delta\\left("<<arguments[0][0]->latex()<<"\\right)";
279  else
280  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
281  o<<"\\delta\\left("<<arguments[1][0]->latex()<<"\\right)";
282  else
283  o<<"1";
284  return o;
285  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [15/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::le >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 288 of file node_latex.cc.

289  {
290  if ((!arguments.empty() && !arguments[0].empty() && arguments[0][0]) ||
291  (arguments.size()>1 && !arguments[1].empty() && arguments[1][0]))
292  {
293  OperationDAG<OperationType::lt> lt; lt.arguments=arguments;
294  OperationDAG<OperationType::eq> eq; eq.arguments=arguments;
295  lt.latex(o);
296  o<<"+";
297  return eq.latex(o);
298  }
299  return o<<"1"<<endl;
300  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [16/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::min >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 304 of file node_latex.cc.

305  {
306  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
307  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
308  o<<"\\min\\left("<<arguments[0][0]->latex()<<"," <<
309  arguments[1][0]->latex()<<"\\right)";
310  else
311  o<<"\\min\\left("<<arguments[0][0]->latex()<<",0\\right)";
312  else
313  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
314  o<<"\\min\\left("<<arguments[1][0]->latex()<<",0\\right)";
315  else
316  o<<"0";
317  return o;
318  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [17/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::max >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 321 of file node_latex.cc.

322  {
323  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
324  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
325  o<<"\\max\\left("<<arguments[0][0]->latex()<<"," <<
326  arguments[1][0]->latex()<<"\\right)";
327  else
328  o<<"\\max\\left("<<arguments[0][0]->latex()<<",0\\right)";
329  else
330  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
331  o<<"\\max\\left("<<arguments[1][0]->latex()<<",0\\right)";
332  else
333  o<<"0";
334  return o;
335  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [18/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::and_ >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 338 of file node_latex.cc.

339  {
340  if (arguments.size()>1 && !arguments[0].empty() && arguments[0][0] &&
341  !arguments[1].empty() && arguments[1][0])
342  o<<"\\theta\\left("<<arguments[0][0]->latex()<<"-0.5\\right)\\theta\\left(" <<
343  arguments[1][0]->latex()<<"-0.5\\right)";
344  else
345  o<<"0";
346  return o;
347  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [19/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::or_ >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 350 of file node_latex.cc.

351  {
352  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
353  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
354  o<<"\\max\\left(\\theta\\left("<<arguments[0][0]->latex()<<"-0.5\\right)," <<
355  "\\theta\\left("<<arguments[1][0]->latex()<<"\\right)\\right)";
356  else
357  o<<"\\theta\\left("<<arguments[0][0]->latex()<<"-0.5\\right)";
358  else
359  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
360  o<<"\\theta\\left("<<arguments[1][0]->latex()<<"-0.5\\right)";
361  else
362  o<<"0";
363  return o;
364  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [20/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::not_ >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 367 of file node_latex.cc.

368  {
369  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
370  o<<"\\left(1-\\theta\\left(0.5-"<<arguments[0][0]->latex()<<"\\right)\\right)";
371  else
372  o<<"1";
373  return o;
374  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [21/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::covariance >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 377 of file node_latex.cc.

378  {
379  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
380  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
381  return o<<"{\\mathrm cov}\\left("<<arguments[0][0]->latex()<<
382  ","<<arguments[1][0]<<"\\right)";
383  return o<<"0";
384  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [22/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::correlation >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 387 of file node_latex.cc.

388  {
389  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
390  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
391  return o<<"\\rho\\left("<<arguments[0][0]->latex()<<
392  ","<<arguments[1][0]<<"\\right)";
393  return o<<"0";
394  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [23/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::linearRegression >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 397 of file node_latex.cc.

398  {
399  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
400  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
401  return o<<"{\\mathrm{linReg}\\left("<<arguments[0][0]->latex()<<
402  ","<<arguments[1][0]<<"\\right)";
403  return o<<"0";
404  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [24/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::size >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 409 of file node_latex.cc.

410  {
411  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
412  {
413  size_t dim=numeric_limits<size_t>::max();
414  if (auto op=dynamic_cast<OperationBase*>(state.get()))
415  if (auto vv=arguments[0][0]->result)
416  {
417  for (auto& i: vv->hypercube().xvectors)
418  if (i.name==op->axis)
419  {
420  dim=&i-&vv->hypercube().xvectors.front();
421  break;
422  }
423  if (dim<vv->rank())
424  return o<<"\\dim\\left("<<arguments[0][0]->latex()<<","<<dim<<"\\right)";
425  }
426  return o<<"\\prod_i(\\dim("<<arguments[0][0]->latex()<<",i))";
427  }
428  return o<<"0";
429  }
VariableValuePtr result
reference to where this node&#39;s value is stored
Definition: equations.h:128
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [25/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::shape >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 432 of file node_latex.cc.

433  {
434  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
435  {
436  return o<<"shape("<<arguments[0][0]->latex()<<")";
437  }
438  return o<<"0";
439  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [26/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::mean >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 442 of file node_latex.cc.

443  {
444  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
445  {
446  return o<<"\\left\\langle"<<arguments[0][0]->latex()<<"\\right\\rangle";
447  }
448  return o<<"0";
449  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [27/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::median >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 452 of file node_latex.cc.

453  {
454  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
455  {
456  return o<<"{\\mathrm median}\\left("<<arguments[0][0]->latex()<<"\\right)";
457  }
458  return o<<"0";
459  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [28/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::stdDev >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 462 of file node_latex.cc.

463  {
464  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
465  {
466  return o<<"\\sigma("<<arguments[0][0]->latex()<<")";
467  }
468  return o<<"0";
469  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [29/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::moment >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 472 of file node_latex.cc.

473  {
474  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
475  {
476  double exponent=1;
477  if (auto op=dynamic_cast<OperationBase*>(state.get()))
478  exponent=op->arg;
479  return o<<"\\left\\langle\\Delta\\left("<<arguments[0][0]->latex()<<"\\right)^"<<exponent<<"\\right\\rangle";
480  }
481  return o<<"0";
482  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [30/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::histogram >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 485 of file node_latex.cc.

486  {
487  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
488  {
489  size_t nBins=1;
490  if (auto op=dynamic_cast<OperationBase*>(state.get()))
491  nBins=op->arg;
492  return o<<"{\\mathrm histogram}\\left("<<arguments[0][0]->latex()<<","<<nBins<<"\\right)";
493  }
494  return o<<"0";
495  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [31/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::time >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 499 of file node_latex.cc.

500  {
501  return o<<" t ";
502  }

◆ latex() [32/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::euler >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 505 of file node_latex.cc.

506  {
507  return o<<" e ";
508  }

◆ latex() [33/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::pi >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 511 of file node_latex.cc.

512  {
513  return o<<"\\pi ";
514  }

◆ latex() [34/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::zero >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 517 of file node_latex.cc.

518  {
519  return o<<" 0 ";
520  }

◆ latex() [35/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::one >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 523 of file node_latex.cc.

524  {
525  return o<<" 1 ";
526  }

◆ latex() [36/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::inf >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 529 of file node_latex.cc.

530  {
531  return o<<"\\infty ";
532  }

◆ latex() [37/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::percent >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 535 of file node_latex.cc.

536  {
537  checkArg(0,0);
538  return o<<"\\left("<<arguments[0][0]->latex()<<"\\right)\\%";
539  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [38/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::copy >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 542 of file node_latex.cc.

543  {
544  checkArg(0,0);
545  return o;
546  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227

◆ latex() [39/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::integrate >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 549 of file node_latex.cc.

550  {
551  throw error("shouldn't be executed");
552  }

◆ latex() [40/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::differentiate >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 555 of file node_latex.cc.

556  {
557  throw error("derivative operator should not appear in LaTeX output");
558  }

◆ latex() [41/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sqrt >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 561 of file node_latex.cc.

562  {
563  checkArg(0,0);
564  return o<<"\\sqrt{"<<arguments[0][0]->latex()<<"}";
565  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [42/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::exp >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 568 of file node_latex.cc.

569  {
570  checkArg(0,0);
571  o<<"\\exp\\left("<<arguments[0][0]->latex()<<"\\right)";
572  return o;
573  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [43/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::ln >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 576 of file node_latex.cc.

577  {
578  checkArg(0,0);
579  return o<<"\\ln\\left("<<arguments[0][0]->latex()<<"\\right)";
580  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [44/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sin >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 583 of file node_latex.cc.

584  {
585  checkArg(0,0);
586  return o<<"\\sin\\left("<<arguments[0][0]->latex()<<"\\right)";
587  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [45/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::cos >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 590 of file node_latex.cc.

591  {
592  checkArg(0,0);
593  return o<<"\\cos\\left("<<arguments[0][0]->latex()<<"\\right)";
594  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [46/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::tan >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 597 of file node_latex.cc.

598  {
599  checkArg(0,0);
600  return o<<"\\tan\\left("<<arguments[0][0]->latex()<<"\\right)";
601  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [47/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::asin >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 604 of file node_latex.cc.

605  {
606  checkArg(0,0);
607  return o<<"\\arcsin\\left("<<arguments[0][0]->latex()<<"\\right)";
608  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [48/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::acos >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 611 of file node_latex.cc.

612  {
613  checkArg(0,0);
614  return o<<"\\arccos\\left("<<arguments[0][0]->latex()<<"\\right)";
615  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [49/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::atan >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 618 of file node_latex.cc.

619  {
620  checkArg(0,0);
621  return o<<"\\arctan\\left("<<arguments[0][0]->latex()<<"\\right)";
622  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [50/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sinh >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 625 of file node_latex.cc.

626  {
627  checkArg(0,0);
628  return o<<"\\sinh\\left("<<arguments[0][0]->latex()<<"\\right)";
629  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [51/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::cosh >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 632 of file node_latex.cc.

633  {
634  checkArg(0,0);
635  return o<<"\\cosh\\left("<<arguments[0][0]->latex()<<"\\right)";
636  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [52/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::tanh >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 639 of file node_latex.cc.

640  {
641  checkArg(0,0);
642  return o<<"\\tanh\\left("<<arguments[0][0]->latex()<<"\\right)";
643  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [53/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::abs >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 646 of file node_latex.cc.

647  {
648  checkArg(0,0);
649  return o<<"\\left|"<<arguments[0][0]->latex()<<"\\right|";
650  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [54/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::floor >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 653 of file node_latex.cc.

654  {
655  checkArg(0,0);
656  return o<<"\\left\\lfloor"<<arguments[0][0]->latex()<<"\\right\\rfloor)";
657  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [55/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::frac >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 660 of file node_latex.cc.

661  {
662  checkArg(0,0);
663  return o<<"\\mathrm{frac}("<<arguments[0][0]->latex()<<")";
664  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [56/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::Gamma >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 667 of file node_latex.cc.

668  {
669  checkArg(0,0);
670  return o<<"\\Gamma\\left("<<arguments[0][0]->latex()<<"\\right)";
671  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [57/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::polygamma >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 674 of file node_latex.cc.

675  {
676  checkArg(0,0);
677  return o<<"\\psi^{\\left("<<arguments[1][0]->latex()<<"\\right)}\\left("<<arguments[0][0]->latex()<<"\\right)";
678  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [58/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::fact >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 681 of file node_latex.cc.

682  {
683  checkArg(0,0);
684  return o<<"\\left("<<arguments[0][0]->latex()<<"\\right)!";
685  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [59/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::userFunction >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 688 of file node_latex.cc.

689  {
690  auto desc=mathrm(dynamic_cast<UserFunction&>(*state).description());
691  if (arguments.empty() || arguments[0].empty())
692  return o<<desc<<"()";
693  if (arguments.size()<2 || arguments[1].empty())
694  return o<<desc<<"\\left("<<arguments[0][0]->latex()<<"\\right)";
695  return o<<desc<<"\\left("<<arguments[0][0]->latex()<<","<<arguments[1][0]->latex()<<"\\right)";
696  }
LaTeXManip latex() const
used within io streaming
Definition: equations.h:119
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219
string mathrm(const string &nm)
wraps in if nm has more than one letter - and also takes into account LaTeX subscript/superscripts ...
Definition: node_latex.cc:41

◆ latex() [60/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sum >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 699 of file node_latex.cc.

700  {
701  checkArg(0,0);
702  return o<<"\\sum_i("<<arguments[0][0]->latex()<<")_i";
703  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [61/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::product >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 706 of file node_latex.cc.

707  {
708  checkArg(0,0);
709  return o<<"\\prod_i("<<arguments[0][0]->latex()<<")_i";
710  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [62/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::infimum >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 713 of file node_latex.cc.

714  {
715  checkArg(0,0);
716  return o<<"\\min_i("<<arguments[0][0]->latex()<<")_i";
717  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [63/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::supremum >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 720 of file node_latex.cc.

721  {
722  checkArg(0,0);
723  return o<<"\\max_i("<<arguments[0][0]->latex()<<")_i";
724  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [64/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::infIndex >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 727 of file node_latex.cc.

728  {
729  checkArg(0,0);
730  return o<<"\\mathrm{indexOf}(\\min_i("<<arguments[0][0]->latex()<<")_i)";
731  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [65/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::supIndex >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 734 of file node_latex.cc.

735  {
736  checkArg(0,0);
737  return o<<"\\mathrm{indexOf}(\\max_i("<<arguments[0][0]->latex()<<")_i)";
738  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [66/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::any >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 741 of file node_latex.cc.

742  {
743  checkArg(0,0);
744  return o<<"\\theta\\left(\\sum_i\\theta\\left(\\left("<<arguments[0][0]->latex()<<"\\right)_i-0.5\\right)\\right)";
745  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [67/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::all >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 748 of file node_latex.cc.

749  {
750  checkArg(0,0);
751  return o<<"\\prod_i\\theta\\left(\\left("<<arguments[0][0]->latex()<<"\\right)_i-0.5\\right)";
752  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [68/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::runningSum >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 755 of file node_latex.cc.

756  {
757  checkArg(0,0);
758  return o<<"\\left[\\sum_{j=0}^i\\left("<<arguments[0][0]->latex()<<"\\right)_i\\right])";
759  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [69/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::runningProduct >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 762 of file node_latex.cc.

763  {
764  checkArg(0,0);
765  return o<<"\\left[\\prod_{j=0}^i\\left("<<arguments[0][0]->latex()<<"\\right)_i\\right])";
766  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [70/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::difference >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 769 of file node_latex.cc.

770  {
771  checkArg(0,0);
772  return o<<"\\left[\\Delta^-\\left("<<arguments[0][0]->latex()<<"\\right)_i\\right])";
773  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [71/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::differencePlus >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 776 of file node_latex.cc.

777  {
778  checkArg(0,0);
779  return o<<"\\left[\\Delta^+\\left("<<arguments[0][0]->latex()<<"\\right)_i\\right])";
780  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [72/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::innerProduct >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 783 of file node_latex.cc.

784  {
785  checkArg(0,0); checkArg(1,0);
786  return o<<arguments[0][0]->latex()<<"\\cdot"<<arguments[1][0]->latex();
787  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [73/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::outerProduct >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 790 of file node_latex.cc.

791  {
792  checkArg(0,0); checkArg(1,0);
793  return o<<arguments[0][0]->latex()<<"\\otimes"<<arguments[1][0]->latex();
794  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [74/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::index >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 797 of file node_latex.cc.

798  {
799  checkArg(0,0);
800  return o<<"\\left\\{i: \\left("<<arguments[0][0]->latex()<<"\\right)_i>0.5\\right\\}";
801  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [75/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::gather >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 804 of file node_latex.cc.

805  {
806  checkArg(0,0); checkArg(1,0);
807  return o<<"\\left[\\left("<<arguments[0][0]->latex()<<"\\right)_j : j=\\left("<<arguments[1][0]->latex()<<"\\right)_i\\right]";
808  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [76/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::meld >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 810 of file node_latex.cc.

811  {
812  checkArg(0,0); checkArg(1,0);
813  return o<<"\\mathrm{meld}\\left("<<arguments[0][0]->latex()<<","<<arguments[1][0]->latex()<<"\\right)";
814  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [77/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::merge >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 816 of file node_latex.cc.

817  {
818  checkArg(0,0); checkArg(1,0);
819  return o<<"\\mathrm{merge}\\left("<<arguments[0][0]->latex()<<","<<arguments[1][0]->latex()<<"\\right)";
820  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ latex() [78/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::slice >::latex ( ostream &  ) const
virtual

writes LaTeX representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 823 of file node_latex.cc.

824  {
825  checkArg(0,0); checkArg(1,0);
826  double slice=0;
827  if (state)
828  if (auto o=state->operationCast())
829  slice=o->arg;
830  return o<<"\\mathrm{slice}\\left("<<arguments[0][0]->latex()<<","<<slice<<"\\right)";
831  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [1/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::constant >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 80 of file node_matlab.cc.

81  {
82  return o<<init;
83  }

◆ matlab() [2/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::add >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 86 of file node_matlab.cc.

87  {
88  if (arguments.empty()||
89  (arguments[0].empty() &&
90  (arguments.size()<2||arguments[1].empty())))
91  return o<<0;
92  for (size_t i=0; i<arguments[0].size(); ++i)
93  {
94  checkArg(0,i);
95  if (i>0) o<<"+";
96  o<<arguments[0][i]->matlab();
97  }
98  if (arguments.size()>1)
99  {
100  if (!arguments[0].empty() && !arguments[1].empty()) o<<"+";
101  for (size_t i=0; i<arguments[1].size(); ++i)
102  {
103  checkArg(1,i);
104  if (i>0) o<<"+";
105  o<<arguments[1][i]->matlab();
106  }
107  }
108  return o;
109  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [3/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::subtract >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 112 of file node_matlab.cc.

113  {
114  if (arguments.empty()||
115  (arguments[0].empty() &&
116  (arguments.size()<2||arguments[1].empty())))
117  return o<<0;
118  for (size_t i=0; i<arguments[0].size(); ++i)
119  {
120  checkArg(0,i);
121  if (i>0) o<<"+";
122  o<<arguments[0][i]->matlab();
123  }
124  if (arguments.size()>1 && !arguments[1].empty()>0)
125  {
126  o<<"-(";
127  for (size_t i=0; i<arguments[1].size(); ++i)
128  {
129  checkArg(1,i);
130  if (i>0) o<<"+";
131  o<<arguments[1][i]->matlab();
132  }
133  o<<")";
134  }
135  return o;
136  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [4/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::multiply >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 139 of file node_matlab.cc.

140  {
141  if (arguments.empty()||
142  (arguments[0].empty() &&
143  (arguments.size()<2||arguments[1].empty())))
144  return o<<1;
145  for (size_t i=0; i<arguments[0].size(); ++i)
146  {
147  checkArg(0,i);
148  if (i>0) o<<"*";
149  o<<"("<<arguments[0][i]->matlab()<<")";
150  }
151  if (!arguments[0].empty() && !arguments[1].empty()) o<<"*";
152  for (size_t i=0; i<arguments[1].size(); ++i)
153  {
154  checkArg(1,i);
155  if (i>0) o<<"*";
156  o<<"("<<arguments[1][i]->matlab()<<")";
157  }
158  return o;
159  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [5/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::divide >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 162 of file node_matlab.cc.

163  {
164  if (arguments.empty()||
165  (arguments[0].empty() &&
166  (arguments.size()<2||arguments[1].empty())))
167  return o<<1;
168  if (arguments[0].empty())
169  o<<"1";
170  for (size_t i=0; i<arguments[0].size(); ++i)
171  {
172  checkArg(0,i);
173  if (i>0) o<<"*";
174  o<<"("<<arguments[0][i]->matlab()<<")";
175  }
176  if (arguments.size()>1 && !arguments[1].empty())
177  {
178  o<<"/(";
179  for (size_t i=0; i<arguments[1].size(); ++i)
180  {
181  checkArg(1,i);
182  if (i>0) o<<"*";
183  o<<"("<<arguments[1][i]->matlab()<<")";
184  }
185  o<<")";
186  }
187  return o;
188  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [6/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::log >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 191 of file node_matlab.cc.

192  {
193  checkArg(0,0); checkArg(1,0);
194  return o<<"log("<<arguments[0][0]->matlab()<<")/log("<<
195  arguments[1][0]->matlab()<<")";
196  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [7/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::pow >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 199 of file node_matlab.cc.

200  {
201  checkArg(0,0); checkArg(1,0);
202  return o<<"("<<arguments[0][0]->matlab()<<")^("<<arguments[1][0]->matlab()<<")";
203  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [8/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::lt >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 206 of file node_matlab.cc.

207  {
208  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
209  o<<"(("<<arguments[0][0]->matlab()<<")";
210  else
211  o<<"(0";
212  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
213  o<<"<("<<arguments[1][0]->matlab()<<")";
214  else
215  o<<"<0";
216  return o<<")";
217  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [9/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::le >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 220 of file node_matlab.cc.

221  {
222  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
223  o<<"(("<<arguments[0][0]->matlab()<<")";
224  else
225  o<<"(0";
226  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
227  o<<"<=("<<arguments[1][0]->matlab()<<")";
228  else
229  o<<"<=0";
230  return o<<")";
231  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [10/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::eq >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 234 of file node_matlab.cc.

235  {
236  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
237  o<<"(("<<arguments[0][0]->matlab()<<")";
238  else
239  o<<"(0";
240  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
241  o<<"==("<<arguments[1][0]->matlab()<<")";
242  else
243  o<<"==0";
244  return o<<")";
245  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [11/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::min >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 248 of file node_matlab.cc.

249  {
250  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
251  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
252  o<<"min("<<arguments[0][0]->matlab()<<"," <<
253  arguments[1][0]->matlab()<<")";
254  else
255  o<<"min("<<arguments[0][0]->matlab()<<",0)";
256  else
257  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
258  o<<"min(0,"<<arguments[1][0]->matlab()<<")";
259  else
260  o<<"0";
261  return o;
262  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [12/78]

template<OperationType::Type T>
ostream& MathDAG::OperationDAG< T >::matlab ( ostream &  ) const
overridevirtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Referenced by MathDAG::OperationDAG< OperationType::subtract >::matlab().

Here is the caller graph for this function:

◆ matlab() [13/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::max >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 265 of file node_matlab.cc.

266  {
267  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
268  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
269  o<<"max("<<arguments[0][0]->matlab()<<"," <<
270  arguments[1][0]->matlab()<<")";
271  else
272  o<<"max("<<arguments[0][0]->matlab()<<",0)";
273  else
274  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
275  o<<"max(0,"<<arguments[1][0]->matlab()<<")";
276  else
277  o<<"0";
278  return o;
279  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [14/78]

template<OperationType::Type T>
MatlabManip MathDAG::Node::matlab
inline

Definition at line 120 of file equations.h.

120 {return MatlabManip(*this);}

◆ matlab() [15/78]

template<OperationType::Type T>
virtual ostream& MathDAG::Node::matlab

writes a matlab representation of this DAG to the stream

◆ matlab() [16/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::and_ >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 282 of file node_matlab.cc.

283  {
284  if (arguments.size()>1 && !arguments[0].empty() && arguments[0][0] &&
285  !arguments[1].empty() && arguments[1][0])
286  o<<"(("<<arguments[0][0]->matlab()<<")>=0.5 && (" <<
287  arguments[1][0]->matlab()<<")>=0.5)";
288  else
289  o<<"0";
290  return o;
291  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [17/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::or_ >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 294 of file node_matlab.cc.

295  {
296  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
297  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
298  o<<"(("<<arguments[0][0]->matlab()<<")>=0.5 || (" <<
299  arguments[1][0]->matlab()<<")>=0.5)";
300  else
301  o<<"(("<<arguments[0][0]->matlab()<<")>=0.5)";
302  else
303  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
304  o<<"(("<<arguments[1][0]->matlab()<<")>=0.5)";
305  else
306  o<<"0";
307  return o;
308  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [18/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::not_ >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 311 of file node_matlab.cc.

312  {
313  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
314  o<<"(("<<arguments[0][0]->matlab()<<")<0.5)";
315  else
316  o<<"1";
317  return o;
318  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [19/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::covariance >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 325 of file node_matlab.cc.

326  {
327  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
328  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
329  return o<<"cov("<<arguments[0][0]->matlab()<<"," <<
330  arguments[1][0]->matlab()<<")";
331  return o<<"0";
332  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [20/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::correlation >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 335 of file node_matlab.cc.

336  {
337  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
338  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
339  return o<<"corr("<<arguments[0][0]->matlab()<<"," <<
340  arguments[1][0]->matlab()<<")";
341  return o<<"0";
342  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [21/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::linearRegression >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 345 of file node_matlab.cc.

346  {
347  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
348  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
349  return o<<"linReg("<<arguments[0][0]->matlab()<<"," <<
350  arguments[1][0]->matlab()<<")";
351  return o<<"0";
352  }
MatlabManip matlab() const
Definition: equations.h:120
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [22/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::size >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 355 of file node_matlab.cc.

356  {
357  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
358  {
359  size_t dim=numeric_limits<size_t>::max();
360  if (auto op=dynamic_cast<OperationBase*>(state.get()))
361  if (auto vv=arguments[0][0]->result)
362  {
363  for (auto& i: vv->hypercube().xvectors)
364  if (i.name==op->axis)
365  {
366  dim=&i-&vv->hypercube().xvectors.front();
367  break;
368  }
369  if (dim<vv->rank())
370  return o<<"size("<<arguments[0][0]->matlab()<<","<<dim<<")";
371  }
372  return o<<"prod(size("<<arguments[0][0]->matlab()<<"))";
373  }
374  return o<<"0";
375  }
VariableValuePtr result
reference to where this node&#39;s value is stored
Definition: equations.h:128
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [23/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::shape >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 378 of file node_matlab.cc.

379  {
380  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
381  {
382  return o<<"size("<<arguments[0][0]->matlab()<<")";
383  }
384  return o<<"0";
385  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [24/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::mean >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 388 of file node_matlab.cc.

389  {
390  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
391  {
392  return o<<"mean("<<arguments[0][0]->matlab()<<")";
393  }
394  return o<<"0";
395  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [25/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::median >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 398 of file node_matlab.cc.

399  {
400  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
401  {
402  return o<<"median("<<arguments[0][0]->matlab()<<")";
403  }
404  return o<<"0";
405  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [26/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::stdDev >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 408 of file node_matlab.cc.

409  {
410  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
411  {
412  return o<<"std("<<arguments[0][0]->matlab()<<")";
413  }
414  return o<<"0";
415  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [27/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::moment >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 418 of file node_matlab.cc.

419  {
420  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
421  {
422  double exponent=1;
423  if (auto op=dynamic_cast<OperationBase*>(state.get()))
424  exponent=op->arg;
425  return o<<"moment("<<arguments[0][0]->matlab()<<","<<exponent<<")";
426  }
427  return o<<"0";
428  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [28/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::histogram >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 432 of file node_matlab.cc.

433  {
434  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
435  {
436  size_t nBins=1;
437  if (auto op=dynamic_cast<OperationBase*>(state.get()))
438  nBins=op->arg;
439  return o<<"histogram("<<arguments[0][0]->matlab()<<","<<nBins<<")";
440  }
441  return o<<"0";
442  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [29/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::time >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 445 of file node_matlab.cc.

446  {
447  return o<<"t";
448  }

◆ matlab() [30/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::euler >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 451 of file node_matlab.cc.

452  {
453  return o<<"e";
454  }

◆ matlab() [31/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::pi >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 457 of file node_matlab.cc.

458  {
459  return o<<"pi";
460  }

◆ matlab() [32/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::zero >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 463 of file node_matlab.cc.

464  {
465  return o<<"0";
466  }

◆ matlab() [33/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::one >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 469 of file node_matlab.cc.

470  {
471  return o<<"1";
472  }

◆ matlab() [34/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::inf >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 475 of file node_matlab.cc.

476  {
477  return o<<"inf";
478  }

◆ matlab() [35/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::percent >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 481 of file node_matlab.cc.

482  {
483  checkArg(0,0);
484  return o<<"100*("<<arguments[0][0]->matlab()<<")";
485  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [36/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::copy >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 488 of file node_matlab.cc.

489  {
490  if (!arguments.empty() && !arguments[0].empty())
491  {
492  assert(arguments[0][0]);
493  o<<arguments[0][0]->matlab();
494  }
495  return o;
496  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [37/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::integrate >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 499 of file node_matlab.cc.

500  {
501  throw error("shouldn't be executed");
502  }

◆ matlab() [38/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::differentiate >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 505 of file node_matlab.cc.

506  {
507  throw error("derivative operator should not appear in matlab output");
508  }

◆ matlab() [39/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::data >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 511 of file node_matlab.cc.

512  {
513  throw error("Data blocks are not yet supported in Matlab mode");
514  return o;
515  }

◆ matlab() [40/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::ravel >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 518 of file node_matlab.cc.

519  {
520  throw error("Ravels are not yet supported in Matlab mode");
521  return o;
522  }

◆ matlab() [41/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sqrt >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 525 of file node_matlab.cc.

526  {
527  checkArg(0,0);
528  return o<<"sqrt("<<arguments[0][0]->matlab()<<")";
529  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [42/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::exp >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 532 of file node_matlab.cc.

533  {
534  checkArg(0,0);
535  return o<<"exp("<<arguments[0][0]->matlab()<<")";
536  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [43/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::ln >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 539 of file node_matlab.cc.

540  {
541  checkArg(0,0);
542  return o<<"log("<<arguments[0][0]->matlab()<<")";
543  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [44/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sin >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 546 of file node_matlab.cc.

547  {
548  checkArg(0,0);
549  return o<<"sin("<<arguments[0][0]->matlab()<<")";
550  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [45/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::cos >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 553 of file node_matlab.cc.

554  {
555  checkArg(0,0);
556  return o<<"cos("<<arguments[0][0]->matlab()<<")";
557  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [46/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::tan >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 560 of file node_matlab.cc.

561  {
562  checkArg(0,0);
563  return o<<"tan("<<arguments[0][0]->matlab()<<")";
564  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [47/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::asin >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 567 of file node_matlab.cc.

568  {
569  checkArg(0,0);
570  return o<<"asin("<<arguments[0][0]->matlab()<<")";
571  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [48/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::acos >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 574 of file node_matlab.cc.

575  {
576  checkArg(0,0);
577  return o<<"acos("<<arguments[0][0]->matlab()<<")";
578  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [49/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::atan >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 581 of file node_matlab.cc.

582  {
583  checkArg(0,0);
584  return o<<"atan("<<arguments[0][0]->matlab()<<")";
585  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [50/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sinh >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 588 of file node_matlab.cc.

589  {
590  checkArg(0,0);
591  return o<<"sinh("<<arguments[0][0]->matlab()<<")";
592  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [51/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::cosh >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 595 of file node_matlab.cc.

596  {
597  checkArg(0,0);
598  return o<<"cosh("<<arguments[0][0]->matlab()<<")";
599  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [52/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::tanh >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 602 of file node_matlab.cc.

603  {
604  checkArg(0,0);
605  return o<<"tanh("<<arguments[0][0]->matlab()<<")";
606  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [53/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::abs >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 609 of file node_matlab.cc.

610  {
611  checkArg(0,0);
612  return o<<"abs("<<arguments[0][0]->matlab()<<")";
613  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [54/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::floor >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 616 of file node_matlab.cc.

617  {
618  checkArg(0,0);
619  return o<<"floor("<<arguments[0][0]->matlab()<<")";
620  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [55/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::frac >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 623 of file node_matlab.cc.

624  {
625  checkArg(0,0);
626  return o<<"frac("<<arguments[0][0]->matlab()<<")";
627  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [56/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::Gamma >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 630 of file node_matlab.cc.

631  {
632  checkArg(0,0);
633  return o<<"gamma("<<arguments[0][0]->matlab()<<")";
634  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [57/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::polygamma >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 637 of file node_matlab.cc.

638  {
639  checkArg(0,0); checkArg(1,0);
640  return o<<"psi(floor("<<arguments[1][0]->matlab()<<"),("<<arguments[0][0]->matlab()<<"))";
641  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [58/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::fact >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 644 of file node_matlab.cc.

645  {
646  checkArg(0,0);
647  return o<<"gamma(1+("<<arguments[0][0]->matlab()<<"))";
648  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [59/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::userFunction >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 651 of file node_matlab.cc.

652  {
653  if (arguments.empty() || arguments[0].empty())
654  return o<<dynamic_cast<UserFunction*>(state.get())->name()<<"()";
655  if (arguments.size()<2 || arguments[1].empty())
656  return o<<dynamic_cast<UserFunction*>(state.get())->name()<<"("<<arguments[0][0]->matlab()<<")";
657  return o<<dynamic_cast<UserFunction*>(state.get())->name()<<"("<<arguments[0][0]->matlab()<<","<<arguments[1][0]->matlab()<<")";
658  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [60/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::sum >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 662 of file node_matlab.cc.

663  {
664  checkArg(0,0);
665  return o<<"sum("<<arguments[0][0]->matlab()<<")";
666  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [61/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::product >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 668 of file node_matlab.cc.

669  {
670  checkArg(0,0);
671  return o<<"prod("<<arguments[0][0]->matlab()<<")";
672  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [62/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::supremum >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 674 of file node_matlab.cc.

675  {
676  checkArg(0,0);
677  return o<<"max("<<arguments[0][0]->matlab()<<")";
678  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [63/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::infimum >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 680 of file node_matlab.cc.

681  {
682  checkArg(0,0);
683  return o<<"min("<<arguments[0][0]->matlab()<<")";
684  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [64/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::supIndex >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 686 of file node_matlab.cc.

687  {
688  checkArg(0,0);
689  return o<<"find(("<<arguments[0][0]->matlab()<<")==max("<<arguments[0][0]->matlab()<<"))";
690  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [65/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::infIndex >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 692 of file node_matlab.cc.

693  {
694  checkArg(0,0);
695  return o<<"find(("<<arguments[0][0]->matlab()<<")==min("<<arguments[0][0]->matlab()<<"))";
696  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [66/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::any >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 698 of file node_matlab.cc.

699  {
700  checkArg(0,0);
701  return o<<"any(("<<arguments[0][0]->matlab()<<")>0.5)";
702  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [67/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::all >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 704 of file node_matlab.cc.

705  {
706  checkArg(0,0);
707  return o<<"all(("<<arguments[0][0]->matlab()<<")>0.5)";
708  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [68/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::runningSum >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 710 of file node_matlab.cc.

711  {
712  checkArg(0,0);
713  return o<<"cumsum("<<arguments[0][0]->matlab()<<")";
714  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [69/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::runningProduct >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 716 of file node_matlab.cc.

717  {
718  checkArg(0,0);
719  return o<<"cumprod("<<arguments[0][0]->matlab()<<")";
720  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [70/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::difference >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 722 of file node_matlab.cc.

723  {
724  checkArg(0,0);
725  return o<<"diff("<<arguments[0][0]->matlab()<<")";
726  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [71/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::differencePlus >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 729 of file node_matlab.cc.

730  {
731  checkArg(0,0);
732  return o<<"diff("<<arguments[0][0]->matlab()<<")";
733  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [72/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::innerProduct >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 735 of file node_matlab.cc.

736  {
737  checkArg(0,0);
738  checkArg(1,0);
739  return o<<"("<<arguments[0][0]->matlab()<<")*("<<arguments[1][0]->matlab()<<")";
740  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [73/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::outerProduct >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 742 of file node_matlab.cc.

743  {
744  checkArg(0,0);
745  checkArg(1,0);
746  // note matlab can only deal with rank 2 tensors - this works if both are vectors, or one is a scalar and the other a matrix
747  return o<<"("<<arguments[0][0]->matlab()<<").*transpose("<<arguments[1][0]->matlab()<<")";
748  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [74/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::index >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 750 of file node_matlab.cc.

751  {
752  checkArg(0,0);
753  return o<<"find(("<<arguments[0][0]->matlab()<<")>0.5)";
754  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [75/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::gather >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 756 of file node_matlab.cc.

757  {
758  checkArg(0,0);checkArg(1,0);
759  return o<<"("<<arguments[0][0]->matlab()<<")("<<arguments[1][0]->matlab()<<")";
760  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [76/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::meld >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 762 of file node_matlab.cc.

763  {
764  checkArg(0,0);checkArg(1,0);
765  return o<<"meld("<<arguments[0][0]->matlab()<<","<<arguments[1][0]->matlab()<<")";
766  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [77/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::merge >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 768 of file node_matlab.cc.

769  {
770  checkArg(0,0);checkArg(1,0);
771  return o<<"meld("<<arguments[0][0]->matlab()<<","<<arguments[1][0]->matlab()<<")";
772  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ matlab() [78/78]

template<>
ostream & MathDAG::OperationDAG< OperationType::slice >::matlab ( ostream &  ) const
virtual

writes a matlab representation of this DAG to the stream

Implements MathDAG::Node.

Definition at line 774 of file node_matlab.cc.

775  {
776  checkArg(0,0);checkArg(1,0);
777  double slice=0;
778  if (state)
779  if (auto o=state->operationCast())
780  slice=o->arg;
781  return o<<"slice("<<arguments[0][0]->matlab()<<","<<slice<<")";
782  }
void checkArg(unsigned i, unsigned j) const
Definition: equations.cc:227
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [1/76]

template<>
void MathDAG::OperationDAG< OperationType::constant >::render ( Surface &  surf) const

Definition at line 231 of file equationDisplayRender.cc.

232  {
233  assert(!"constant deprecated");
234  }

◆ render() [2/76]

template<>
void MathDAG::OperationDAG< OperationType::add >::render ( Surface &  surf) const

Definition at line 237 of file equationDisplayRender.cc.

238  {
239  for (size_t i=0; i<arguments.size(); ++i)
240  {
241  naryRender(surf, arguments[i], BODMASlevel()," + ","0");
242  if (i!=arguments.size()-1) print(surf.cairo()," + ",Anchor::nw);
243  }
244  }
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [3/76]

template<>
void MathDAG::OperationDAG< OperationType::subtract >::render ( Surface &  surf) const

Definition at line 247 of file equationDisplayRender.cc.

248  {
249  if (!arguments.empty())
250  naryRender(surf, arguments[0], BODMASlevel(), " + ","0");
251  if (arguments.size()>1)
252  {
253  print(surf.cairo()," - ",Anchor::nw);
254  if (arguments[1].size()>1 ||
255  (!arguments[1].empty() && BODMASlevel() == arguments[1][0]->BODMASlevel()))
256  parenthesise(surf, [&](Surface& s){naryRender(s,arguments[1], BODMASlevel(), " + ","0");});
257  else
258  naryRender(surf, arguments[1], BODMASlevel(), " + ","0");
259  }
260  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [4/76]

template<>
void MathDAG::OperationDAG< OperationType::multiply >::render ( Surface &  surf) const

Definition at line 263 of file equationDisplayRender.cc.

264  {
265  for (size_t i=0; i<arguments.size(); ++i)
266  {
267  naryRender(surf,arguments[i], BODMASlevel(), " × ","1");
268  if (i!=arguments.size()-1) print(surf.cairo()," × ",Anchor::nw);
269  }
270  }
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [5/76]

template<OperationType::Type T>
void MathDAG::OperationDAG< T >::render ( ecolab::cairo::Surface &  surf) const
overridevirtual

renders a visual representation of this node to surf graphic extends right from the current pen position (which needs to be defined), and pen is moved to the right edge of the graphic. The determine bounding box, render into a recording surface, and use width()/height()

Implements MathDAG::Node.

Referenced by MathDAG::OperationDAG< OperationType::subtract >::render().

Here is the caller graph for this function:

◆ render() [6/76]

template<>
void MathDAG::OperationDAG< OperationType::divide >::render ( Surface &  surf) const

Definition at line 273 of file equationDisplayRender.cc.

274  {
275  RecordingSurface num, den;
276  if (!arguments.empty())
277  naryRender(num, arguments[0], BODMASlevel()," × ","1");
278 
279  if (arguments.size()>1)
280  {
281  naryRender(den, arguments[1], BODMASlevel()," × ","1");
282  if (!arguments[1].empty())
283  {
284  double x, y; // starting position of current line
285  cairo_get_current_point(surf.cairo(),&x,&y);
286 
287  const double solidusLength = std::max(num.width(),den.width());
288 
289  cairo_move_to(surf.cairo(), x+0.5*(solidusLength-num.width()), y-num.height());
290  naryRender(surf, arguments[0], BODMASlevel()," × ","1");
291  cairo_move_to(surf.cairo(), x+0.5*(solidusLength-den.width()), y+0.5*num.height()+5);
292  naryRender(surf, arguments[1], BODMASlevel()," × ","1");
293 
294  cairo_move_to(surf.cairo(), x, y+0.5*num.height()+5);
295  cairo_rel_line_to(surf.cairo(), solidusLength, 0);
296  {
297  const CairoSave cs(surf.cairo());
298  cairo_set_line_width(surf.cairo(),1);
299  cairo_stroke(surf.cairo());
300  }
301  cairo_move_to(surf.cairo(),x+solidusLength,y);
302  }
303  else // denominator =1, so just render the numerator
304  naryRender(surf, arguments[0], BODMASlevel()," × ","1");
305  }
306  else // denominator =1, so just render the numerator
307  naryRender(surf, arguments[0], BODMASlevel()," × ","1");
308  }
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [7/76]

template<>
void MathDAG::OperationDAG< OperationType::log >::render ( Surface &  surf) const

Definition at line 311 of file equationDisplayRender.cc.

312  {
313  if (arguments.empty() || arguments[0].empty() || !arguments[0][0])
314  print(surf.cairo(),"<i>0</i>",Anchor::nw);
315  else
316  {
317  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
318  {
319  const double h=print(surf.cairo(),"log",Anchor::nw);
320  cairo_rel_move_to(surf.cairo(), 0, 0.5*h);
321  arguments[1][0]->render(surf);
322  cairo_rel_move_to(surf.cairo(), 0, -0.5*h);
323  }
324  else
325  print(surf.cairo(),"ln",Anchor::nw);
326  arguments[0][0]->render(surf);
327  }
328  }
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [8/76]

template<>
void MathDAG::OperationDAG< OperationType::userFunction >::render ( Surface &  surf) const

Definition at line 331 of file equationDisplayRender.cc.

332  {
333  print(surf.cairo(),"<i>"+dynamic_cast<UserFunction&>(*state).description()+"</i>",Anchor::nw);
334  if (arguments.empty() || arguments[0].empty() || !arguments[0][0])
335  print(surf.cairo(),"(0,0)",Anchor::nw);
336  else
337  parenthesise(surf, [&](Surface& surf){
338  arguments[0][0]->render(surf);
339  print(surf.cairo(),",",Anchor::nw);
340  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
341  arguments[1][0]->render(surf);
342  else
343  print(surf.cairo(),"0",Anchor::nw);
344  });
345  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219
void render(ecolab::cairo::Surface &surf) const override
renders a visual representation of this node to surf graphic extends right from the current pen posit...

◆ render() [9/76]

template<>
void MathDAG::OperationDAG< OperationType::pow >::render ( Surface &  surf) const

Definition at line 348 of file equationDisplayRender.cc.

349  {
350  if (arguments.empty() || arguments[0].empty() || !arguments[0][0])
351  print(surf.cairo(),"<i>0</i>",Anchor::nw);
352  else
353  {
354  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
355  {
356  if (arguments[0][0]->BODMASlevel()>BODMASlevel())
357  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
358  else
359  arguments[0][0]->render(surf);
360 
361  RecordingSurface base;
362  arguments[0][0]->render(base);
363  cairo_rel_move_to(surf.cairo(), 0, -0.5*base.height());
364  arguments[1][0]->render(surf);
365  cairo_rel_move_to(surf.cairo(), 0, 0.5*base.height());
366  }
367  else
368  print(surf.cairo(),"<i>1</i>",Anchor::nw);
369  }
370 
371  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [10/76]

template<>
void MathDAG::OperationDAG< OperationType::time >::render ( Surface &  surf) const

Definition at line 375 of file equationDisplayRender.cc.

376  {print(surf.cairo(),"<i>t</i>",Anchor::nw);}
double print(cairo_t *cairo, const string &text, Anchor anchor)

◆ render() [11/76]

template<>
void MathDAG::OperationDAG< OperationType::euler >::render ( Surface &  surf) const

Definition at line 378 of file equationDisplayRender.cc.

379  {print(surf.cairo(),"<i>e</i>",Anchor::nw);}
double print(cairo_t *cairo, const string &text, Anchor anchor)

◆ render() [12/76]

template<>
void MathDAG::OperationDAG< OperationType::pi >::render ( Surface &  surf) const

Definition at line 381 of file equationDisplayRender.cc.

382  {print(surf.cairo(),"<i>π</i>",Anchor::nw);}
double print(cairo_t *cairo, const string &text, Anchor anchor)

◆ render() [13/76]

template<>
void MathDAG::OperationDAG< OperationType::zero >::render ( Surface &  surf) const

Definition at line 384 of file equationDisplayRender.cc.

385  {print(surf.cairo(),"<i>0</i>",Anchor::nw);}
double print(cairo_t *cairo, const string &text, Anchor anchor)

◆ render() [14/76]

template<>
void MathDAG::OperationDAG< OperationType::one >::render ( Surface &  surf) const

Definition at line 387 of file equationDisplayRender.cc.

388  {print(surf.cairo(),"<i>1</i>",Anchor::nw);}
double print(cairo_t *cairo, const string &text, Anchor anchor)

◆ render() [15/76]

template<>
void MathDAG::OperationDAG< OperationType::inf >::render ( Surface &  surf) const

Definition at line 390 of file equationDisplayRender.cc.

391  {print(surf.cairo(),"<i>∞</i>",Anchor::nw);}
double print(cairo_t *cairo, const string &text, Anchor anchor)

◆ render() [16/76]

template<>
void MathDAG::OperationDAG< OperationType::percent >::render ( Surface &  s) const

Definition at line 393 of file equationDisplayRender.cc.

394  {
395  double xx,yy;
396  cairo_get_current_point(s.cairo(),&xx,&yy);
397 
398  RecordingSurface r;
399  arguments[0][0]->render(r);
400 
401  Pango pango(s.cairo());
402  const double oldFs=pango.getFontSize();
403  pango.setFontSize(r.height());
404  cairo_rel_move_to(s.cairo(),0,-(r.height()-oldFs));
405  pango.show();
406  cairo_rel_move_to(s.cairo(),0,(r.height()-oldFs));
407  cairo_rel_move_to(s.cairo(),pango.width(),0);
408  arguments[0][0]->render(s);
409  xx+=pango.width()+r.width();
410  pango.setMarkup("%");
411  cairo_move_to(s.cairo(),xx,yy-r.height()+oldFs);
412  pango.show();
413  cairo_move_to(s.cairo(),xx+pango.width(),yy);
414  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [17/76]

template<>
void MathDAG::OperationDAG< OperationType::copy >::render ( Surface &  surf) const

Definition at line 416 of file equationDisplayRender.cc.

417  {print(surf.cairo(),"=",Anchor::nw);}
double print(cairo_t *cairo, const string &text, Anchor anchor)

◆ render() [18/76]

template<>
void MathDAG::OperationDAG< OperationType::integrate >::render ( Surface &  surf) const

Definition at line 419 of file equationDisplayRender.cc.

420  {throw error("should not be rendering integration operations");}

◆ render() [19/76]

template<>
void MathDAG::OperationDAG< OperationType::differentiate >::render ( Surface &  surf) const

Definition at line 427 of file equationDisplayRender.cc.

428  {throw error("should not be rendering differentiation operations");}

◆ render() [20/76]

template<>
void MathDAG::OperationDAG< OperationType::sqrt >::render ( Surface &  surf) const

Definition at line 430 of file equationDisplayRender.cc.

431  {
432  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
433  {
434  RecordingSurface arg;
435  arguments[0][0]->render(arg);
436 
437  // display a scaled surd.
438  Pango pango(surf.cairo());
439  {
440  const CairoSave cs(surf.cairo());
441  const double oldFs=pango.getFontSize();
442  pango.setFontSize(arg.height());
443  pango.setMarkup("√");
444  cairo_rel_move_to(surf.cairo(),0,oldFs-arg.height());
445  pango.show();
446  }
447  cairo_rel_move_to(surf.cairo(),pango.width(),0);
448  // draw an overbar
449  double x,y;
450  cairo_get_current_point(surf.cairo(),&x,&y);
451  {
452  const CairoSave cs(surf.cairo());
453  cairo_rel_line_to(surf.cairo(),arg.width(),0);
454  cairo_set_line_width(surf.cairo(),1);
455  cairo_stroke(surf.cairo());
456  }
457 
458  cairo_move_to(surf.cairo(),x,y-arg.top()+2);
459  arguments[0][0]->render(surf);
460  }
461  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [21/76]

template<>
void MathDAG::OperationDAG< OperationType::data >::render ( Surface &  surf) const

Definition at line 463 of file equationDisplayRender.cc.

464  {
465  if (auto d=dynamic_cast<const minsky::DataOp*>(state.get()))
466  print(surf.cairo(),latexToPango(mathrm(d->description())),Anchor::nw);
467  else
468  print(surf.cairo(),latexToPango(mathrm("\\uplus")),Anchor::nw);
469  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
470  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
471  }
std::string latexToPango(const char *s)
Definition: latexMarkup.h:30
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219
string mathrm(const string &nm)
wraps in if nm has more than one letter - and also takes into account LaTeX subscript/superscripts ...
Definition: node_latex.cc:41

◆ render() [22/76]

template<>
void MathDAG::OperationDAG< OperationType::ravel >::render ( Surface &  surf) const

Definition at line 473 of file equationDisplayRender.cc.

474  {
475  if (auto d=dynamic_cast<const minsky::DataOp*>(state.get()))
476  print(surf.cairo(),latexToPango(mathrm(d->description())),Anchor::nw);
477  else
478  print(surf.cairo(),latexToPango(mathrm("\\uplus")),Anchor::nw);
479  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
480  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
481  }
std::string latexToPango(const char *s)
Definition: latexMarkup.h:30
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219
string mathrm(const string &nm)
wraps in if nm has more than one letter - and also takes into account LaTeX subscript/superscripts ...
Definition: node_latex.cc:41

◆ render() [23/76]

template<>
void MathDAG::OperationDAG< OperationType::exp >::render ( Surface &  surf) const

Definition at line 483 of file equationDisplayRender.cc.

484  {
485  print(surf.cairo(),"exp",Anchor::nw);
486  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
487  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
488  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [24/76]

template<>
void MathDAG::OperationDAG< OperationType::ln >::render ( Surface &  surf) const

Definition at line 490 of file equationDisplayRender.cc.

491  {
492  print(surf.cairo(),"ln",Anchor::nw);
493  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
494  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
495  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [25/76]

template<>
void MathDAG::OperationDAG< OperationType::sin >::render ( Surface &  surf) const

Definition at line 497 of file equationDisplayRender.cc.

498  {
499  print(surf.cairo(),"sin",Anchor::nw);
500  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
501  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
502  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [26/76]

template<>
void MathDAG::OperationDAG< OperationType::cos >::render ( Surface &  surf) const

Definition at line 504 of file equationDisplayRender.cc.

505  {
506  print(surf.cairo(),"cos",Anchor::nw);
507  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
508  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
509  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [27/76]

template<>
void MathDAG::OperationDAG< OperationType::tan >::render ( Surface &  surf) const

Definition at line 511 of file equationDisplayRender.cc.

512  {
513  print(surf.cairo(),"tan",Anchor::nw);
514  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
515  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
516  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [28/76]

template<>
void MathDAG::OperationDAG< OperationType::asin >::render ( Surface &  surf) const

Definition at line 518 of file equationDisplayRender.cc.

519  {
520  print(surf.cairo(),"sin<sup>-1</sup>",Anchor::nw);
521  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
522  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
523  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [29/76]

template<>
void MathDAG::OperationDAG< OperationType::acos >::render ( Surface &  surf) const

Definition at line 525 of file equationDisplayRender.cc.

526  {
527  print(surf.cairo(),"cos<small><sup>-1</sup></small>",Anchor::nw);
528  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
529  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
530  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [30/76]

template<>
void MathDAG::OperationDAG< OperationType::atan >::render ( Surface &  surf) const

Definition at line 532 of file equationDisplayRender.cc.

533  {
534  print(surf.cairo(),"tan<small><sup>-1</sup></small>",Anchor::nw);
535  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
536  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
537  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [31/76]

template<>
void MathDAG::OperationDAG< OperationType::sinh >::render ( Surface &  surf) const

Definition at line 539 of file equationDisplayRender.cc.

540  {
541  print(surf.cairo(),"sinh",Anchor::nw);
542  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
543  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
544  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [32/76]

template<>
void MathDAG::OperationDAG< OperationType::cosh >::render ( Surface &  surf) const

Definition at line 546 of file equationDisplayRender.cc.

547  {
548  print(surf.cairo(),"cosh",Anchor::nw);
549  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
550  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
551  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [33/76]

template<>
void MathDAG::OperationDAG< OperationType::tanh >::render ( Surface &  surf) const

Definition at line 553 of file equationDisplayRender.cc.

554  {
555  print(surf.cairo(),"tanh",Anchor::nw);
556  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
557  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
558  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [34/76]

template<>
void MathDAG::OperationDAG< OperationType::abs >::render ( Surface &  s) const

Definition at line 561 of file equationDisplayRender.cc.

562  {
563  double xx,yy;
564  cairo_get_current_point(s.cairo(),&xx,&yy);
565 
566  RecordingSurface r;
567  arguments[0][0]->render(r);
568 
569  Pango pango(s.cairo());
570  const double oldFs=pango.getFontSize();
571  pango.setFontSize(r.height());
572  pango.setMarkup("|");
573  cairo_rel_move_to(s.cairo(),0,-(r.height()-oldFs));
574  pango.show();
575  cairo_rel_move_to(s.cairo(),0,(r.height()-oldFs));
576  cairo_rel_move_to(s.cairo(),pango.width(),0);
577  arguments[0][0]->render(s);
578  xx+=pango.width()+r.width();
579  pango.setMarkup("|");
580  cairo_move_to(s.cairo(),xx,yy-r.height()+oldFs);
581  pango.show();
582  cairo_move_to(s.cairo(),xx+pango.width(),yy);
583  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [35/76]

template<>
void MathDAG::OperationDAG< OperationType::floor >::render ( Surface &  s) const

Definition at line 586 of file equationDisplayRender.cc.

587  {
588  double xx,yy;
589  cairo_get_current_point(s.cairo(),&xx,&yy);
590 
591  RecordingSurface r;
592  arguments[0][0]->render(r);
593 
594  Pango pango(s.cairo());
595  const double oldFs=pango.getFontSize();
596  pango.setFontSize(r.height());
597  pango.setMarkup("⌊");
598  cairo_rel_move_to(s.cairo(),0,-(r.height()-oldFs));
599  pango.show();
600  cairo_rel_move_to(s.cairo(),0,(r.height()-oldFs));
601  cairo_rel_move_to(s.cairo(),pango.width(),0);
602  arguments[0][0]->render(s);
603  xx+=pango.width()+r.width();
604  pango.setMarkup("⌋");
605  cairo_move_to(s.cairo(),xx,yy-r.height()+oldFs);
606  pango.show();
607  cairo_move_to(s.cairo(),xx+pango.width(),yy);
608  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [36/76]

template<>
void MathDAG::OperationDAG< OperationType::frac >::render ( Surface &  surf) const

Definition at line 611 of file equationDisplayRender.cc.

612  {
613  print(surf.cairo(),"frac",Anchor::nw);
614  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
615  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
616  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [37/76]

template<>
void MathDAG::OperationDAG< OperationType::Gamma >::render ( Surface &  surf) const

Definition at line 619 of file equationDisplayRender.cc.

620  {
621  print(surf.cairo(),"Γ",Anchor::nw);
622  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
623  {parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});}
624  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [38/76]

template<>
void MathDAG::OperationDAG< OperationType::polygamma >::render ( Surface &  surf) const

Definition at line 627 of file equationDisplayRender.cc.

628  {
629  print(surf.cairo(),"ψ",Anchor::nw);
630  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
631  {
632  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
633  {
634  RecordingSurface base;
635  arguments[1][0]->render(base);
636  cairo_rel_move_to(surf.cairo(), 0, -0.5*base.height());
637  parenthesise(surf, [&](Surface& surf){arguments[1][0]->render(surf);});
638  arguments[0][0]->render(base);
639  cairo_rel_move_to(surf.cairo(), 0, 0.5*base.height());
640  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
641  }
642  else
643  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
644  }
645  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [39/76]

template<>
void MathDAG::OperationDAG< OperationType::fact >::render ( Surface &  s) const

Definition at line 648 of file equationDisplayRender.cc.

649  {
650  double xx,yy;
651  cairo_get_current_point(s.cairo(),&xx,&yy);
652 
653  RecordingSurface r;
654  arguments[0][0]->render(r);
655 
656  Pango pango(s.cairo());
657  const double oldFs=pango.getFontSize();
658  pango.setFontSize(r.height());
659  cairo_rel_move_to(s.cairo(),0,-(r.height()-oldFs));
660  pango.show();
661  cairo_rel_move_to(s.cairo(),0,(r.height()-oldFs));
662  cairo_rel_move_to(s.cairo(),pango.width(),0);
663  arguments[0][0]->render(s);
664  xx+=pango.width()+r.width();
665  pango.setMarkup("!");
666  cairo_move_to(s.cairo(),xx,yy-r.height()+oldFs);
667  pango.show();
668  cairo_move_to(s.cairo(),xx+pango.width(),yy);
669  }
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [40/76]

template<>
void MathDAG::OperationDAG< OperationType::sum >::render ( Surface &  surf) const

Definition at line 672 of file equationDisplayRender.cc.

673  {
674  print(surf.cairo(),"∑<sub>i</sub>",Anchor::nw);
675  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
676  {
677  const double h=parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
678  cairo_rel_move_to(surf.cairo(), 0, 0.5*h);
679  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
680  cairo_rel_move_to(surf.cairo(), 0, -0.5*h);
681  }
682  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [41/76]

template<>
void MathDAG::OperationDAG< OperationType::product >::render ( Surface &  surf) const

Definition at line 685 of file equationDisplayRender.cc.

686  {
687  print(surf.cairo(),"∏<sub>i</sub>",Anchor::nw);
688  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
689  {
690  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
691  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
692  }
693  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [42/76]

template<>
void MathDAG::OperationDAG< OperationType::infimum >::render ( Surface &  surf) const

Definition at line 696 of file equationDisplayRender.cc.

697  {
698  print(surf.cairo(),"min<sub>i</sub>",Anchor::nw);
699  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
700  {
701  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
702  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
703  }
704  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [43/76]

template<>
void MathDAG::OperationDAG< OperationType::supremum >::render ( Surface &  surf) const

Definition at line 707 of file equationDisplayRender.cc.

708  {
709  print(surf.cairo(),"min<sub>i</sub>",Anchor::nw);
710  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
711  {
712  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
713  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
714  }
715  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [44/76]

template<>
void MathDAG::OperationDAG< OperationType::infIndex >::render ( Surface &  surf) const

Definition at line 718 of file equationDisplayRender.cc.

719  {
720  print(surf.cairo(),"indexOf",Anchor::nw);
721  parenthesise(surf, [&](Surface& surf){OperationDAG<OperationType::infimum>().render(surf);});
722  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
void render(ecolab::cairo::Surface &surf) const override
renders a visual representation of this node to surf graphic extends right from the current pen posit...

◆ render() [45/76]

template<>
void MathDAG::OperationDAG< OperationType::supIndex >::render ( Surface &  surf) const

Definition at line 725 of file equationDisplayRender.cc.

726  {
727  print(surf.cairo(),"indexOf",Anchor::nw);
728  parenthesise(surf, [&](Surface& surf){OperationDAG<OperationType::supremum>().render(surf);});
729  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
void render(ecolab::cairo::Surface &surf) const override
renders a visual representation of this node to surf graphic extends right from the current pen posit...

◆ render() [46/76]

template<>
void MathDAG::OperationDAG< OperationType::any >::render ( Surface &  surf) const

Definition at line 732 of file equationDisplayRender.cc.

733  {
734  print(surf.cairo(),"Θ(max<sub>i</sub>",Anchor::nw);
735  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
736  {
737  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
738  print(surf.cairo(),"<sub>i</sub>&gt;0.5)",Anchor::nw);
739  }
740  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [47/76]

template<>
void MathDAG::OperationDAG< OperationType::all >::render ( Surface &  surf) const

Definition at line 743 of file equationDisplayRender.cc.

744  {
745  print(surf.cairo(),"∏<sub>i</sub>Θ(",Anchor::nw);
746  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
747  {
748  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
749  print(surf.cairo(),"<sub>i</sub>&gt;0.5)",Anchor::nw);
750  }
751  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [48/76]

template<>
void MathDAG::OperationDAG< OperationType::runningSum >::render ( Surface &  surf) const

Definition at line 754 of file equationDisplayRender.cc.

755  {
756  print(surf.cairo(),"∑<sub>j=0</sub><sup>i</sup>",Anchor::nw);
757  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
758  {
759  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
760  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
761  }
762  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [49/76]

template<>
void MathDAG::OperationDAG< OperationType::runningProduct >::render ( Surface &  surf) const

Definition at line 765 of file equationDisplayRender.cc.

766  {
767  print(surf.cairo(),"∏<sub>j=0</sub><sup>i</sup>",Anchor::nw);
768  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
769  {
770  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
771  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
772  }
773  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [50/76]

template<>
void MathDAG::OperationDAG< OperationType::difference >::render ( Surface &  surf) const

Definition at line 776 of file equationDisplayRender.cc.

777  {
778  print(surf.cairo(),"Δ⁻ᵢ",Anchor::nw);
779  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
780  {
781  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
782  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
783  }
784  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [51/76]

template<>
void MathDAG::OperationDAG< OperationType::differencePlus >::render ( Surface &  surf) const

Definition at line 787 of file equationDisplayRender.cc.

788  {
789  print(surf.cairo(),"Δ⁺ᵢ",Anchor::nw);
790  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
791  {
792  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
793  print(surf.cairo(),"<sub>i</sub>",Anchor::nw);
794  }
795  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [52/76]

template<>
void MathDAG::OperationDAG< OperationType::index >::render ( Surface &  surf) const

Definition at line 798 of file equationDisplayRender.cc.

799  {
800  print(surf.cairo(),"index",Anchor::nw);
801  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
802  {
803  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
804  }
805  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [53/76]

template<>
void MathDAG::OperationDAG< OperationType::lt >::render ( Surface &  surf) const

Definition at line 808 of file equationDisplayRender.cc.

809  {
810  if (!arguments.empty())
811  {
812  if (!arguments[1].empty() && arguments[1][0])
813  if (!arguments[0].empty() && arguments[0][0])
814  {
815  print(surf.cairo(),"θ",Anchor::nw);
816  parenthesise(surf, [&](Surface& surf){
817  arguments[1][0]->render(surf);
818  print(surf.cairo()," - ",Anchor::nw);
819  if (arguments[0][0]->BODMASlevel()>1)
820  parenthesise(surf, [&](Surface& surf){
821  arguments[0][0]->render(surf);
822  });
823  else
824  arguments[0][0]->render(surf);
825  });
826  }
827  else
828  {
829  print(surf.cairo(),"θ",Anchor::nw);
830  parenthesise(surf, [&](Surface& surf){arguments[1][0]->render(surf);});
831  }
832  else
833  if (!arguments[0].empty() && arguments[0][0])
834  {
835  print(surf.cairo(),"θ",Anchor::nw);
836  parenthesise(surf, [&](Surface& surf){
837  print(surf.cairo()," - ",Anchor::nw);
838  if (arguments[0][0]->BODMASlevel()>1)
839  parenthesise(surf, [&](Surface& surf){
840  arguments[0][0]->render(surf);
841  });
842  else
843  arguments[0][0]->render(surf);
844  });
845  }
846  else
847  print(surf.cairo(),"0",Anchor::nw);
848  }
849  else
850  print(surf.cairo(),"0",Anchor::nw);
851  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [54/76]

template<>
void MathDAG::OperationDAG< OperationType::eq >::render ( Surface &  surf) const

Definition at line 854 of file equationDisplayRender.cc.

855  {
856  if (!arguments.empty())
857  {
858  if (!arguments[1].empty() && arguments[1][0])
859  if (!arguments[0].empty() && arguments[0][0])
860  {
861  print(surf.cairo(),"δ",Anchor::nw);
862  parenthesise(surf, [&](Surface& surf){
863  arguments[0][0]->render(surf);
864  print(surf.cairo()," - ",Anchor::nw);
865  arguments[1][0]->render(surf);
866  });
867  }
868  else
869  {
870  print(surf.cairo(),"δ",Anchor::nw);
871  parenthesise(surf, [&](Surface& surf){arguments[1][0]->render(surf);});
872  }
873  else
874  if (!arguments[0].empty() && arguments[0][0])
875  {
876  print(surf.cairo(),"δ",Anchor::nw);
877  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
878  }
879  else
880  print(surf.cairo(),"1",Anchor::nw);
881  }
882  else
883  print(surf.cairo(),"1",Anchor::nw);
884  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [55/76]

template<>
void MathDAG::OperationDAG< OperationType::le >::render ( Surface &  surf) const

Definition at line 887 of file equationDisplayRender.cc.

888  {
889  if ((!arguments.empty() && !arguments[0].empty() && arguments[0][0]) ||
890  (arguments.size()>1 && !arguments[1].empty() && arguments[1][0]))
891  {
892  OperationDAG<OperationType::lt> lt; lt.arguments=arguments;
893  OperationDAG<OperationType::eq> eq; eq.arguments=arguments;
894  lt.render(surf);
895  print(surf.cairo(),"+",Anchor::nw);
896  eq.render(surf);
897  }
898  else
899  print(surf.cairo(),"1",Anchor::nw);
900  }
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [56/76]

template<>
void MathDAG::OperationDAG< OperationType::min >::render ( Surface &  surf) const

Definition at line 904 of file equationDisplayRender.cc.

905  {
906  if (!arguments.empty())
907  {
908  print(surf.cairo(),"min",Anchor::nw);
909  parenthesise(surf, [&](Surface& surf){
910  naryRender(surf,arguments[0],BODMASlevel(),",","∞");
911  if (!arguments[1].empty())
912  {
913  print(surf.cairo(),",",Anchor::nw);
914  naryRender(surf,arguments[1],BODMASlevel(),",","∞");
915  }
916  });
917  }
918  else
919  print(surf.cairo(),"∞",Anchor::nw);
920  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [57/76]

template<>
void MathDAG::OperationDAG< OperationType::max >::render ( Surface &  surf) const

Definition at line 923 of file equationDisplayRender.cc.

924  {
925  if (!arguments.empty())
926  {
927  print(surf.cairo(),"max",Anchor::nw);
928  parenthesise(surf, [&](Surface& surf){
929  naryRender(surf,arguments[0],BODMASlevel(),",","-∞");
930  if (!arguments[1].empty())
931  {
932  print(surf.cairo(),",",Anchor::nw);
933  naryRender(surf,arguments[1],BODMASlevel(),",","-∞");
934  }
935  });
936  }
937  else
938  print(surf.cairo(),"-∞",Anchor::nw);
939  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [58/76]

template<>
void MathDAG::OperationDAG< OperationType::and_ >::render ( Surface &  surf) const

Definition at line 942 of file equationDisplayRender.cc.

943  {
944  if (!arguments.empty())
945  {
946  naryRender(surf,arguments[0],BODMASlevel(),"∧","1");
947  if (!arguments[1].empty())
948  {
949  print(surf.cairo(),"∧",Anchor::nw);
950  naryRender(surf,arguments[0],BODMASlevel(),"∧","1");
951  }
952  }
953  else
954  print(surf.cairo(),"1",Anchor::nw);
955  }
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [59/76]

template<>
void MathDAG::OperationDAG< OperationType::or_ >::render ( Surface &  surf) const

Definition at line 959 of file equationDisplayRender.cc.

960  {
961  if (!arguments.empty())
962  {
963  naryRender(surf,arguments[0],BODMASlevel(),"∨","0");
964  if (!arguments[1].empty())
965  {
966  print(surf.cairo(),"∨",Anchor::nw);
967  naryRender(surf,arguments[0],BODMASlevel(),"∨","0");
968  }
969  }
970  else
971  print(surf.cairo(),"0",Anchor::nw);
972  }
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [60/76]

template<>
void MathDAG::OperationDAG< OperationType::not_ >::render ( Surface &  surf) const

Definition at line 975 of file equationDisplayRender.cc.

976  {
977  if (!arguments.empty())
978  {
979  if (!arguments[0].empty() && arguments[0][0])
980  {
981  print(surf.cairo(),"¬",Anchor::nw);
982  parenthesise(surf, [&](Surface& surf){
983  arguments[0][0]->render(surf);
984  });
985  }
986  else
987  print(surf.cairo(),"0",Anchor::nw);
988  }
989  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [61/76]

template<>
void MathDAG::OperationDAG< OperationType::covariance >::render ( Surface &  surf) const

Definition at line 992 of file equationDisplayRender.cc.

993  {
994  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
995  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
996  {
997  print(surf.cairo(),"cov",Anchor::nw);
998  parenthesise(surf, [&](Surface& surf){
999  arguments[0][0]->render(surf);
1000  print(surf.cairo(),",",Anchor::nw);
1001  arguments[0][1]->render(surf);
1002  });
1003  }
1004  else
1005  print(surf.cairo(),"0",Anchor::nw);
1006  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [62/76]

template<>
void MathDAG::OperationDAG< OperationType::correlation >::render ( Surface &  surf) const

Definition at line 1009 of file equationDisplayRender.cc.

1010  {
1011  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
1012  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
1013  {
1014  print(surf.cairo(),"ρ",Anchor::nw);
1015  parenthesise(surf, [&](Surface& surf){
1016  arguments[0][0]->render(surf);
1017  print(surf.cairo(),",",Anchor::nw);
1018  arguments[0][1]->render(surf);
1019  });
1020  }
1021  else
1022  print(surf.cairo(),"0",Anchor::nw);
1023  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [63/76]

template<>
void MathDAG::OperationDAG< OperationType::linearRegression >::render ( Surface &  surf) const

Definition at line 1026 of file equationDisplayRender.cc.

1027  {
1028  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
1029  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
1030  {
1031  print(surf.cairo(),"linReg",Anchor::nw);
1032  parenthesise(surf, [&](Surface& surf){
1033  arguments[0][0]->render(surf);
1034  print(surf.cairo(),",",Anchor::nw);
1035  arguments[0][1]->render(surf);
1036  });
1037  }
1038  else
1039  print(surf.cairo(),"0",Anchor::nw);
1040  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [64/76]

template<>
void MathDAG::OperationDAG< OperationType::size >::render ( Surface &  surf) const

Definition at line 1043 of file equationDisplayRender.cc.

1044  {
1045  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
1046  {
1047  print(surf.cairo(),"dim",Anchor::nw);
1048  parenthesise(surf, [&](Surface& surf){
1049  arguments[0][0]->render(surf);
1050  print(surf.cairo(),",i",Anchor::nw); // TODO - can we extract the actual argument here?
1051  });
1052  }
1053  else
1054  print(surf.cairo(),"0",Anchor::nw);
1055  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [65/76]

template<>
void MathDAG::OperationDAG< OperationType::shape >::render ( Surface &  surf) const

Definition at line 1058 of file equationDisplayRender.cc.

1059  {
1060  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
1061  {
1062  print(surf.cairo(),"shape",Anchor::nw);
1063  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
1064  }
1065  else
1066  print(surf.cairo(),"0",Anchor::nw);
1067  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [66/76]

template<>
void MathDAG::OperationDAG< OperationType::mean >::render ( Surface &  surf) const

Definition at line 1070 of file equationDisplayRender.cc.

1071  {
1072  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
1073  {
1074  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);}, "&lt;","&gt;");
1075  }
1076  else
1077  print(surf.cairo(),"0",Anchor::nw);
1078  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [67/76]

template<>
void MathDAG::OperationDAG< OperationType::median >::render ( Surface &  surf) const

Definition at line 1081 of file equationDisplayRender.cc.

1082  {
1083  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
1084  {
1085  print(surf.cairo(),"median",Anchor::nw);
1086  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
1087  }
1088  else
1089  print(surf.cairo(),"0",Anchor::nw);
1090  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [68/76]

template<>
void MathDAG::OperationDAG< OperationType::stdDev >::render ( Surface &  surf) const

Definition at line 1093 of file equationDisplayRender.cc.

1094  {
1095  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
1096  {
1097  print(surf.cairo(),"σ",Anchor::nw);
1098  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
1099  }
1100  else
1101  print(surf.cairo(),"0",Anchor::nw);
1102  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [69/76]

template<>
void MathDAG::OperationDAG< OperationType::moment >::render ( Surface &  surf) const

Definition at line 1105 of file equationDisplayRender.cc.

1106  {
1107  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
1108  {
1109  parenthesise(surf, [&](Surface& surf){
1110  print(surf.cairo(),"Δ",Anchor::nw);
1111  parenthesise(surf,[&](Surface& surf){arguments[0][0]->render(surf);});
1112 
1113  RecordingSurface base;
1114  arguments[0][0]->render(base);
1115  cairo_rel_move_to(surf.cairo(), 0, -0.5*base.height());
1116  print(surf.cairo(),"k",Anchor::nw); // TODO can we extract the actual exponent here?
1117  cairo_rel_move_to(surf.cairo(), 0, 0.5*base.height());
1118  },"&lt;","&gt;");
1119  }
1120  else
1121  print(surf.cairo(),"0",Anchor::nw);
1122  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [70/76]

template<>
void MathDAG::OperationDAG< OperationType::histogram >::render ( Surface &  surf) const

Definition at line 1125 of file equationDisplayRender.cc.

1126  {
1127  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
1128  {
1129  print(surf.cairo(),"histogram",Anchor::nw);
1130  parenthesise(surf, [&](Surface& surf){arguments[0][0]->render(surf);});
1131  }
1132  else
1133  print(surf.cairo(),"0",Anchor::nw);
1134  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [71/76]

template<>
void MathDAG::OperationDAG< OperationType::innerProduct >::render ( Surface &  surf) const

Definition at line 1139 of file equationDisplayRender.cc.

1140  {
1141  if (arguments.size()<2 || arguments[0].empty() || arguments[1].empty())
1142  throw error("incorrectly wired");
1143  parenthesise(surf, [&](Surface& surf){
1144  arguments[0][0]->render(surf);
1145  });
1146  print(surf.cairo(),"·",Anchor::nw);
1147  parenthesise(surf, [&](Surface& surf){
1148  arguments[1][0]->render(surf);
1149  });
1150  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [72/76]

template<>
void MathDAG::OperationDAG< OperationType::outerProduct >::render ( Surface &  surf) const

Definition at line 1153 of file equationDisplayRender.cc.

1154  {
1155  if (arguments.size()<2 || arguments[0].empty() || arguments[1].empty())
1156  throw error("incorrectly wired");
1157  parenthesise(surf, [&](Surface& surf){
1158  arguments[0][0]->render(surf);
1159  });
1160  print(surf.cairo(),"⊗",Anchor::nw);
1161  parenthesise(surf, [&](Surface& surf){
1162  arguments[1][0]->render(surf);
1163  });
1164  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [73/76]

template<>
void MathDAG::OperationDAG< OperationType::gather >::render ( Surface &  surf) const

Definition at line 1167 of file equationDisplayRender.cc.

1168  {
1169  if (arguments.size()<2 || arguments[0].empty() || arguments[1].empty())
1170  throw error("incorrectly wired");
1171  parenthesise(surf, [&](Surface& surf){
1172  arguments[0][0]->render(surf);});
1173  parenthesise(surf, [&](Surface& surf){
1174  arguments[1][0]->render(surf);},"[","]");
1175  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [74/76]

template<>
void MathDAG::OperationDAG< OperationType::meld >::render ( Surface &  surf) const

Definition at line 1178 of file equationDisplayRender.cc.

1179  {
1180  if (arguments.size()<2 || arguments[0].empty() || arguments[1].empty())
1181  throw error("incorrectly wired");
1182  print(surf.cairo(),"meld",Anchor::nw);
1183  parenthesise(surf, [&](Surface& surf){
1184  for (size_t i=0; i<arguments.size(); ++i)
1185  {
1186  naryRender(surf, arguments[i], BODMASlevel(),"","");
1187  if (i!=arguments.size()-1) print(surf.cairo(),",",Anchor::nw);
1188  }
1189  });
1190  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [75/76]

template<>
void MathDAG::OperationDAG< OperationType::merge >::render ( Surface &  surf) const

Definition at line 1193 of file equationDisplayRender.cc.

1194  {
1195  if (arguments.size()<2 || arguments[0].empty() || arguments[1].empty())
1196  throw error("incorrectly wired");
1197  print(surf.cairo(),"merge",Anchor::nw);
1198  parenthesise(surf, [&](Surface& surf){
1199  for (size_t i=0; i<arguments.size(); ++i)
1200  {
1201  naryRender(surf, arguments[i], BODMASlevel(),"","");
1202  if (i!=arguments.size()-1) print(surf.cairo(),",",Anchor::nw);
1203  }
1204  });
1205  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
void naryRender(Surface &dest, const vector< WeakNodePtr > &arglist, int BODMASlevel, const char *op, const char *empty)
int BODMASlevel() const override
algebraic heirarchy level, used for working out whether brackets are necessary.
Definition: equations.h:241
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219

◆ render() [76/76]

template<>
void MathDAG::OperationDAG< OperationType::slice >::render ( Surface &  surf) const

Definition at line 1208 of file equationDisplayRender.cc.

1209  {
1210  if (arguments.empty() || arguments[0].empty())
1211  throw error("incorrectly wired");
1212  print(surf.cairo(),"slice",Anchor::nw);
1213  parenthesise(surf, [&](Surface& surf){
1214  arguments[0][0]->render(surf);
1215  print(surf.cairo(),",",Anchor::nw);
1216  string slice="0";
1217  if (state)
1218  if (auto o=state->operationCast())
1219  slice=to_string(o->arg);
1220  print(surf.cairo(),slice,Anchor::nw);
1221  });
1222  }
double parenthesise(Surface &s, X x, const string &left="(", const string &right=")")
double print(cairo_t *cairo, const string &text, Anchor anchor)
vector< vector< WeakNodePtr > > arguments
Definition: equations.h:219
string to_string(CONST84 char *x)
Definition: minskyTCLObj.h:33

◆ type()

template<OperationType::Type T>
Type MathDAG::OperationDAG< T >::type ( ) const
inlineoverridevirtual

Implements MathDAG::OperationDAGBase.

Definition at line 238 of file equations.h.

238 {return T;}

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