List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends
casadi::OutputSX Class Reference

#include <output_sx.hpp>

Detailed Description

Definition at line 62 of file output_sx.hpp.

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

Public Types

using weak_ref_type = WeakRefInternalSXElem
 

Public Member Functions

 OutputSX (const SXElem &dep, int oind)
 Constructor. More...
 
 OutputSX ()
 Empty constructor. More...
 
std::string class_name () const override
 Get type name. More...
 
std::string print (const std::string &arg1, const std::string &arg2) const override
 Print expression. More...
 
 ~OutputSX () override
 Destructor. More...
 
casadi_int op () const override
 Get the operation. More...
 
casadi_int n_dep () const override
 Number of dependencies. 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...
 
bool is_output () const override
 Is the node an output node? More...
 
casadi_int which_output () const override
 Get the index of evaluation output. More...
 
void serialize_node (SerializingStream &s) const override
 
virtual const std::string & name () const
 
virtual Function which_function () const
 Get called function. 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 SXElem get_output (casadi_int oind) const
 Get an output. 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...
 
casadi_int getCount () const
 Get the reference count. More...
 
std::string debug_repr (const OutputSX *) const
 
GenericWeakRef< SharedSXElem, OutputSX > * weak ()
 Get a weak reference to the 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_op (casadi_int op) 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_call () const
 check properties of a node More...
 
virtual bool has_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 std::vector< SXElemsplit (const SXElem &e, casadi_int n)
 
static SXNodedeserialize (DeserializingStream &s)
 
static void safe_delete (SXNode *n)
 Non-recursive delete. More...
 

Public Attributes

SXElem dep_
 The dependencies of the node. More...
 
int oind_
 Output index. More...
 
int temp
 
unsigned int count
 

Static Public Attributes

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

Protected Member Functions

void initSingleton ()
 
void destroySingleton ()
 
shared_from_this ()
 Get a shared object from the current internal object. More...
 
const B shared_from_this () const
 Get a shared object from the current internal object. More...
 

Friends

class GenericShared< SharedSXElem, OutputSX >
 
class SharedObject
 
class GenericWeakRef< SharedSXElem, OutputSX >
 
class GenericSharedInternal< SharedSXElem, OutputSX >
 
class Memory
 
class UniversalNodeOwner
 

Member Typedef Documentation

◆ weak_ref_type

Definition at line 73 of file output_sx.hpp.

Constructor & Destructor Documentation

◆ OutputSX() [1/2]

casadi::OutputSX::OutputSX ( const SXElem dep,
int  oind 
)
inline

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

Definition at line 78 of file output_sx.hpp.

78  : dep_(dep), oind_(oind) {
79  }
const SXElem & dep(casadi_int i) const override
get the reference of a dependency
Definition: output_sx.hpp:116
SXElem dep_
The dependencies of the node.
Definition: output_sx.hpp:122
int oind_
Output index.
Definition: output_sx.hpp:127

◆ OutputSX() [2/2]

casadi::OutputSX::OutputSX ( )
inline

Definition at line 82 of file output_sx.hpp.

82  {
83 
84  }

◆ ~OutputSX()

casadi::OutputSX::~OutputSX ( )
inlineoverride

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

Definition at line 99 of file output_sx.hpp.

99  {
101  }
SXNode * assignNoDelete(const SXElem &scalar)
Assign the node to something, without invoking the deletion of the node,.
Definition: sx_elem.cpp:118
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::OutputSX::class_name ( ) const
inlineoverridevirtual

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

Implements casadi::SXNode.

Definition at line 87 of file output_sx.hpp.

87 {return "OutputSX";}

◆ debug_repr()

std::string casadi::GenericSharedInternal< SharedSXElem , OutputSX >::debug_repr ( const OutputSX i) const
inherited

Definition at line 62 of file generic_shared_internal.hpp.

162  {
163  // Note: i != this because of something something multiple inheritance
164  return str( (casadi_int)(i)) + "/" + static_cast<const Internal*>(this)->class_name();
165  }
std::string str(const T &v)
String representation, any type.

◆ dep() [1/2]

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

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

Reimplemented from casadi::SXNode.

Definition at line 116 of file output_sx.hpp.

116 { return dep_; }

◆ dep() [2/2]

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

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

Reimplemented from casadi::SXNode.

Definition at line 117 of file output_sx.hpp.

117 { return dep_; }

◆ deserialize()

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

Definition at line 152 of file output_sx.hpp.

152  {
153  SXElem dep;
154  int oind;
155  s.unpack("OutputSX::dep", dep);
156  s.unpack("OutputSX::oind", oind);
157  return new OutputSX(dep, oind);
158  }
OutputSX()
Empty constructor.
Definition: output_sx.hpp:82
friend class SXElem
Definition: sx_node.hpp:50

References casadi::DeserializingStream::unpack().

◆ destroySingleton()

void casadi::GenericSharedInternal< SharedSXElem , OutputSX >::destroySingleton ( )
inlineprotectedinherited

Called in the destructor of singletons

Definition at line 77 of file generic_shared_internal.hpp.

77  {
78  static_cast<Internal*>(this)->count--;
79  }

◆ 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().

◆ get_output()

SXElem casadi::SXNode::get_output ( casadi_int  oind) const
virtualinherited

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

Reimplemented in casadi::CallSX.

Definition at line 227 of file sx_node.cpp.

227  {
228  casadi_assert(oind==0, "Output index out of bounds");
229  return shared_from_this();
230  }
SXElem shared_from_this()
Get a shared object from the current internal object.
Definition: sx_node.cpp:261

References casadi::SXNode::shared_from_this().

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

◆ getCount()

casadi_int casadi::GenericSharedInternal< SharedSXElem , OutputSX >::getCount
inherited

Definition at line 60 of file generic_shared_internal.hpp.

186  {
187  return static_cast<const Internal*>(this)->count;
188  }

◆ has_output()

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

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

Reimplemented in casadi::CallSX.

Definition at line 82 of file sx_node.hpp.

82 { return false; }

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

◆ initSingleton()

void casadi::GenericSharedInternal< SharedSXElem , OutputSX >::initSingleton ( )
inlineprotectedinherited

Called in the constructor of singletons to avoid that the counter reaches zero

Definition at line 71 of file generic_shared_internal.hpp.

71  {
72  casadi_assert_dev(static_cast<Internal*>(this)->count==0);
73  static_cast<Internal*>(this)->count++;
74  }

◆ 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()

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

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

Reimplemented in casadi::CallSX.

Definition at line 80 of file sx_node.hpp.

80 { return false; }

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

◆ 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()

virtual bool casadi::SXNode::is_op ( casadi_int  op) const
inlinevirtualinherited

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

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

Definition at line 73 of file sx_node.hpp.

73 { return false; }

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

◆ is_output()

bool casadi::OutputSX::is_output ( ) const
inlineoverridevirtual

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

Reimplemented from casadi::SXNode.

Definition at line 132 of file output_sx.hpp.

132 { return true; }

◆ 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::OutputSX::n_dep ( ) const
inlineoverridevirtual

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

Reimplemented from casadi::SXNode.

Definition at line 111 of file output_sx.hpp.

111 { return 1;}

◆ 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::OutputSX::op ( ) const
inlineoverridevirtual

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

Implements casadi::SXNode.

Definition at line 106 of file output_sx.hpp.

106 { return -1;}

◆ print()

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

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

Implements casadi::SXNode.

Definition at line 92 of file output_sx.hpp.

92  {
93  return arg1 + "{" + str(oind_) + "}";
94  }

References casadi::str().

◆ 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  }
const std::string & name() const
Name of the function.
Definition: function.cpp:1307
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.
@ OP_CALL
Definition: calculus.hpp:88

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::OutputSX::serialize_node ( SerializingStream s) const
inlineoverridevirtual

Reimplemented from casadi::SXNode.

Definition at line 147 of file output_sx.hpp.

147  {
148  s.pack("OutputSX::dep", dep_);
149  s.pack("OutputSX::oind", oind_);
150  }

References casadi::SerializingStream::pack().

◆ shared_from_this() [1/4]

B casadi::GenericSharedInternal< SharedSXElem , OutputSX >::shared_from_this ( )
inlineprotectedinherited

Definition at line 83 of file generic_shared_internal.hpp.

83  {
84  casadi_assert_dev(B::test_cast(static_cast<Internal*>(this)));
85  B ret;
86  ret.own(static_cast<Internal*>(this));
87  return ret;
88  }

◆ shared_from_this() [2/4]

SXElem casadi::SXNode::shared_from_this ( )
inherited

Definition at line 261 of file sx_node.cpp.

261  {
262  return SXElem(this, false);
263  }

References casadi::SXNode::SXElem.

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

◆ shared_from_this() [3/4]

const B casadi::GenericSharedInternal< SharedSXElem , OutputSX >::shared_from_this ( ) const
inlineprotectedinherited

Definition at line 92 of file generic_shared_internal.hpp.

92  {
93  casadi_assert_dev(B::test_cast(static_cast<const Internal*>(this)));
94  B ret;
95  ret.own(const_cast<Internal*>(static_cast<const Internal*>(this)));
96  return ret;
97  }

◆ shared_from_this() [4/4]

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.

◆ split()

static std::vector<SXElem> casadi::OutputSX::split ( const SXElem e,
casadi_int  n 
)
inlinestatic

Definition at line 139 of file output_sx.hpp.

139  {
140  std::vector<SXElem> ret(n);
141  for (casadi_int i=0;i<n;++i) {
142  ret[i] = e.get_output(i);
143  }
144  return ret;
145  }

References casadi::SXElem::get_output().

Referenced by casadi::SXElem::call(), and casadi::SXFunction::eval_sx().

◆ 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().

◆ weak()

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

Definition at line 67 of file generic_shared_internal.hpp.

191  {
192  if (weak_ref_==nullptr) {
193  weak_ref_ = new GenericWeakRef<Shared, Internal>(static_cast<Internal*>(this));
194  }
195  return weak_ref_;
196  }

◆ which_function()

Function casadi::SXNode::which_function ( ) const
virtualinherited

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

Reimplemented in casadi::CallSX.

Definition at line 64 of file sx_node.cpp.

64  {
65  casadi_error("'which_function' not defined for class " + class_name());
66  }

References casadi::SXNode::class_name().

Referenced by casadi::SXNode::print_compact(), and casadi::SXElem::which_function().

◆ which_output()

casadi_int casadi::OutputSX::which_output ( ) const
inlineoverridevirtual

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

Reimplemented from casadi::SXNode.

Definition at line 137 of file output_sx.hpp.

137 { return oind_; }

Friends And Related Function Documentation

◆ GenericShared< SharedSXElem, OutputSX >

friend class GenericShared< SharedSXElem, OutputSX >
friend

Definition at line 56 of file output_sx.hpp.

◆ GenericSharedInternal< SharedSXElem, OutputSX >

friend class GenericSharedInternal< SharedSXElem, OutputSX >
friend

Definition at line 66 of file output_sx.hpp.

◆ GenericWeakRef< SharedSXElem, OutputSX >

friend class GenericWeakRef< SharedSXElem, OutputSX >
friend

Definition at line 66 of file output_sx.hpp.

◆ Memory

friend class Memory
friend

Definition at line 69 of file output_sx.hpp.

◆ SharedObject

friend class SharedObject
friend

Definition at line 66 of file output_sx.hpp.

◆ UniversalNodeOwner

friend class UniversalNodeOwner
friend

Definition at line 70 of file output_sx.hpp.

Member Data Documentation

◆ count

unsigned int casadi::SXNode::count
inherited

◆ dep_

SXElem casadi::OutputSX::dep_

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

Definition at line 122 of file output_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

◆ oind_

int casadi::OutputSX::oind_

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

Definition at line 127 of file output_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: