List of all members | Public Types | Public Member Functions | Static Public Member Functions | Friends
casadi::MX Class Reference

MX - Matrix expression. More...

#include <mx.hpp>

Detailed Description

The MX class is used to build up trees made up from MXNodes. It is a more general graph representation than the scalar expression, SX, and much less efficient for small objects. On the other hand, the class allows much more general operations than does SX, in particular matrix valued operations and calls to arbitrary differentiable functions.

The MX class is designed to have identical syntax with the Matrix<> template class, and uses DM (i.e. Matrix<double>) as its internal representation of the values at a node. By keeping the syntaxes identical, it is possible to switch from one class to the other, as well as inlining MX functions to SXElem functions.

Note that an operation is always "lazy", making a matrix multiplication will create a matrix multiplication node, not perform the actual multiplication.

Author
Joel Andersson
Date
2010-2011

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

Definition at line 80 of file mx.hpp.

Inheritance diagram for casadi::MX:
Inheritance graph
[legend]

Public Types

typedef std::map< std::string, MXMXDict
 Readability typedef. More...
 

Public Member Functions

 MX ()
 Default constructor. More...
 
 MX (casadi_int nrow, casadi_int ncol)
 Create a sparse matrix with all structural zeros. More...
 
 MX (const Sparsity &sp)
 Create a sparse matrix from a sparsity pattern. More...
 
 MX (const Sparsity &sp, const MX &val)
 Construct matrix with a given sparsity and nonzeros. More...
 
 MX (const Sparsity &sp, const std::string &fname)
 Construct matrix with a given sparsity and a file with nonzeros. More...
 
 MX (double x)
 Create scalar constant (also implicit type conversion) More...
 
 MX (const Matrix< double > &x)
 Create sparse matrix constant (also implicit type conversion) More...
 
bool __nonzero__ () const
 Returns the truth value of an MX expression. More...
 
Sparsity get_sparsity () const
 Get an owning reference to the sparsity pattern. More...
 
void erase (const std::vector< casadi_int > &rr, const std::vector< casadi_int > &cc, bool ind1=false)
 Erase a submatrix (leaving structural zeros in its place) More...
 
void erase (const std::vector< casadi_int > &rr, bool ind1=false)
 Erase a submatrix (leaving structural zeros in its place) More...
 
void enlarge (casadi_int nrow, casadi_int ncol, const std::vector< casadi_int > &rr, const std::vector< casadi_int > &cc, bool ind1=false)
 Enlarge matrix. More...
 
MX operator- () const
 
MX dep (casadi_int ch=0) const
 Get the nth dependency as MX. More...
 
casadi_int n_out () const
 Number of outputs. More...
 
MX get_output (casadi_int oind) const
 Get an output. More...
 
casadi_int n_dep () const
 Get the number of dependencies of a binary SXElem. More...
 
std::string name () const
 Get the name. More...
 
 operator double () const
 Get the value (only for scalar constant nodes) More...
 
 operator Matrix< double > () const
 Get the value (only for constant nodes) More...
 
bool is_symbolic () const
 Check if symbolic. More...
 
bool is_constant () const
 Check if constant. More...
 
bool is_call () const
 Check if evaluation. More...
 
Function which_function () const
 Get function - only valid when is_call() is true. More...
 
bool is_output () const
 Check if evaluation output. More...
 
casadi_int which_output () const
 Get the index of evaluation output - only valid when is_output() is true. More...
 
bool is_op (casadi_int op) const
 Is it a certain operation. More...
 
bool is_multiplication () const
 Check if multiplication. More...
 
bool is_commutative () const
 Check if commutative operation. More...
 
bool is_norm () const
 Check if norm. More...
 
bool is_valid_input () const
 Check if matrix can be used to define function inputs. More...
 
casadi_int n_primitives () const
 Get the number of primitives for MXFunction inputs/outputs. More...
 
std::vector< MXprimitives () const
 Get primitives. More...
 
bool is_eye () const
 check if identity More...
 
bool is_zero () const
 check if zero (note that false negative answers are possible) More...
 
bool is_one () const
 check if zero (note that false negative answers are possible) More...
 
bool is_minus_one () const
 check if zero (note that false negative answers are possible) More...
 
bool is_transpose () const
 Is the expression a transpose? More...
 
bool is_regular () const
 Checks if expression does not contain NaN or Inf. More...
 
bool is_binary () const
 Is binary operation. More...
 
bool is_unary () const
 Is unary operation. More...
 
casadi_int op () const
 Get operation type. More...
 
Dict info () const
 
void serialize (SerializingStream &s) const
 Serialize an object. More...
 
MX printme (const MX &b) const
 
MX attachAssert (const MX &y, const std::string &fail_message="") const
 returns itself, but with an assertion attached More...
 
MX monitor (const std::string &comment) const
 Monitor an expression. More...
 
MX T () const
 Transpose the matrix. More...
 
Matrix< casadi_int > mapping () const
 Get an IM representation of a GetNonzeros or SetNonzeros node. More...
 
void eval_mx (const std::vector< MX > &arg, std::vector< MX > &res) const
 Evaluate the MX node with new symbolic dependencies. More...
 
casadi_int nnz () const
 Get the number of (structural) non-zero elements. More...
 
casadi_int nnz_lower () const
 Get the number of non-zeros in the lower triangular half. More...
 
casadi_int nnz_upper () const
 Get the number of non-zeros in the upper triangular half. More...
 
casadi_int nnz_diag () const
 Get get the number of non-zeros on the diagonal. More...
 
casadi_int numel () const
 Get the number of elements. More...
 
casadi_int size1 () const
 Get the first dimension (i.e. number of rows) More...
 
casadi_int rows () const
 Get the number of rows, Octave-style syntax. More...
 
casadi_int size2 () const
 Get the second dimension (i.e. number of columns) More...
 
casadi_int columns () const
 Get the number of columns, Octave-style syntax. More...
 
std::string dim (bool with_nz=false) const
 Get string representation of dimensions. More...
 
std::pair< casadi_int, casadi_int > size () const
 Get the shape. More...
 
casadi_int size (casadi_int axis) const
 Get the size along a particular dimensions. More...
 
bool is_empty (bool both=false) const
 Check if the sparsity is empty, i.e. if one of the dimensions is zero. More...
 
bool is_dense () const
 Check if the matrix expression is dense. More...
 
bool is_scalar (bool scalar_and_dense=false) const
 Check if the matrix expression is scalar. More...
 
bool is_square () const
 Check if the matrix expression is square. More...
 
bool is_vector () const
 Check if the matrix is a row or column vector. More...
 
bool is_row () const
 Check if the matrix is a row vector (i.e. size1()==1) More...
 
bool is_column () const
 Check if the matrix is a column vector (i.e. size2()==1) More...
 
bool is_triu () const
 Check if the matrix is upper triangular. More...
 
bool is_tril () const
 Check if the matrix is lower triangular. More...
 
Sparsity sparsity () const
 Get the sparsity pattern. More...
 
std::string class_name () const
 Get class name. More...
 
void disp (std::ostream &stream, bool more=false) const
 Print a description of the object. More...
 
std::string get_str (bool more=false) const
 Get string representation. More...
 
bool is_null () const
 Is a null pointer? More...
 
casadi_int __hash__ () const
 Returns a number that is unique for a given Node. More...
 
std::vector< MXsplit_primitives (const MX &x) const
 Split up an expression along symbolic primitives. More...
 
std::vector< SXsplit_primitives (const SX &x) const
 Split up an expression along symbolic primitives. More...
 
std::vector< DMsplit_primitives (const DM &x) const
 Split up an expression along symbolic primitives. More...
 
MX join_primitives (const std::vector< MX > &v) const
 Join an expression along symbolic primitives. More...
 
SX join_primitives (const std::vector< SX > &v) const
 Join an expression along symbolic primitives. More...
 
DM join_primitives (const std::vector< DM > &v) const
 Join an expression along symbolic primitives. More...
 
void get (MX &m, bool ind1, const Slice &rr) const
 
void get (MX &m, bool ind1, const Matrix< casadi_int > &rr) const
 
void get (MX &m, bool ind1, const Sparsity &sp) const
 
void get (MX &m, bool ind1, const MX &rr) const
 
void get (MX &m, bool ind1, const casadi_int rr) const
 
void get (MX &m, bool ind1, const Slice &rr, const Slice &cc) const
 
void get (MX &m, bool ind1, const Slice &rr, const Matrix< casadi_int > &cc) const
 
void get (MX &m, bool ind1, const Slice &rr, casadi_int cc) const
 
void get (MX &m, bool ind1, const Matrix< casadi_int > &rr, const Slice &cc) const
 
void get (MX &m, bool ind1, casadi_int rr, const Slice &cc) const
 
void get (MX &m, bool ind1, const Matrix< casadi_int > &rr, const Matrix< casadi_int > &cc) const
 
void get (MX &m, bool ind1, casadi_int rr, casadi_int cc) const
 
void get (MX &m, bool ind1, const MX &rr, const Slice &cc) const
 
void get (MX &m, bool ind1, const Slice &rr, const MX &cc) const
 
void get (MX &m, bool ind1, const MX &rr, const MX &cc) const
 
void set (const MX &m, bool ind1, const Slice &rr)
 
void set (const MX &m, bool ind1, const Matrix< casadi_int > &rr)
 
void set (const MX &m, bool ind1, const Sparsity &sp)
 
void set (const MX &m, bool ind1, const Slice &rr, const Slice &cc)
 
void set (const MX &m, bool ind1, const Slice &rr, const Matrix< casadi_int > &cc)
 
void set (const MX &m, bool ind1, const Matrix< casadi_int > &rr, const Slice &cc)
 
void set (const MX &m, bool ind1, const Matrix< casadi_int > &rr, const Matrix< casadi_int > &cc)
 
void get_nz (MX &m, bool ind1, const Slice &kk) const
 
void get_nz (MX &m, bool ind1, const Matrix< casadi_int > &kk) const
 
void get_nz (MX &m, bool ind1, const MX &kk) const
 
void get_nz (MX &m, bool ind1, casadi_int kk) const
 
void get_nz (MX &m, bool ind1, const MX &inner, const Slice &outer) const
 
void get_nz (MX &m, bool ind1, const Slice &inner, const MX &outer) const
 
void get_nz (MX &m, bool ind1, const MX &inner, const MX &outer) const
 
void set_nz (const MX &m, bool ind1, const Slice &kk)
 
void set_nz (const MX &m, bool ind1, const Matrix< casadi_int > &kk)
 
void set_nz (const MX &m, bool ind1, const MX &kk)
 
void set_nz (const MX &m, bool ind1, casadi_int kk)
 
std::vector< casadi_int > get_row () const
 Get the sparsity pattern. See the Sparsity class for details. More...
 
std::vector< casadi_int > get_colind () const
 Get the sparsity pattern. See the Sparsity class for details. More...
 
casadi_int row (casadi_int el) const
 Get the sparsity pattern. See the Sparsity class for details. More...
 
casadi_int colind (casadi_int col) const
 Get the sparsity pattern. See the Sparsity class for details. More...
 

Static Public Member Functions

static std::string type_name ()
 Get type name. More...
 
static MX deserialize (DeserializingStream &s)
 Deserialize with type disambiguation. More...
 
static MX eye (casadi_int n)
 Identity matrix. More...
 
static DM bspline_dual (const std::vector< double > &x, const std::vector< std::vector< double > > &knots, const std::vector< casadi_int > &degree, const Dict &opts=Dict())
 
static MX interpn_linear (const std::vector< MX > &x, const MX &v, const std::vector< MX > &xq, const Dict &opts=Dict())
 Low-level access to inlined linear interpolation. More...
 
static void set_max_depth (casadi_int eq_depth=1)
 Set or reset the depth to which equalities are being checked for simplifications. More...
 
static casadi_int get_max_depth ()
 Get the depth to which equalities are being checked for simplifications. More...
 
static bool test_cast (const SharedObjectInternal *ptr)
 Check if a particular cast is allowed. More...
 
static std::vector< MXget_input (const Function &f)
 Get function inputs. More...
 
static std::vector< MXget_free (const Function &f)
 Get free variables. More...
 
static MX logsumexp (const MX &x)
 
static MX binary (casadi_int op, const MX &x, const MX &y)
 Create nodes by their ID. More...
 
static MX unary (casadi_int op, const MX &x)
 Create nodes by their ID. More...
 
static MX inf (const Sparsity &sp)
 create a matrix with all inf More...
 
static MX inf (casadi_int nrow=1, casadi_int ncol=1)
 create a matrix with all inf More...
 
static MX inf (const std::pair< casadi_int, casadi_int > &rc)
 create a matrix with all inf More...
 
static MX nan (const Sparsity &sp)
 create a matrix with all nan More...
 
static MX nan (casadi_int nrow=1, casadi_int ncol=1)
 create a matrix with all nan More...
 
static MX nan (const std::pair< casadi_int, casadi_int > &rc)
 create a matrix with all nan More...
 
static MX einstein (const MX &A, const MX &B, const MX &C, const std::vector< casadi_int > &dim_a, const std::vector< casadi_int > &dim_b, const std::vector< casadi_int > &dim_c, const std::vector< casadi_int > &a, const std::vector< casadi_int > &b, const std::vector< casadi_int > &c)
 Computes an einstein dense tensor contraction. More...
 
static MX einstein (const MX &A, const MX &B, const std::vector< casadi_int > &dim_a, const std::vector< casadi_int > &dim_b, const std::vector< casadi_int > &dim_c, const std::vector< casadi_int > &a, const std::vector< casadi_int > &b, const std::vector< casadi_int > &c)
 Computes an einstein dense tensor contraction. More...
 
static MX mpower (const MX &x, const MX &y)
 
static MX soc (const MX &x, const MX &y)
 
static MX linearize (const MX &f, const MX &x, const MX &x0, const Dict &opts=Dict())
 
static MX gradient (const MX &ex, const MX &arg, const Dict &opts=Dict())
 
static MX tangent (const MX &ex, const MX &arg, const Dict &opts=Dict())
 
static MX jtimes (const MX &ex, const MX &arg, const MX &v, bool tr=false, const Dict &opts=Dict())
 
static MX bilin (const MX &A, const MX &x, const MX &y)
 Calculate bilinear/quadratic form x^T A y. More...
 
static MX rank1 (const MX &A, const MX &alpha, const MX &x, const MX &y)
 Make a rank-1 update to a matrix A. More...
 
Construct symbolic primitives

The "sym" function is intended to work in a similar way as "sym" used in the Symbolic Toolbox for Matlab but instead creating a CasADi symbolic primitive.

static MX sym (const std::string &name, casadi_int nrow=1, casadi_int ncol=1)
 Create an nrow-by-ncol symbolic primitive. More...
 
static MX sym (const std::string &name, const std::pair< casadi_int, casadi_int > &rc)
 Construct a symbolic primitive with given dimensions. More...
 
static MX sym (const std::string &name, const Sparsity &sp)
 Create symbolic primitive with a given sparsity pattern. More...
 
static std::vector< MXsym (const std::string &name, const Sparsity &sp, casadi_int p)
 Create a vector of length p with with matrices. More...
 
static std::vector< MXsym (const std::string &name, casadi_int nrow, casadi_int ncol, casadi_int p)
 Create a vector of length p with nrow-by-ncol symbolic primitives. More...
 
static std::vector< std::vector< MX > > sym (const std::string &name, const Sparsity &sp, casadi_int p, casadi_int r)
 Create a vector of length r of vectors of length p with. More...
 
static std::vector< std::vector< MX > > sym (const std::string &name, casadi_int nrow, casadi_int ncol, casadi_int p, casadi_int r)
 Create a vector of length r of vectors of length p. More...
 
static MX zeros (casadi_int nrow=1, casadi_int ncol=1)
 Create a dense matrix or a matrix with specified sparsity with all entries zero. More...
 
static MX zeros (const Sparsity &sp)
 Create a dense matrix or a matrix with specified sparsity with all entries zero. More...
 
static MX zeros (const std::pair< casadi_int, casadi_int > &rc)
 Create a dense matrix or a matrix with specified sparsity with all entries zero. More...
 
static MX ones (casadi_int nrow=1, casadi_int ncol=1)
 Create a dense matrix or a matrix with specified sparsity with all entries one. More...
 
static MX ones (const Sparsity &sp)
 Create a dense matrix or a matrix with specified sparsity with all entries one. More...
 
static MX ones (const std::pair< casadi_int, casadi_int > &rc)
 Create a dense matrix or a matrix with specified sparsity with all entries one. More...
 

Friends

MX find (const MX &x)
 Find first nonzero, returned as row index. More...
 
MX low (const MX &v, const MX &p, const Dict &options=Dict())
 Find first nonzero. More...
 
MX graph_substitute (const MX &ex, const std::vector< MX > &v, const std::vector< MX > &vdef)
 Substitute single expression in graph. More...
 
std::vector< MXgraph_substitute (const std::vector< MX > &ex, const std::vector< MX > &v, const std::vector< MX > &vdef)
 Substitute multiple expressions in graph. More...
 
MX matrix_expand (const MX &e, const std::vector< MX > &boundary=std::vector< MX >(), const Dict &options=Dict())
 Expand MX graph to SXFunction call. More...
 
std::vector< MXmatrix_expand (const std::vector< MX > &e, const std::vector< MX > &boundary=std::vector< MX >(), const Dict &options=Dict())
 Expand MX graph to SXFunction call. More...
 
MX bspline (const MX &x, const DM &coeffs, const std::vector< std::vector< double > > &knots, const std::vector< casadi_int > &degree, casadi_int m, const Dict &opts=Dict())
 
MX bspline (const MX &x, const MX &coeffs, const std::vector< std::vector< double > > &knots, const std::vector< casadi_int > &degree, casadi_int m, const Dict &opts=Dict())
 
DM bspline_dual (const std::vector< double > &x, const std::vector< std::vector< double > > &knots, const std::vector< casadi_int > &degree, const Dict &opts=Dict())
 
MX convexify (const MX &H, const Dict &opts=Dict())
 
MX lift (const MX &x, const MX &x_guess)
 Lift the expression. More...
 
MX inv_node (const MX &x)
 Inverse node. More...
 
DM evalf (const MX &expr)
 Evaluates the expression numerically. More...
 
MX stop_diff (const MX &expr, casadi_int order)
 Stop derivatives of an expression wrt to all its symbolic variables. More...
 
MX no_grad (const MX &expr)
 Stop first derivatives of an expression wrt to all its symbolic variables. More...
 
MX no_hess (const MX &expr)
 Stop second derivatives of an expression wrt to all its symbolic variables. More...
 
MX stop_diff (const MX &expr, const MX &var, casadi_int order)
 Stop derivatives of an expression wrt to a select set of symbolic variables. More...
 
std::vector< MXdifference (const std::vector< MX > &a, const std::vector< MX > &b)
 

Member Typedef Documentation

◆ MXDict

typedef std::map<std::string, MX> casadi::MX::MXDict

Definition at line 902 of file mx.hpp.

Constructor & Destructor Documentation

◆ MX() [1/7]

casadi::MX::MX ( )

◆ MX() [2/7]

casadi::MX::MX ( casadi_int  nrow,
casadi_int  ncol 
)

◆ MX() [3/7]

casadi::MX::MX ( const Sparsity sp)
explicit

Same as MX::ones(sparsity)

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

◆ MX() [4/7]

casadi::MX::MX ( const Sparsity sp,
const MX val 
)

◆ MX() [5/7]

casadi::MX::MX ( const Sparsity sp,
const std::string &  fname 
)

◆ MX() [6/7]

casadi::MX::MX ( double  x)

◆ MX() [7/7]

casadi::MX::MX ( const Matrix< double > &  x)

Member Function Documentation

◆ __hash__()

casadi_int casadi::SharedObject::__hash__ ( ) const
inherited

If the Object does not point to any node, "0" is returned.

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

◆ __nonzero__()

bool casadi::MX::__nonzero__ ( ) const

◆ attachAssert()

MX casadi::MX::attachAssert ( const MX y,
const std::string &  fail_message = "" 
) const

If y does not evaluate to 1, a runtime error is raised

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

Examples
misc/assertion.py.

◆ bilin()

static MX casadi::GenericMatrix< MX >::bilin ( const MX A,
const MX x,
const MX y 
)
staticinherited
Parameters
[in]ycan be omitted, in which case x^T A x is calculated

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

◆ binary()

static MX casadi::MX::binary ( casadi_int  op,
const MX x,
const MX y 
)
static

◆ bspline_dual()

static DM casadi::MX::bspline_dual ( const std::vector< double > &  x,
const std::vector< std::vector< double > > &  knots,
const std::vector< casadi_int > &  degree,
const Dict opts = Dict() 
)
static

◆ class_name()

std::string casadi::SharedObject::class_name ( ) const
inherited

◆ colind()

casadi_int casadi::GenericMatrix< MX >::colind ( casadi_int  col) const
inlineinherited

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

Definition at line 201 of file generic_matrix.hpp.

◆ columns()

casadi_int casadi::GenericMatrix< MX >::columns ( ) const
inlineinherited

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

Definition at line 124 of file generic_matrix.hpp.

◆ dep()

MX casadi::MX::dep ( casadi_int  ch = 0) const

◆ deserialize()

static MX casadi::MX::deserialize ( DeserializingStream s)
static

◆ dim()

std::string casadi::GenericMatrix< MX >::dim ( bool  with_nz = false) const
inherited

The representation is e.g. "4x5" or "4x5,10nz"

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

◆ disp()

void casadi::SharedObject::disp ( std::ostream &  stream,
bool  more = false 
) const
inherited

◆ einstein() [1/2]

static MX casadi::MX::einstein ( const MX A,
const MX B,
const MX C,
const std::vector< casadi_int > &  dim_a,
const std::vector< casadi_int > &  dim_b,
const std::vector< casadi_int > &  dim_c,
const std::vector< casadi_int > &  a,
const std::vector< casadi_int > &  b,
const std::vector< casadi_int > &  c 
)
static

Computes the product: C_c = A_a + B_b where a b c are index/einstein notation in an encoded form

For example, an matrix-matrix product may be written as: C_ij = A_ik B_kj

The encoded form uses strictly negative numbers to indicate labels. For the above example, we would have: a {-1, -3} b {-3, -2} c {-1 -2}

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

◆ einstein() [2/2]

static MX casadi::MX::einstein ( const MX A,
const MX B,
const std::vector< casadi_int > &  dim_a,
const std::vector< casadi_int > &  dim_b,
const std::vector< casadi_int > &  dim_c,
const std::vector< casadi_int > &  a,
const std::vector< casadi_int > &  b,
const std::vector< casadi_int > &  c 
)
static

Computes the product: C_c = A_a + B_b where a b c are index/einstein notation in an encoded form

For example, an matrix-matrix product may be written as: C_ij = A_ik B_kj

The encoded form uses strictly negative numbers to indicate labels. For the above example, we would have: a {-1, -3} b {-3, -2} c {-1 -2}

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

◆ enlarge()

void casadi::MX::enlarge ( casadi_int  nrow,
casadi_int  ncol,
const std::vector< casadi_int > &  rr,
const std::vector< casadi_int > &  cc,
bool  ind1 = false 
)

Make the matrix larger by inserting empty rows and columns, keeping the existing non-zeros

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

◆ erase() [1/2]

void casadi::MX::erase ( const std::vector< casadi_int > &  rr,
bool  ind1 = false 
)

Erase elements of a matrix

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

◆ erase() [2/2]

void casadi::MX::erase ( const std::vector< casadi_int > &  rr,
const std::vector< casadi_int > &  cc,
bool  ind1 = false 
)

Erase rows and/or columns of a matrix

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

◆ eval_mx()

void casadi::MX::eval_mx ( const std::vector< MX > &  arg,
std::vector< MX > &  res 
) const

◆ eye()

static MX casadi::MX::eye ( casadi_int  n)
static

◆ get() [1/15]

void casadi::MX::get ( MX m,
bool  ind1,
casadi_int  rr,
casadi_int  cc 
) const
inline

Get a submatrix, two arguments

Definition at line 462 of file mx.hpp.

◆ get() [2/15]

void casadi::MX::get ( MX m,
bool  ind1,
casadi_int  rr,
const Slice cc 
) const
inline

Get a submatrix, two arguments

Definition at line 457 of file mx.hpp.

◆ get() [3/15]

void casadi::MX::get ( MX m,
bool  ind1,
const casadi_int  rr 
) const
inline

Get a submatrix, single argument

Definition at line 444 of file mx.hpp.

◆ get() [4/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Matrix< casadi_int > &  rr 
) const

Get a submatrix, single argument

◆ get() [5/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Matrix< casadi_int > &  rr,
const Matrix< casadi_int > &  cc 
) const

Get a submatrix, two arguments

◆ get() [6/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Matrix< casadi_int > &  rr,
const Slice cc 
) const

Get a submatrix, two arguments

◆ get() [7/15]

void casadi::MX::get ( MX m,
bool  ind1,
const MX rr 
) const

Get a submatrix, single argument

◆ get() [8/15]

void casadi::MX::get ( MX m,
bool  ind1,
const MX rr,
const MX cc 
) const

Get a submatrix, two arguments

◆ get() [9/15]

void casadi::MX::get ( MX m,
bool  ind1,
const MX rr,
const Slice cc 
) const

Get a submatrix, two arguments

◆ get() [10/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Slice rr 
) const

Get a submatrix, single argument

◆ get() [11/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Slice rr,
casadi_int  cc 
) const
inline

Get a submatrix, two arguments

Definition at line 453 of file mx.hpp.

◆ get() [12/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Slice rr,
const Matrix< casadi_int > &  cc 
) const

Get a submatrix, two arguments

◆ get() [13/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Slice rr,
const MX cc 
) const

Get a submatrix, two arguments

◆ get() [14/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Slice rr,
const Slice cc 
) const

Get a submatrix, two arguments

◆ get() [15/15]

void casadi::MX::get ( MX m,
bool  ind1,
const Sparsity sp 
) const

Get a submatrix, single argument

◆ get_colind()

std::vector<casadi_int> casadi::GenericMatrix< MX >::get_colind ( ) const
inlineinherited

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

Definition at line 195 of file generic_matrix.hpp.

◆ get_free()

static std::vector<MX> casadi::MX::get_free ( const Function f)
static

◆ get_input()

static std::vector<MX> casadi::MX::get_input ( const Function f)
static

◆ get_max_depth()

static casadi_int casadi::MX::get_max_depth ( )
static

◆ get_nz() [1/7]

void casadi::MX::get_nz ( MX m,
bool  ind1,
casadi_int  kk 
) const
inline

Get a set of nonzeros

Definition at line 491 of file mx.hpp.

◆ get_nz() [2/7]

void casadi::MX::get_nz ( MX m,
bool  ind1,
const Matrix< casadi_int > &  kk 
) const

Get a set of nonzeros

◆ get_nz() [3/7]

void casadi::MX::get_nz ( MX m,
bool  ind1,
const MX inner,
const MX outer 
) const

Get a set of nonzeros

◆ get_nz() [4/7]

void casadi::MX::get_nz ( MX m,
bool  ind1,
const MX inner,
const Slice outer 
) const

Get a set of nonzeros

◆ get_nz() [5/7]

void casadi::MX::get_nz ( MX m,
bool  ind1,
const MX kk 
) const

Get a set of nonzeros

◆ get_nz() [6/7]

void casadi::MX::get_nz ( MX m,
bool  ind1,
const Slice inner,
const MX outer 
) const

Get a set of nonzeros

◆ get_nz() [7/7]

void casadi::MX::get_nz ( MX m,
bool  ind1,
const Slice kk 
) const

Get a set of nonzeros

◆ get_output()

MX casadi::MX::get_output ( casadi_int  oind) const

◆ get_row()

std::vector<casadi_int> casadi::GenericMatrix< MX >::get_row ( ) const
inlineinherited

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

Definition at line 194 of file generic_matrix.hpp.

◆ get_sparsity()

Sparsity casadi::MX::get_sparsity ( ) const
inline

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

Definition at line 189 of file mx.hpp.

◆ get_str()

std::string casadi::SharedObject::get_str ( bool  more = false) const
inlineinherited

Definition at line 138 of file shared_object.hpp.

◆ gradient()

static MX casadi::GenericMatrix< MX >::gradient ( const MX ex,
const MX arg,
const Dict opts = Dict() 
)
staticinherited

Functions called by friend functions defined here

◆ inf() [1/3]

static MX casadi::MX::inf ( casadi_int  nrow = 1,
casadi_int  ncol = 1 
)
static

◆ inf() [2/3]

static MX casadi::MX::inf ( const Sparsity sp)
static

◆ inf() [3/3]

static MX casadi::MX::inf ( const std::pair< casadi_int, casadi_int > &  rc)
static

◆ info()

Dict casadi::MX::info ( ) const

Obtain information about node

◆ interpn_linear()

static MX casadi::MX::interpn_linear ( const std::vector< MX > &  x,
const MX v,
const std::vector< MX > &  xq,
const Dict opts = Dict() 
)
static

Usually, you want to be using 'interpolant' instead.

Accepts lookup_mode option.

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

◆ is_binary()

bool casadi::MX::is_binary ( ) const

◆ is_call()

bool casadi::MX::is_call ( ) const

◆ is_column()

bool casadi::GenericMatrix< MX >::is_column ( ) const
inlineinherited

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

Definition at line 178 of file generic_matrix.hpp.

◆ is_commutative()

bool casadi::MX::is_commutative ( ) const

◆ is_constant()

bool casadi::MX::is_constant ( ) const

◆ is_dense()

bool casadi::GenericMatrix< MX >::is_dense ( ) const
inlineinherited

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

Definition at line 153 of file generic_matrix.hpp.

◆ is_empty()

bool casadi::GenericMatrix< MX >::is_empty ( bool  both = false) const
inlineinherited

(or optionally both dimensions)

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

Definition at line 148 of file generic_matrix.hpp.

◆ is_eye()

bool casadi::MX::is_eye ( ) const

◆ is_minus_one()

bool casadi::MX::is_minus_one ( ) const

◆ is_multiplication()

bool casadi::MX::is_multiplication ( ) const

◆ is_norm()

bool casadi::MX::is_norm ( ) const

◆ is_null()

bool casadi::SharedObject::is_null ( ) const
inherited

◆ is_one()

bool casadi::MX::is_one ( ) const

◆ is_op()

bool casadi::MX::is_op ( casadi_int  op) const

◆ is_output()

bool casadi::MX::is_output ( ) const

◆ is_regular()

bool casadi::MX::is_regular ( ) const

◆ is_row()

bool casadi::GenericMatrix< MX >::is_row ( ) const
inlineinherited

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

Definition at line 173 of file generic_matrix.hpp.

◆ is_scalar()

bool casadi::GenericMatrix< MX >::is_scalar ( bool  scalar_and_dense = false) const
inherited

◆ is_square()

bool casadi::GenericMatrix< MX >::is_square ( ) const
inlineinherited

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

Definition at line 163 of file generic_matrix.hpp.

◆ is_symbolic()

bool casadi::MX::is_symbolic ( ) const

◆ is_transpose()

bool casadi::MX::is_transpose ( ) const

◆ is_tril()

bool casadi::GenericMatrix< MX >::is_tril ( ) const
inlineinherited

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

Definition at line 188 of file generic_matrix.hpp.

◆ is_triu()

bool casadi::GenericMatrix< MX >::is_triu ( ) const
inlineinherited

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

Definition at line 183 of file generic_matrix.hpp.

◆ is_unary()

bool casadi::MX::is_unary ( ) const

◆ is_valid_input()

bool casadi::MX::is_valid_input ( ) const

Valid inputs for MXFunctions are combinations of Reshape, concatenations and SymbolicMX

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

◆ is_vector()

bool casadi::GenericMatrix< MX >::is_vector ( ) const
inlineinherited

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

Definition at line 168 of file generic_matrix.hpp.

◆ is_zero()

bool casadi::MX::is_zero ( ) const

◆ join_primitives() [1/3]

DM casadi::MX::join_primitives ( const std::vector< DM > &  v) const

◆ join_primitives() [2/3]

MX casadi::MX::join_primitives ( const std::vector< MX > &  v) const

◆ join_primitives() [3/3]

SX casadi::MX::join_primitives ( const std::vector< SX > &  v) const

◆ jtimes()

static MX casadi::GenericMatrix< MX >::jtimes ( const MX ex,
const MX arg,
const MX v,
bool  tr = false,
const Dict opts = Dict() 
)
staticinherited

Functions called by friend functions defined here

◆ linearize()

static MX casadi::GenericMatrix< MX >::linearize ( const MX f,
const MX x,
const MX x0,
const Dict opts = Dict() 
)
staticinherited

Functions called by friend functions defined here

◆ logsumexp()

static MX casadi::GenericMatrix< MX >::logsumexp ( const MX x)
staticinherited

◆ mapping()

Matrix<casadi_int> casadi::MX::mapping ( ) const

◆ monitor()

MX casadi::MX::monitor ( const std::string &  comment) const

Returns itself, but with the side effect of printing the nonzeros along with a comment

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

◆ mpower()

static MX casadi::GenericMatrix< MX >::mpower ( const MX x,
const MX y 
)
staticinherited

Functions called by friend functions defined here

◆ n_dep()

casadi_int casadi::MX::n_dep ( ) const

◆ n_out()

casadi_int casadi::MX::n_out ( ) const

◆ n_primitives()

casadi_int casadi::MX::n_primitives ( ) const

◆ name()

std::string casadi::MX::name ( ) const

◆ nan() [1/3]

static MX casadi::MX::nan ( casadi_int  nrow = 1,
casadi_int  ncol = 1 
)
static

◆ nan() [2/3]

static MX casadi::MX::nan ( const Sparsity sp)
static

◆ nan() [3/3]

static MX casadi::MX::nan ( const std::pair< casadi_int, casadi_int > &  rc)
static

◆ nnz()

casadi_int casadi::GenericMatrix< MX >::nnz ( ) const
inherited

◆ nnz_diag()

casadi_int casadi::GenericMatrix< MX >::nnz_diag ( ) const
inherited

◆ nnz_lower()

casadi_int casadi::GenericMatrix< MX >::nnz_lower ( ) const
inherited

◆ nnz_upper()

casadi_int casadi::GenericMatrix< MX >::nnz_upper ( ) const
inherited

◆ numel()

casadi_int casadi::GenericMatrix< MX >::numel ( ) const
inherited

◆ ones() [1/3]

static MX casadi::GenericMatrix< MX >::ones ( casadi_int  nrow = 1,
casadi_int  ncol = 1 
)
inlinestaticinherited

◆ ones() [2/3]

static MX casadi::GenericMatrix< MX >::ones ( const Sparsity sp)
inlinestaticinherited

◆ ones() [3/3]

static MX casadi::GenericMatrix< MX >::ones ( const std::pair< casadi_int, casadi_int > &  rc)
inlinestaticinherited

◆ op()

casadi_int casadi::MX::op ( ) const

◆ operator double()

casadi::MX::operator double ( ) const
explicit

◆ operator Matrix< double >()

casadi::MX::operator Matrix< double > ( ) const
explicit

◆ operator-()

MX casadi::MX::operator- ( ) const

◆ primitives()

std::vector<MX> casadi::MX::primitives ( ) const

◆ printme()

MX casadi::MX::printme ( const MX b) const

◆ rank1()

static MX casadi::GenericMatrix< MX >::rank1 ( const MX A,
const MX alpha,
const MX x,
const MX y 
)
staticinherited

Calculates A + 1/2 * alpha * x*y'

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

◆ row()

casadi_int casadi::GenericMatrix< MX >::row ( casadi_int  el) const
inlineinherited

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

Definition at line 200 of file generic_matrix.hpp.

◆ rows()

casadi_int casadi::GenericMatrix< MX >::rows ( ) const
inlineinherited

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

Definition at line 114 of file generic_matrix.hpp.

◆ serialize()

void casadi::MX::serialize ( SerializingStream s) const

◆ set() [1/7]

void casadi::MX::set ( const MX m,
bool  ind1,
const Matrix< casadi_int > &  rr 
)

Set a submatrix, single argument

◆ set() [2/7]

void casadi::MX::set ( const MX m,
bool  ind1,
const Matrix< casadi_int > &  rr,
const Matrix< casadi_int > &  cc 
)

Set a submatrix, two arguments

◆ set() [3/7]

void casadi::MX::set ( const MX m,
bool  ind1,
const Matrix< casadi_int > &  rr,
const Slice cc 
)

Set a submatrix, two arguments

◆ set() [4/7]

void casadi::MX::set ( const MX m,
bool  ind1,
const Slice rr 
)

Set a submatrix, single argument

◆ set() [5/7]

void casadi::MX::set ( const MX m,
bool  ind1,
const Slice rr,
const Matrix< casadi_int > &  cc 
)

Set a submatrix, two arguments

◆ set() [6/7]

void casadi::MX::set ( const MX m,
bool  ind1,
const Slice rr,
const Slice cc 
)

Set a submatrix, two arguments

◆ set() [7/7]

void casadi::MX::set ( const MX m,
bool  ind1,
const Sparsity sp 
)

Set a submatrix, single argument

◆ set_max_depth()

static void casadi::MX::set_max_depth ( casadi_int  eq_depth = 1)
static

◆ set_nz() [1/4]

void casadi::MX::set_nz ( const MX m,
bool  ind1,
casadi_int  kk 
)
inline

Set a set of nonzeros

Definition at line 504 of file mx.hpp.

◆ set_nz() [2/4]

void casadi::MX::set_nz ( const MX m,
bool  ind1,
const Matrix< casadi_int > &  kk 
)

Set a set of nonzeros

◆ set_nz() [3/4]

void casadi::MX::set_nz ( const MX m,
bool  ind1,
const MX kk 
)

Set a set of nonzeros

◆ set_nz() [4/4]

void casadi::MX::set_nz ( const MX m,
bool  ind1,
const Slice kk 
)

Set a set of nonzeros

◆ size() [1/2]

std::pair<casadi_int, casadi_int> casadi::GenericMatrix< MX >::size ( ) const
inherited

◆ size() [2/2]

casadi_int casadi::GenericMatrix< MX >::size ( casadi_int  axis) const
inherited

◆ size1()

casadi_int casadi::GenericMatrix< MX >::size1 ( ) const
inherited

◆ size2()

casadi_int casadi::GenericMatrix< MX >::size2 ( ) const
inherited

◆ soc()

static MX casadi::GenericMatrix< MX >::soc ( const MX x,
const MX y 
)
staticinherited

Functions called by friend functions defined here

◆ sparsity()

Sparsity casadi::GenericMatrix< MX >::sparsity ( ) const
inherited

◆ split_primitives() [1/3]

std::vector<DM> casadi::MX::split_primitives ( const DM x) const

◆ split_primitives() [2/3]

std::vector<MX> casadi::MX::split_primitives ( const MX x) const

◆ split_primitives() [3/3]

std::vector<SX> casadi::MX::split_primitives ( const SX x) const

◆ sym() [1/7]

static std::vector<MX > casadi::GenericMatrix< MX >::sym ( const std::string &  name,
casadi_int  nrow,
casadi_int  ncol,
casadi_int  p 
)
inlinestaticinherited

◆ sym() [2/7]

static std::vector<std::vector<MX > > casadi::GenericMatrix< MX >::sym ( const std::string &  name,
casadi_int  nrow,
casadi_int  ncol,
casadi_int  p,
casadi_int  r 
)
inlinestaticinherited

with nrow-by-ncol symbolic primitives

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

Definition at line 1074 of file generic_matrix.hpp.

◆ sym() [3/7]

static MX casadi::GenericMatrix< MX >::sym ( const std::string &  name,
casadi_int  nrow = 1,
casadi_int  ncol = 1 
)
inlinestaticinherited

◆ sym() [4/7]

static MX casadi::GenericMatrix< MX >::sym ( const std::string &  name,
const Sparsity sp 
)
inlinestaticinherited

◆ sym() [5/7]

std::vector< MX > casadi::GenericMatrix< MX >::sym ( const std::string &  name,
const Sparsity sp,
casadi_int  p 
)
staticinherited

with symbolic primitives of given sparsity

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

Definition at line 1050 of file generic_matrix.hpp.

◆ sym() [6/7]

std::vector< std::vector< MX > > casadi::GenericMatrix< MX >::sym ( const std::string &  name,
const Sparsity sp,
casadi_int  p,
casadi_int  r 
)
staticinherited

symbolic primitives with given sparsity

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

Definition at line 1066 of file generic_matrix.hpp.

◆ sym() [7/7]

static MX casadi::GenericMatrix< MX >::sym ( const std::string &  name,
const std::pair< casadi_int, casadi_int > &  rc 
)
inlinestaticinherited

◆ T()

MX casadi::MX::T ( ) const

◆ tangent()

static MX casadi::GenericMatrix< MX >::tangent ( const MX ex,
const MX arg,
const Dict opts = Dict() 
)
staticinherited

Functions called by friend functions defined here

◆ test_cast()

static bool casadi::MX::test_cast ( const SharedObjectInternal *  ptr)
static

◆ type_name()

static std::string casadi::MX::type_name ( )
inlinestatic

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

Definition at line 89 of file mx.hpp.

◆ unary()

static MX casadi::MX::unary ( casadi_int  op,
const MX x 
)
static

◆ which_function()

Function casadi::MX::which_function ( ) const

◆ which_output()

casadi_int casadi::MX::which_output ( ) const

◆ zeros() [1/3]

static MX casadi::GenericMatrix< MX >::zeros ( casadi_int  nrow = 1,
casadi_int  ncol = 1 
)
inlinestaticinherited

◆ zeros() [2/3]

static MX casadi::GenericMatrix< MX >::zeros ( const Sparsity sp)
inlinestaticinherited

◆ zeros() [3/3]

static MX casadi::GenericMatrix< MX >::zeros ( const std::pair< casadi_int, casadi_int > &  rc)
inlinestaticinherited

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