List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes
casadi::CallSX Class Reference

#include <call_sx.hpp>

Detailed Description

Definition at line 42 of file call_sx.hpp.

Inheritance diagram for casadi::CallSX:
Inheritance graph
[legend]
Collaboration diagram for casadi::CallSX:
Collaboration graph
[legend]

Public Member Functions

 ~CallSX () override
 Destructor. More...
 
std::string class_name () const override
 Get type name. More...
 
bool is_op (casadi_int op) const override
 check properties of a node More...
 
casadi_int n_dep () const override
 Number of dependencies. More...
 
SXElem get_output (casadi_int oind) const override
 Get an output. More...
 
const SXElemdep (casadi_int i) const override
 get the reference of a dependency More...
 
SXElemdep (casadi_int i) override
 get the reference of a child More...
 
casadi_int op () const override
 Get the operation. More...
 
bool is_call () const override
 Check if call node. More...
 
bool has_output () const override
 Check if a multiple output node. More...
 
Function which_function () const override
 Get function. More...
 
std::string print (const std::string &arg1, const std::string &arg2) const override
 Print expression. More...
 
void serialize_node (SerializingStream &s) const override
 
virtual const std::string & name () const
 
virtual casadi_int which_output () const
 Get function output. More...
 
virtual bool is_equal (const SXNode *node, casadi_int depth) const
 Check if two nodes are equivalent up to a given depth. More...
 
virtual bool is_smooth () const
 Check if smooth. More...
 
virtual void disp (std::ostream &stream, bool more) const
 print More...
 
void can_inline (std::map< const SXNode *, casadi_int > &nodeind) const
 Find out which nodes can be inlined. More...
 
std::string print_compact (std::map< const SXNode *, casadi_int > &nodeind, std::vector< std::string > &intermed) const
 Print compact. More...
 
bool marked () const
 
void mark () const
 
SXElem shared_from_this ()
 Get a shared object from the current internal object. More...
 
const SXElem shared_from_this () const
 Get a shared object from the current internal object. More...
 
void serialize (SerializingStream &s) const
 Serialize an object. More...
 
virtual bool is_constant () const
 check properties of a node More...
 
virtual bool is_integer () const
 check properties of a node More...
 
virtual bool is_symbolic () const
 check properties of a node More...
 
virtual bool is_zero () const
 check properties of a node More...
 
virtual bool is_almost_zero (double tol) const
 check properties of a node More...
 
virtual bool is_one () const
 check properties of a node More...
 
virtual bool is_minus_one () const
 check properties of a node More...
 
virtual bool is_nan () const
 check properties of a node More...
 
virtual bool is_inf () const
 check properties of a node More...
 
virtual bool is_minus_inf () const
 check properties of a node More...
 
virtual bool is_output () const
 check properties of a node More...
 
virtual double to_double () const
 Get value of a constant node. More...
 
virtual casadi_int to_int () const
 Get value of a constant node. More...
 

Static Public Member Functions

static SXElem create (const Function &f, const std::vector< SXElem > &dep)
 Create a binary expression. More...
 
static int eval_sx (const Function &f, const SXElem **arg, SXElem **res)
 
static SXNodedeserialize (DeserializingStream &s)
 
static void safe_delete (SXNode *n)
 Non-recursive delete. More...
 

Public Attributes

Function f_
 
std::vector< SXElemdep_
 The dependencies of the node. More...
 
int temp
 
unsigned int count
 

Static Public Attributes

static casadi_int eq_depth_ = 1
 
static std::map< casadi_int, SXNode *(*)(DeserializingStream &)> deserialize_map
 

Constructor & Destructor Documentation

◆ ~CallSX()

casadi::CallSX::~CallSX ( )
inlineoverride

This is a rather complex destructor which is necessary since the default destructor can cause stack overflow due to recursive calling.

Extra doc: https://github.com/casadi/casadi/wiki/L_28q 

Definition at line 88 of file call_sx.hpp.

88  {
89  for (auto & d : dep_)
90  safe_delete(d.assignNoDelete(casadi_limits<SXElem>::nan));
91  }
std::vector< SXElem > dep_
The dependencies of the node.
Definition: call_sx.hpp:154
static void safe_delete(SXNode *n)
Non-recursive delete.
Definition: sx_node.cpp:184
static const SXElem nan
Definition: sx_elem.hpp:323

Member Function Documentation

◆ can_inline()

void casadi::SXNode::can_inline ( std::map< const SXNode *, casadi_int > &  nodeind) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_a6

Definition at line 113 of file sx_node.cpp.

113  {
114  // Add or mark node in map
115  std::map<const SXNode*, casadi_int>::iterator it=nodeind.find(this);
116  if (it==nodeind.end()) {
117  // First time encountered, mark inlined
118  nodeind.insert(it, std::make_pair(this, 0));
119 
120  // Handle dependencies with recursion
121  for (casadi_int i=0; i<n_dep(); ++i) {
122  dep(i)->can_inline(nodeind);
123  }
124  } else if (it->second==0 && op()!=OP_PARAMETER) {
125  // Node encountered before, do not inline (except if symbolic primitive)
126  it->second = -1;
127  }
128  }
virtual const SXElem & dep(casadi_int i) const
get the reference of a child
Definition: sx_node.cpp:80
virtual casadi_int n_dep() const
Number of dependencies.
Definition: sx_node.hpp:124
virtual casadi_int op() const =0
get the operation
void can_inline(std::map< const SXNode *, casadi_int > &nodeind) const
Find out which nodes can be inlined.
Definition: sx_node.cpp:113
@ OP_PARAMETER
Definition: calculus.hpp:85

References casadi::SXNode::can_inline(), casadi::SXNode::dep(), casadi::SXNode::n_dep(), casadi::SXNode::op(), and casadi::OP_PARAMETER.

Referenced by casadi::SXNode::can_inline(), and casadi::SXNode::disp().

◆ class_name()

std::string casadi::CallSX::class_name ( ) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_9y

Implements casadi::SXNode.

Definition at line 94 of file call_sx.hpp.

94 {return "CallSX";}

◆ create()

static SXElem casadi::CallSX::create ( const Function f,
const std::vector< SXElem > &  dep 
)
inlinestatic

Extra doc: https://github.com/casadi/casadi/wiki/L_28p

Definition at line 57 of file call_sx.hpp.

57  {
58  casadi_assert(f.nnz_in()==dep.size(),
59  "CallSX::create(f,dep): dimension mismatch: " + str(f.nnz_in()) + " vs " + str(dep.size()));
60  return SXElem::create(new CallSX(f, dep));
61  }
const SXElem & dep(casadi_int i) const override
get the reference of a dependency
Definition: call_sx.hpp:119
static SXElem create(SXNode *node)
Definition: sx_elem.cpp:62
std::string str(const T &v)
String representation, any type.

References casadi::SXElem::create(), casadi::Function::nnz_in(), and casadi::str().

Referenced by casadi::SXElem::call().

◆ dep() [1/2]

const SXElem& casadi::CallSX::dep ( casadi_int  i) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28t

Reimplemented from casadi::SXNode.

Definition at line 119 of file call_sx.hpp.

119 { return dep_[i];}

Referenced by casadi::SXFunction::ad_forward(), and casadi::SXFunction::ad_reverse().

◆ dep() [2/2]

SXElem& casadi::CallSX::dep ( casadi_int  i)
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_a3

Reimplemented from casadi::SXNode.

Definition at line 120 of file call_sx.hpp.

120 { return dep_[i];}

◆ deserialize()

static SXNode* casadi::CallSX::deserialize ( DeserializingStream s)
inlinestatic

Definition at line 161 of file call_sx.hpp.

161  {
162  std::vector<SXElem> dep;
163  Function f;
164  s.unpack("CallSX::f", f);
165  s.unpack("CallSX::dep", dep);
166  return new CallSX(f, dep);
167  }

References casadi::DeserializingStream::unpack().

◆ disp()

void casadi::SXNode::disp ( std::ostream &  stream,
bool  more 
) const
virtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_a5

Definition at line 88 of file sx_node.cpp.

88  {
89  // Find out which noded can be inlined
90  std::map<const SXNode*, casadi_int> nodeind;
91  can_inline(nodeind);
92 
93  // Print expression
94  std::vector<std::string> intermed;
95  std::string s = print_compact(nodeind, intermed);
96 
97  // Print intermediate expressions
98  for (casadi_int i=0; i<intermed.size(); ++i)
99  stream << "@" << (i+1) << "=" << intermed[i] << ", ";
100 
101  // Print this
102  stream << s;
103  }
std::string print_compact(std::map< const SXNode *, casadi_int > &nodeind, std::vector< std::string > &intermed) const
Print compact.
Definition: sx_node.cpp:130

References casadi::SXNode::can_inline(), and casadi::SXNode::print_compact().

Referenced by casadi::SXElem::disp().

◆ eval_sx()

static int casadi::CallSX::eval_sx ( const Function f,
const SXElem **  arg,
SXElem **  res 
)
inlinestatic

Definition at line 63 of file call_sx.hpp.

63  {
64  // Collect dep from arg
65  std::vector<SXElem> dep;
66  for (casadi_int i=0;i<f.n_in();++i) {
67  dep.insert(dep.end(), arg[i], arg[i]+f.nnz_in(i));
68  }
69 
70  std::vector<SXElem> ret = SXElem::call(f, dep);
71 
72  // Copy ret to res
73  casadi_int offset = 0;
74  for (casadi_int i=0;i<f.n_out();++i) {
75  casadi_copy(get_ptr(ret)+offset, f.nnz_out(i), res[i]);
76  offset += f.nnz_out(i);
77  }
78 
79  return 0;
80  }
static std::vector< SXElem > call(const Function &f, const std::vector< SXElem > &deps)
Definition: sx_elem.cpp:403
void casadi_copy(const T1 *x, casadi_int n, T1 *y)
COPY: y <-x.
T * get_ptr(std::vector< T > &v)
Get a pointer to the data contained in the vector.

References casadi::SXElem::call(), casadi::casadi_copy(), casadi::get_ptr(), casadi::Function::n_in(), casadi::Function::n_out(), casadi::Function::nnz_in(), and casadi::Function::nnz_out().

Referenced by casadi::FunctionInternal::eval_sx().

◆ get_output()

SXElem casadi::CallSX::get_output ( casadi_int  oind) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28s

Reimplemented from casadi::SXNode.

Definition at line 106 of file call_sx.hpp.

106  {
107  SharedSXElem ret;
108  // If not found, add it,
109  if (!cache_.incache(oind, ret)) {
110  ret.own(new OutputSX(SXNode::shared_from_this(), oind));
111  cache_.tocache_if_missing(oind, ret);
112  }
113  return SXElem::create(ret.get());
114  }
SXElem shared_from_this()
Get a shared object from the current internal object.
Definition: sx_node.cpp:261

References casadi::SXElem::create(), casadi::GenericShared< Shared, Internal >::get(), casadi::WeakCache< K, T >::incache(), casadi::GenericShared< Shared, Internal >::own(), casadi::SXNode::shared_from_this(), and casadi::WeakCache< K, T >::tocache_if_missing().

Referenced by casadi::SXFunction::ad_forward(), and casadi::SXFunction::ad_reverse().

◆ has_output()

bool casadi::CallSX::has_output ( ) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28w

Reimplemented from casadi::SXNode.

Definition at line 135 of file call_sx.hpp.

135 { return true; }

◆ is_almost_zero()

virtual bool casadi::SXNode::is_almost_zero ( double  tol) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::ZeroSX, and casadi::RealtypeSX.

Definition at line 74 of file sx_node.hpp.

74 { return false; }

Referenced by casadi::SXElem::is_almost_zero().

◆ is_call()

bool casadi::CallSX::is_call ( ) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28v

Reimplemented from casadi::SXNode.

Definition at line 130 of file call_sx.hpp.

130 { return true; }

◆ is_constant()

virtual bool casadi::SXNode::is_constant ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::ConstantSX.

Definition at line 69 of file sx_node.hpp.

69 { return false; }

Referenced by casadi::SXElem::binary(), casadi::SXFunction::init(), and casadi::SXElem::is_constant().

◆ is_equal()

bool casadi::SXNode::is_equal ( const SXNode node,
casadi_int  depth 
) const
virtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_a0

Reimplemented in casadi::UnarySX, casadi::ConstantSX, and casadi::BinarySX.

Definition at line 72 of file sx_node.cpp.

72  {
73  return false;
74  }

Referenced by casadi::SXElem::is_equal().

◆ is_inf()

virtual bool casadi::SXNode::is_inf ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::InfSX.

Definition at line 78 of file sx_node.hpp.

78 { return false; }

Referenced by casadi::SXElem::is_inf().

◆ is_integer()

virtual bool casadi::SXNode::is_integer ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::MinusOneSX, casadi::OneSX, casadi::ZeroSX, and casadi::IntegerSX.

Definition at line 70 of file sx_node.hpp.

70 { return false; }

Referenced by casadi::SXElem::binary(), and casadi::SXElem::is_integer().

◆ is_minus_inf()

virtual bool casadi::SXNode::is_minus_inf ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::MinusInfSX.

Definition at line 79 of file sx_node.hpp.

79 { return false; }

Referenced by casadi::SXElem::is_minus_inf().

◆ is_minus_one()

virtual bool casadi::SXNode::is_minus_one ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::MinusOneSX.

Definition at line 76 of file sx_node.hpp.

76 { return false; }

Referenced by casadi::SXElem::binary(), and casadi::SXElem::is_minus_one().

◆ is_nan()

virtual bool casadi::SXNode::is_nan ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::NanSX.

Definition at line 77 of file sx_node.hpp.

77 { return false; }

Referenced by casadi::SXElem::is_nan().

◆ is_one()

virtual bool casadi::SXNode::is_one ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::OneSX.

Definition at line 75 of file sx_node.hpp.

75 { return false; }

Referenced by casadi::SXElem::binary(), and casadi::SXElem::is_one().

◆ is_op()

bool casadi::CallSX::is_op ( casadi_int  op) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented from casadi::SXNode.

Definition at line 96 of file call_sx.hpp.

96 { return OP_CALL==op; }
casadi_int op() const override
Get the operation.
Definition: call_sx.hpp:125
@ OP_CALL
Definition: calculus.hpp:88

References casadi::OP_CALL.

◆ is_output()

virtual bool casadi::SXNode::is_output ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::OutputSX.

Definition at line 81 of file sx_node.hpp.

81 { return false; }

Referenced by casadi::SXElem::is_output().

◆ is_smooth()

virtual bool casadi::SXNode::is_smooth ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_a4

Reimplemented in casadi::UnarySX, and casadi::BinarySX.

Definition at line 144 of file sx_node.hpp.

144 { return true; }

◆ is_symbolic()

virtual bool casadi::SXNode::is_symbolic ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::SymbolicSX.

Definition at line 71 of file sx_node.hpp.

71 { return false; }

Referenced by casadi::SXFunction::init(), and casadi::SXElem::is_symbolic().

◆ is_zero()

virtual bool casadi::SXNode::is_zero ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9w

Reimplemented in casadi::ZeroSX.

Definition at line 72 of file sx_node.hpp.

72 { return false; }

Referenced by casadi::SXElem::binary(), and casadi::SXElem::is_zero().

◆ mark()

void casadi::SXNode::mark ( ) const
inherited

Definition at line 109 of file sx_node.cpp.

109  {
110  temp = -temp-1;
111  }

References casadi::SXNode::temp.

◆ marked()

bool casadi::SXNode::marked ( ) const
inherited

Definition at line 105 of file sx_node.cpp.

105  {
106  return temp<0;
107  }

References casadi::SXNode::temp.

◆ n_dep()

casadi_int casadi::CallSX::n_dep ( ) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28r

Reimplemented from casadi::SXNode.

Definition at line 101 of file call_sx.hpp.

101 { return dep_.size();}

◆ name()

const std::string & casadi::SXNode::name ( ) const
virtualinherited

Reimplemented in casadi::SymbolicSX.

Definition at line 76 of file sx_node.cpp.

76  {
77  casadi_error("'name' not defined for " + class_name());
78  }
virtual std::string class_name() const =0
Get type name.

References casadi::SXNode::class_name().

Referenced by casadi::SXElem::name().

◆ op()

casadi_int casadi::CallSX::op ( ) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28u

Implements casadi::SXNode.

Definition at line 125 of file call_sx.hpp.

125 { return OP_CALL; }

References casadi::OP_CALL.

◆ print()

std::string casadi::CallSX::print ( const std::string &  arg1,
const std::string &  arg2 
) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28y

Implements casadi::SXNode.

Definition at line 145 of file call_sx.hpp.

145  {
146  return f_.name();
147  }
Function f_
Definition: call_sx.hpp:149
const std::string & name() const
Name of the function.
Definition: function.cpp:1307

◆ print_compact()

std::string casadi::SXNode::print_compact ( std::map< const SXNode *, casadi_int > &  nodeind,
std::vector< std::string > &  intermed 
) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_a7

Definition at line 130 of file sx_node.cpp.

131  {
132  // Get reference to node index
133  casadi_int& ind = nodeind[this];
134 
135  // If positive, already in intermediate expressions
136  if (ind>0) {
137  std::stringstream ss;
138  ss << "@" << ind;
139  return ss.str();
140  }
141 
142  std::string s;
143  if (op()==OP_CALL) {
144  const Function& f = which_function();
145  // Get expressions for dependencies
146  s = which_function().name() + "(";
147 
148  casadi_int k = 0;
149  for (casadi_int i=0; i<f.n_in(); ++i) {
150  if (f.nnz_in(i)>1) s += "[";
151  for (casadi_int j=0; j<f.nnz_in(i); ++j) {
152  s += dep(k++)->print_compact(nodeind, intermed);
153  if (j<f.nnz_in(i)-1) s+=",";
154  }
155  if (f.nnz_in(i)>1) s += "]";
156  if (i<f.n_in()-1) s+=",";
157  }
158  s += ")";
159  } else {
160  // Get expressions for dependencies
161  std::string arg[2];
162  for (casadi_int i=0; i<n_dep(); ++i) {
163  arg[i] = dep(i)->print_compact(nodeind, intermed);
164  }
165 
166  // Get expression for this
167  s = print(arg[0], arg[1]);
168  }
169 
170  // Decide what to do with the expression
171  if (ind==0) {
172  // Inline expression
173  return s;
174  } else {
175  // Add to list of intermediate expressions and return reference
176  intermed.push_back(s);
177  ind = intermed.size(); // For subsequent references
178  std::stringstream ss;
179  ss << "@" << ind;
180  return ss.str();
181  }
182  }
virtual Function which_function() const
Get called function.
Definition: sx_node.cpp:64
virtual std::string print(const std::string &arg1, const std::string &arg2) const =0
Print expression.

References casadi::SXNode::dep(), casadi::SXNode::n_dep(), casadi::Function::n_in(), casadi::Function::name(), casadi::Function::nnz_in(), casadi::SXNode::op(), casadi::OP_CALL, casadi::SXNode::print(), casadi::SXNode::print_compact(), and casadi::SXNode::which_function().

Referenced by casadi::SXNode::disp(), and casadi::SXNode::print_compact().

◆ safe_delete()

void casadi::SXNode::safe_delete ( SXNode n)
staticinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_a9

Definition at line 184 of file sx_node.cpp.

184  {
185  // Quick return if more owners
186  if (n->count>0) return;
187  // Delete straight away if it doesn't have any dependencies
188  if (!n->n_dep()) {
189  delete n;
190  return;
191  }
192  // Stack of expressions to be deleted
193  std::stack<SXNode*> deletion_stack;
194  // Add the node to the deletion stack
195  deletion_stack.push(n);
196  // Process stack
197  while (!deletion_stack.empty()) {
198  // Top element
199  SXNode *t = deletion_stack.top();
200  // Check if the top element has dependencies with dependencies
201  bool added_to_stack = false;
202  for (casadi_int c2=0; c2<t->n_dep(); ++c2) { // for all dependencies of the dependency
203  // Get the node of the dependency of the top element
204  // and remove it from the smart pointer
205  SXNode *n2 = t->dep(c2).assignNoDelete(casadi_limits<SXElem>::nan);
206  // Check if this is the only reference to the element
207  if (n2->count == 0) {
208  // Check if unary or binary
209  if (!n2->n_dep()) {
210  // Delete straight away if not binary
211  delete n2;
212  } else {
213  // Add to deletion stack
214  deletion_stack.push(n2);
215  added_to_stack = true;
216  }
217  }
218  }
219  // Delete and pop from stack if nothing added to the stack
220  if (!added_to_stack) {
221  delete deletion_stack.top();
222  deletion_stack.pop();
223  }
224  }
225  }
SXNode()
constructor
Definition: sx_node.cpp:40

References casadi::SXElem::assignNoDelete(), casadi::SXNode::count, casadi::SXNode::dep(), and casadi::SXNode::n_dep().

Referenced by casadi::BinarySX::~BinarySX(), and casadi::UnarySX::~UnarySX().

◆ serialize()

void casadi::SXNode::serialize ( SerializingStream s) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_aa

Definition at line 238 of file sx_node.cpp.

238  {
239  s.pack("SXNode::op", op());
240  serialize_node(s);
241  }
virtual void serialize_node(SerializingStream &s) const
Definition: sx_node.cpp:234

References casadi::SXNode::op(), casadi::SerializingStream::pack(), and casadi::SXNode::serialize_node().

◆ serialize_node()

void casadi::CallSX::serialize_node ( SerializingStream s) const
inlineoverridevirtual

Reimplemented from casadi::SXNode.

Definition at line 156 of file call_sx.hpp.

156  {
157  s.pack("CallSX::f", f_);
158  s.pack("CallSX::dep", dep_);
159  }

References casadi::SerializingStream::pack().

◆ shared_from_this() [1/2]

SXElem casadi::SXNode::shared_from_this ( )
inherited

Definition at line 261 of file sx_node.cpp.

261  {
262  return SXElem(this, false);
263  }
friend class SXElem
Definition: sx_node.hpp:50

References casadi::SXNode::SXElem.

Referenced by casadi::SXNode::get_output(), and get_output().

◆ shared_from_this() [2/2]

const SXElem casadi::SXNode::shared_from_this ( ) const
inherited

Definition at line 265 of file sx_node.cpp.

265  {
266  return SXElem(const_cast<SXNode*>(this), false);
267  }

References casadi::SXNode::SXElem.

◆ to_double()

double casadi::SXNode::to_double ( ) const
virtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9x

Reimplemented in casadi::ConstantSX, casadi::NanSX, casadi::MinusInfSX, casadi::InfSX, casadi::MinusOneSX, casadi::OneSX, casadi::ZeroSX, casadi::IntegerSX, and casadi::RealtypeSX.

Definition at line 56 of file sx_node.cpp.

56  {
57  return std::numeric_limits<double>::quiet_NaN();
58  }

Referenced by casadi::SXElem::binary(), and casadi::SXFunction::init().

◆ to_int()

casadi_int casadi::SXNode::to_int ( ) const
virtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_9x

Reimplemented in casadi::MinusOneSX, casadi::OneSX, casadi::ZeroSX, casadi::IntegerSX, and casadi::RealtypeSX.

Definition at line 60 of file sx_node.cpp.

60  {
61  casadi_error("to_int not defined for " + class_name());
62  }

References casadi::SXNode::class_name().

Referenced by casadi::SXElem::binary().

◆ which_function()

Function casadi::CallSX::which_function ( ) const
inlineoverridevirtual

Extra doc: https://github.com/casadi/casadi/wiki/L_28x

Reimplemented from casadi::SXNode.

Definition at line 140 of file call_sx.hpp.

140 { return f_; }

◆ which_output()

casadi_int casadi::SXNode::which_output ( ) const
virtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_292

Reimplemented in casadi::OutputSX.

Definition at line 68 of file sx_node.cpp.

68  {
69  casadi_error("'which_output' not defined for class " + class_name());
70  }

References casadi::SXNode::class_name().

Referenced by casadi::SXElem::which_output().

Member Data Documentation

◆ count

unsigned int casadi::SXNode::count
inherited

◆ dep_

std::vector<SXElem> casadi::CallSX::dep_

Extra doc: https://github.com/casadi/casadi/wiki/L_28z

Definition at line 154 of file call_sx.hpp.

◆ deserialize_map

std::map< casadi_int, SXNode *(*)(DeserializingStream &)> casadi::SXNode::deserialize_map
staticinherited
Initial value:
= {
static SXNode * deserialize(DeserializingStream &s)
Definition: call_sx.hpp:161
static SXNode * deserialize(DeserializingStream &s)
Definition: output_sx.hpp:152
static SXNode * deserialize(DeserializingStream &s)
Definition: symbolic_sx.hpp:77
SXNode * ConstantSX_deserialize(DeserializingStream &s)
@ OP_CONST
Definition: calculus.hpp:79

Definition at line 209 of file sx_node.hpp.

Referenced by casadi::SXNode::deserialize().

◆ eq_depth_

casadi_int casadi::SXNode::eq_depth_ = 1
staticinherited

◆ f_

Function casadi::CallSX::f_

Definition at line 149 of file call_sx.hpp.

◆ temp

int casadi::SXNode::temp
mutableinherited

Temporary variables to be used in user algorithms like sorting, the user is responsible of making sure that use is thread-safe The variable is initialized to zero

Definition at line 191 of file sx_node.hpp.

Referenced by casadi::SXFunction::init(), casadi::SXNode::mark(), casadi::SXNode::marked(), and casadi::SXNode::SXNode().


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