29 #include "matrix_decl.hpp"
44 SX SX::_sym(
const std::string& name,
const Sparsity& sp);
71 std::vector<SXElem>
SX::call(
const Function& f,
const std::vector<SXElem>& dep);
124 SX::substitute(
const std::vector<SX>& ex,
const std::vector<SX>& v,
const std::vector<SX>& vdef);
131 std::vector<SX>& ex,
bool reverse);
135 SX& expr_ret, std::vector<SX>& symbols, std::vector<SX>& parametric,
140 const SX &sym_lin,
const SX &sym_const,
141 SX& expr_const,
SX& expr_lin,
SX& expr_nonlin);
144 std::vector<SX>
SX::cse(
const std::vector<SX>& e);
163 std::vector<std::vector<SX> >
164 SX::forward(
const std::vector<SX> &ex,
const std::vector<SX> &arg,
165 const std::vector<std::vector<SX> > &v,
const Dict& opts);
168 std::vector<std::vector<SX> >
169 SX::reverse(
const std::vector<SX> &ex,
const std::vector<SX> &arg,
170 const std::vector<std::vector<SX> > &v,
const Dict& opts);
180 const SX& a, casadi_int order);
184 const std::vector<casadi_int>& order_contributions);
200 void SX::extract(std::vector<SX>& ex, std::vector<SX>& v_sx,
201 std::vector<SX>& vdef_sx,
const Dict& opts);
205 std::vector<SX>& v_sx,
206 std::vector<SX> & vdef_sx,
207 const std::string& v_prefix,
208 const std::string& v_suffix);
220 void SX::print_split(casadi_int nnz,
const SXElem* nonzeros, std::vector<std::string>& nz,
221 std::vector<std::string>& inter);
224 template<> std::vector<SX>
SX::get_free(
const Function& f);
230 const SXElem* nonzeros,
const std::string& format_hint);
232 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
234 std::mutex& SX::get_mutex_temp();
237 #ifndef CASADI_SX_INSTANTIATOR_CPP
casadi_int which_output() const
Get the index of evaluation output - only valid when is_output() is true.
static std::string print_operator(const Matrix< Scalar > &x, const std::vector< std::string > &args)
static std::vector< std::vector< Matrix< Scalar > > > reverse(const std::vector< Matrix< Scalar > > &ex, const std::vector< Matrix< Scalar > > &arg, const std::vector< std::vector< Matrix< Scalar > > > &v, const Dict &opts=Dict())
static Matrix< Scalar > simplify(const Matrix< Scalar > &x)
static void extract_parametric(const Matrix< Scalar > &expr, const Matrix< Scalar > &par, Matrix< Scalar > &expr_ret, std::vector< Matrix< Scalar > > &symbols, std::vector< Matrix< Scalar >> ¶metric, const Dict &opts)
static std::vector< bool > which_depends(const Matrix< Scalar > &expr, const Matrix< Scalar > &var, casadi_int order=1, bool tr=false)
void print_split(std::vector< std::string > &nz, std::vector< std::string > &inter) const
Get strings corresponding to the nonzeros and the interdependencies.
static void separate_linear(const Matrix< Scalar > &expr, const Matrix< Scalar > &sym_lin, const Matrix< Scalar > &sym_const, Matrix< Scalar > &expr_const, Matrix< Scalar > &expr_lin, Matrix< Scalar > &expr_nonlin)
bool is_smooth() const
Check if smooth.
static void set_max_depth(casadi_int eq_depth=1)
Set or reset the depth to which equalities are being checked for simplifications.
static std::vector< Matrix< Scalar > > get_input(const Function &f)
Get function input.
casadi_int n_dep() const
Get the number of dependencies of a binary SXElem.
static std::vector< Matrix< Scalar > > call(const Function &f, const std::vector< Matrix< Scalar > > &x)
Create nodes by their ID.
bool __nonzero__() const
Returns the truth value of a Matrix.
static std::vector< Matrix< Scalar > > symvar(const Matrix< Scalar > &x)
static std::vector< Matrix< Scalar > > get_free(const Function &f)
Get free.
static Matrix< Scalar > hessian(const Matrix< Scalar > &f, const Matrix< Scalar > &x, const Dict &opts=Dict())
static void shared(std::vector< Matrix< Scalar > > &ex, std::vector< Matrix< Scalar > > &v, std::vector< Matrix< Scalar > > &vdef, const std::string &v_prefix, const std::string &v_suffix)
bool has_duplicates() const
Detect duplicate symbolic expressions.
bool has_output() const
Check if a multiple output node.
casadi_int element_hash() const
Returns a number that is unique for a given symbolic scalar.
bool is_leaf() const
Check if SX is a leaf of the SX graph.
static casadi_int n_nodes(const Matrix< Scalar > &x)
static Matrix< Scalar > gauss_quadrature(const Matrix< Scalar > &f, const Matrix< Scalar > &x, const Matrix< Scalar > &a, const Matrix< Scalar > &b, casadi_int order=5)
static Matrix< Scalar > pw_lin(const Matrix< Scalar > &t, const Matrix< Scalar > &tval, const Matrix< Scalar > &val)
static Matrix< Scalar > taylor(const Matrix< Scalar > &ex, const Matrix< Scalar > &x, const Matrix< Scalar > &a, casadi_int order)
bool is_regular() const
Checks if expression does not contain NaN or Inf.
void to_file(const std::string &filename, const std::string &format="") const
Matrix< Scalar > get_output(casadi_int oind) const
Get an output.
static std::vector< std::vector< Matrix< Scalar > > > forward(const std::vector< Matrix< Scalar > > &ex, const std::vector< Matrix< Scalar > > &arg, const std::vector< std::vector< Matrix< Scalar > > > &v, const Dict &opts=Dict())
static void expand(const Matrix< Scalar > &x, Matrix< Scalar > &weights, Matrix< Scalar > &terms)
Matrix< Scalar > dep(casadi_int ch=0) const
Get expressions of the children of the expression.
static bool depends_on(const Matrix< Scalar > &x, const Matrix< Scalar > &arg)
void reset_input() const
Reset the marker for an input expression.
static Matrix< Scalar > _sym(const std::string &name, const Sparsity &sp)
bool is_symbolic() const
Check if symbolic (Dense)
static void substitute_inplace(const std::vector< Matrix< Scalar > > &v, std::vector< Matrix< Scalar > > &vdef, std::vector< Matrix< Scalar > > &ex, bool revers)
Function which_function() const
Get function - only valid when is_call() is true.
bool is_commutative() const
Check whether a binary SX is commutative.
static bool contains_any(const std::vector< Matrix< Scalar > > &v, const std::vector< Matrix< Scalar > > &n)
static Matrix< Scalar > substitute(const Matrix< Scalar > &ex, const Matrix< Scalar > &v, const Matrix< Scalar > &vdef)
static Matrix< Scalar > eig_symbolic(const Matrix< Scalar > &m)
static bool contains_all(const std::vector< Matrix< Scalar > > &v, const std::vector< Matrix< Scalar > > &n)
static void extract(std::vector< Matrix< Scalar >> &ex, std::vector< Matrix< Scalar >> &v, std::vector< Matrix< Scalar >> &vdef, const Dict &opts=Dict())
static std::vector< Matrix< Scalar > > cse(const std::vector< Matrix< Scalar > > &e)
casadi_int op() const
Get operation type.
bool is_output() const
Check if evaluation output.
bool is_valid_input() const
Check if matrix can be used to define function inputs.
bool is_call() const
Check if function call.
static Matrix< Scalar > jacobian(const Matrix< Scalar > &f, const Matrix< Scalar > &x, const Dict &opts=Dict())
static Matrix< Scalar > mtaylor(const Matrix< Scalar > &ex, const Matrix< Scalar > &x, const Matrix< Scalar > &a, casadi_int order)
std::string name() const
Get name (only if symbolic scalar)
static casadi_int get_max_depth()
Get the depth to which equalities are being checked for simplifications.
static Sparsity jacobian_sparsity(const Matrix< Scalar > &f, const Matrix< Scalar > &x)
static Matrix< Scalar > pw_const(const Matrix< Scalar > &t, const Matrix< Scalar > &tval, const Matrix< Scalar > &val)
static Matrix< Scalar > poly_coeff(const Matrix< Scalar > &ex, const Matrix< Scalar > &x)
static Matrix< Scalar > poly_roots(const Matrix< Scalar > &p)
bool is_op(casadi_int op) const
Is it a certain operation.
std::string matrixName< SXElem >()
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
template class CASADI_EXPORT Matrix< SXElem >
std::vector< T > reverse(const std::vector< T > &v)
Reverse a list.
std::string filename(const std::string &path)