26 #ifndef CASADI_SX_ELEMENT_HPP
27 #define CASADI_SX_ELEMENT_HPP
30 #include "printable.hpp"
31 #include "exception.hpp"
32 #include "casadi_limits.hpp"
33 #include "matrix_fwd.hpp"
34 #include "generic_expression.hpp"
35 #include "serializing_stream.hpp"
47 #ifdef CASADI_WITH_THREAD
49 #ifdef CASADI_WITH_THREAD_MINGW
50 #include <mingw.mutex.h>
77 friend class BinarySXNode;
106 static SXElem sym(
const std::string& name);
128 SXElem& operator=(
double scalar);
138 void disp(std::ostream& stream,
bool more=
false)
const;
150 const SXNode* operator->()
const;
158 bool unique_x=
false,
bool unique_y=
false);
159 static SXElem unary(casadi_int op,
const SXElem& x,
bool unique=
false);
160 static std::vector<SXElem> call(
const Function& f,
const std::vector<SXElem>& deps);
167 bool __nonzero__()
const;
174 bool is_leaf()
const;
175 bool is_constant()
const;
176 bool is_integer()
const;
177 bool is_symbolic()
const;
181 bool is_commutative()
const;
183 bool is_almost_zero(
double tol)
const;
185 bool is_minus_one()
const;
186 bool is_half()
const;
187 bool is_value(
double val)
const;
190 bool is_minus_inf()
const;
191 const std::string& name()
const;
192 casadi_int op()
const;
193 bool is_op(casadi_int op)
const;
194 bool is_call()
const;
195 bool is_output()
const;
196 bool has_output()
const;
198 casadi_int which_output()
const;
206 bool is_nonnegative()
const;
211 bool is_boolean()
const;
212 SXElem dep(casadi_int ch=0)
const;
215 explicit operator double()
const;
218 explicit operator casadi_int()
const;
223 bool is_doubled()
const;
228 casadi_int n_dep()
const;
233 SXElem get_output(casadi_int oind)
const;
236 std::vector<SXElem> get_output(
const std::vector<casadi_int>& oind)
const;
243 casadi_int __hash__()
const;
262 int get_temp()
const;
265 void set_temp(
int t)
const;
278 void assignIfDuplicate(
const SXElem& scalar, casadi_int depth=1);
307 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
308 static std::mutex mutex_temp;
321 static bool is_almost_zero(
const SXElem& val,
double tol);
322 static bool is_one(
const SXElem& val);
323 static bool is_minus_one(
const SXElem& val);
324 static bool is_half(
const SXElem& val);
325 static bool is_value(
const SXElem& val,
double v);
326 static bool is_nonnegative(
const SXElem& val);
327 static bool is_constant(
const SXElem& val);
328 static bool is_integer(
const SXElem& val);
329 static bool is_inf(
const SXElem& val);
330 static bool is_minus_inf(
const SXElem& val);
331 static bool is_nan(
const SXElem& val);
351 class CASADI_EXPORT numeric_limits<
casadi::SXElem>{
353 static const bool is_specialized =
true;
356 static const
int digits = 0;
357 static const
int digits10 = 0;
358 static const
bool is_signed = false;
359 static const
bool is_integer = false;
360 static const
bool is_exact = false;
361 static const
int radix = 0;
363 static
casadi::SXElem round_error() throw();
364 static const
int min_exponent = 0;
365 static const
int min_exponent10 = 0;
366 static const
int max_exponent = 0;
367 static const
int max_exponent10 = 0;
369 static const
bool has_infinity = true;
370 static const
bool has_quiet_NaN = true;
371 static const
bool has_signaling_NaN = false;
373 static const
bool has_denorm_loss = false;
374 static
casadi::SXElem infinity() throw();
375 static
casadi::SXElem quiet_NaN() throw();
378 static const
bool is_iec559 = false;
379 static const
bool is_bounded = false;
380 static const
bool is_modulo = false;
382 static const
bool traps = false;
383 static const
bool tinyness_before = false;
384 static const float_round_style round_style = round_toward_zero;
Helper class for Serialization.
Sparse matrix class. SX and DM are specializations.
Base class for objects that have a natural string representation.
The basic scalar symbolic class of CasADi.
friend SXElem if_else(const SXElem &x, const SXElem &y, const SXElem &z)
Ternary if_else: x ? y : z.
bool is_null()
SXElem nodes are not allowed to be null.
static std::string type_name()
Type name.
Internal node class for SX.
Helper class for Serialization.
static const SXElem minus_inf
static const SXElem minus_one
static casadi::SXElem min()
bool is_equal(double x, double y, casadi_int depth=0)
double if_else_zero(double x, double y)
Conditional assignment.
template class CASADI_EXPORT Matrix< SXElem >
bool is_regular(const std::vector< T > &v)
Checks if array does not contain NaN or Inf.