Functions | Friends
Expression_tools

Functions

static MatType casadi::GenericMatrix< MatType >::logsumexp (const MatType &x)
 

Friends

MatType casadi::GenericMatrix< MatType >::interp1d (const std::vector< double > &x, const MatType &v, const std::vector< double > &xq, const std::string &mode, bool equidistant=false)
 Performs 1d linear interpolation. More...
 
MatType casadi::GenericMatrix< MatType >::mpower (const MatType &x, const MatType &n)
 Matrix power x^n. More...
 
MatType casadi::GenericMatrix< MatType >::soc (const MatType &x, const MatType &y)
 Construct second-order-convex. More...
 
MatType casadi::GenericMatrix< MatType >::mrdivide (const MatType &x, const MatType &n)
 Matrix divide (cf. slash '/' in MATLAB) More...
 
MatType casadi::GenericMatrix< MatType >::mldivide (const MatType &x, const MatType &n)
 Matrix divide (cf. backslash '\' in MATLAB) More...
 
std::vector< MatType > casadi::GenericMatrix< MatType >::symvar (const MatType &x)
 Get all symbols contained in the supplied expression. More...
 
MatType casadi::GenericMatrix< MatType >::sumsqr (const MatType &x)
 Calculate sum of squares: sum_ij X_ij^2. More...
 
MatType casadi::GenericMatrix< MatType >::logsumexp (const MatType &x)
 x -> log(sum_i exp(x_i)) More...
 
MatType casadi::GenericMatrix< MatType >::logsumexp (const MatType &x, const MatType &margin)
 Scaled version of logsumexp. More...
 
MatType casadi::GenericMatrix< MatType >::linspace (const MatType &a, const MatType &b, casadi_int nsteps)
 Matlab's linspace command. More...
 
MatType casadi::GenericMatrix< MatType >::cross (const MatType &a, const MatType &b, casadi_int dim=-1)
 Matlab's cross command. More...
 
MatType casadi::GenericMatrix< MatType >::skew (const MatType &a)
 Generate a skew symmetric matrix from a 3-vector. More...
 
MatType casadi::GenericMatrix< MatType >::inv_skew (const MatType &a)
 Generate the 3-vector progenitor of a skew symmetric matrix. More...
 
MatType casadi::GenericMatrix< MatType >::det (const MatType &A)
 Matrix determinant (experimental) More...
 
MatType casadi::GenericMatrix< MatType >::inv_minor (const MatType &A)
 Matrix inverse (experimental) More...
 
MatType casadi::GenericMatrix< MatType >::inv (const MatType &A)
 Matrix inverse. More...
 
MatType casadi::GenericMatrix< MatType >::inv (const MatType &A, const std::string &lsolver, const Dict &options=Dict())
 Matrix inverse. More...
 
MatType casadi::GenericMatrix< MatType >::trace (const MatType &x)
 Matrix trace. More...
 
MatType casadi::GenericMatrix< MatType >::tril2symm (const MatType &a)
 Convert a lower triangular matrix to a symmetric one. More...
 
MatType casadi::GenericMatrix< MatType >::triu2symm (const MatType &a)
 Convert a upper triangular matrix to a symmetric one. More...
 
MatType casadi::GenericMatrix< MatType >::norm_fro (const MatType &x)
 Frobenius norm. More...
 
MatType casadi::GenericMatrix< MatType >::norm_2 (const MatType &x)
 2-norm More...
 
MatType casadi::GenericMatrix< MatType >::norm_1 (const MatType &x)
 1-norm More...
 
MatType casadi::GenericMatrix< MatType >::norm_inf (const MatType &x)
 Infinity-norm. More...
 
MatType casadi::GenericMatrix< MatType >::diff (const MatType &x, casadi_int n=1, casadi_int axis=-1)
 Returns difference (n-th order) along given axis (MATLAB convention) More...
 
MatType casadi::GenericMatrix< MatType >::cumsum (const MatType &x, casadi_int axis=-1)
 Returns cumulative sum along given axis (MATLAB convention) More...
 
MatType casadi::GenericMatrix< MatType >::dot (const MatType &x, const MatType &y)
 Inner product of two matrices. More...
 
MatType casadi::GenericMatrix< MatType >::nullspace (const MatType &A)
 Computes the nullspace of a matrix A. More...
 
MatType casadi::GenericMatrix< MatType >::polyval (const MatType &p, const MatType &x)
 Evaluate a polynomial with coefficients p in x. More...
 
MatType casadi::GenericMatrix< MatType >::diag (const MatType &A)
 Get the diagonal of a matrix or construct a diagonal. More...
 
MatType casadi::GenericMatrix< MatType >::unite (const MatType &A, const MatType &B)
 Unite two matrices no overlapping sparsity. More...
 
MatType casadi::GenericMatrix< MatType >::densify (const MatType &x)
 Make the matrix dense if not already. More...
 
MatType casadi::GenericMatrix< MatType >::densify (const MatType &x, const MatType &val)
 Make the matrix dense and assign nonzeros to a value. More...
 
MatType casadi::GenericMatrix< MatType >::project (const MatType &A, const Sparsity &sp, bool intersect=false)
 Create a new matrix with a given sparsity pattern but with the. More...
 
MatType casadi::GenericMatrix< MatType >::if_else (const MatType &cond, const MatType &if_true, const MatType &if_false, bool short_circuit=false)
 Branching on MX nodes. More...
 
MatType casadi::GenericMatrix< MatType >::conditional (const MatType &ind, const std::vector< MatType > &x, const MatType &x_default, bool short_circuit=false)
 Create a switch. More...
 
bool casadi::GenericMatrix< MatType >::depends_on (const MatType &f, const MatType &arg)
 Check if expression depends on the argument. More...
 
MatType casadi::GenericMatrix< MatType >::substitute (const MatType &ex, const MatType &v, const MatType &vdef)
 Substitute variable v with expression vdef in an expression ex. More...
 
std::vector< MatType > casadi::GenericMatrix< MatType >::substitute (const std::vector< MatType > &ex, const std::vector< MatType > &v, const std::vector< MatType > &vdef)
 Substitute variable var with expression expr in multiple expressions. More...
 
void casadi::GenericMatrix< MatType >::substitute_inplace (const std::vector< MatType > &v, std::vector< MatType > &inout_vdef, std::vector< MatType > &inout_ex, bool reverse=false)
 Inplace substitution with piggyback expressions. More...
 
MatType casadi::GenericMatrix< MatType >::cse (const MatType &e)
 Common subexpression elimination. More...
 
std::vector< MatType > casadi::GenericMatrix< MatType >::cse (const std::vector< MatType > &e)
 Common subexpression elimination. More...
 
MatType casadi::GenericMatrix< MatType >::solve (const MatType &A, const MatType &b)
 Solve a system of equations: A*x = b. More...
 
MatType casadi::GenericMatrix< MatType >::solve (const MatType &A, const MatType &b, const std::string &lsolver, const Dict &dict=Dict())
 Solve a system of equations: A*x = b. More...
 
MatType casadi::GenericMatrix< MatType >::linearize (const MatType &f, const MatType &x, const MatType &x0, const Dict &opts=Dict())
 Linearize an expression. More...
 
MatType casadi::GenericMatrix< MatType >::pinv (const MatType &A)
 Computes the Moore-Penrose pseudo-inverse. More...
 
MatType casadi::GenericMatrix< MatType >::pinv (const MatType &A, const std::string &lsolver, const Dict &dict=Dict())
 Computes the Moore-Penrose pseudo-inverse. More...
 
MatType casadi::GenericMatrix< MatType >::expm_const (const MatType &A, const MatType &t)
 Calculate Matrix exponential. More...
 
MatType casadi::GenericMatrix< MatType >::expm (const MatType &A)
 Calculate Matrix exponential. More...
 
MatType casadi::GenericMatrix< MatType >::jacobian (const MatType &ex, const MatType &arg, const Dict &opts=Dict())
 Calculate Jacobian. More...
 
MatType casadi::GenericMatrix< MatType >::gradient (const MatType &ex, const MatType &arg, const Dict &opts=Dict())
 Calculate the gradient of an expression. More...
 
MatType casadi::GenericMatrix< MatType >::tangent (const MatType &ex, const MatType &arg, const Dict &opts=Dict())
 Calculate the tangent of an expression. More...
 
MatType casadi::GenericMatrix< MatType >::jtimes (const MatType &ex, const MatType &arg, const MatType &v, bool tr=false, const Dict &opts=Dict())
 Calculate the Jacobian and multiply by a vector from the right. More...
 
std::vector< std::vector< MatType > > casadi::GenericMatrix< MatType >::forward (const std::vector< MatType > &ex, const std::vector< MatType > &arg, const std::vector< std::vector< MatType > > &v, const Dict &opts=Dict())
 Forward directional derivative. More...
 
std::vector< std::vector< MatType > > casadi::GenericMatrix< MatType >::reverse (const std::vector< MatType > &ex, const std::vector< MatType > &arg, const std::vector< std::vector< MatType > > &v, const Dict &opts=Dict())
 Reverse directional derivative. More...
 
std::vector< bool > casadi::GenericMatrix< MatType >::which_depends (const MatType &expr, const MatType &var, casadi_int order, bool tr)
 Find out which variables enter with some order. More...
 
Sparsity casadi::GenericMatrix< MatType >::jacobian_sparsity (const MatType &f, const MatType &x)
 Get the sparsity pattern of a jacobian. More...
 
bool casadi::GenericMatrix< MatType >::is_linear (const MatType &expr, const MatType &var)
 Is expr linear in var? More...
 
bool casadi::GenericMatrix< MatType >::is_quadratic (const MatType &expr, const MatType &var)
 Is expr quadratic in var? More...
 
void casadi::GenericMatrix< MatType >::quadratic_coeff (const MatType &expr, const MatType &var, MatType &A, MatType &b, MatType &c, bool check=true)
 Recognizes quadratic form in scalar expression. More...
 
void casadi::GenericMatrix< MatType >::linear_coeff (const MatType &expr, const MatType &var, MatType &A, MatType &b, bool check=true)
 Recognizes linear form in vector expression. More...
 
casadi_int casadi::GenericMatrix< MatType >::n_nodes (const MatType &A)
 
MatType casadi::GenericMatrix< MatType >::simplify (const MatType &x)
 Simplify an expression. More...
 
std::string casadi::GenericMatrix< MatType >::print_operator (const MatType &xb, const std::vector< std::string > &args)
 Get a string representation for a binary MatType, using custom arguments. More...
 
void casadi::GenericMatrix< MatType >::extract (std::vector< MatType > &ex, std::vector< MatType > &v, std::vector< MatType > &vdef, const Dict &opts=Dict())
 Introduce intermediate variables for selected nodes in a graph. More...
 
void casadi::GenericMatrix< MatType >::shared (std::vector< MatType > &ex, std::vector< MatType > &v, std::vector< MatType > &vdef, const std::string &v_prefix="v_", const std::string &v_suffix="")
 Extract shared subexpressions from an set of expressions. More...
 
MatType casadi::GenericMatrix< MatType >::repsum (const MatType &A, casadi_int n, casadi_int m=1)
 Given a repeated matrix, computes the sum of repeated parts. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::adj (const Matrix< Scalar > &A)
 Matrix adjoint. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::minor (const Matrix< Scalar > &x, casadi_int i, casadi_int j)
 Get the (i,j) minor matrix. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::cofactor (const Matrix< Scalar > &x, casadi_int i, casadi_int j)
 Get the (i,j) cofactor matrix. More...
 
void casadi::Matrix< Scalar >::qr (const Matrix< Scalar > &A, Matrix< Scalar > &Q, Matrix< Scalar > &R)
 QR factorization using the modified Gram-Schmidt algorithm. More...
 
void casadi::Matrix< Scalar >::qr_sparse (const Matrix< Scalar > &A, Matrix< Scalar > &V, Matrix< Scalar > &R, Matrix< Scalar > &beta, std::vector< casadi_int > &prinv, std::vector< casadi_int > &pc, bool amd=true)
 Sparse direct QR factorization. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::qr_solve (const Matrix< Scalar > &b, const Matrix< Scalar > &v, const Matrix< Scalar > &r, const Matrix< Scalar > &beta, const std::vector< casadi_int > &prinv, const std::vector< casadi_int > &pc, bool tr=false)
 Solve using a sparse QR factorization. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::chol (const Matrix< Scalar > &A)
 Obtain a Cholesky factorisation of a matrix. More...
 
void casadi::Matrix< Scalar >::ldl (const Matrix< Scalar > &A, Matrix< Scalar > &D, Matrix< Scalar > &LT, std::vector< casadi_int > &p, bool amd=true)
 Sparse LDL^T factorization. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::ldl_solve (const Matrix< Scalar > &b, const Matrix< Scalar > &D, const Matrix< Scalar > &LT, const std::vector< casadi_int > &p)
 Solve using a sparse LDL^T factorization. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::any (const Matrix< Scalar > &x)
 Returns true only if any element in the matrix is true. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::all (const Matrix< Scalar > &x)
 Returns true only if every element in the matrix is true. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::norm_inf_mul (const Matrix< Scalar > &x, const Matrix< Scalar > &y)
 Inf-norm of a Matrix-Matrix product. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::sparsify (const Matrix< Scalar > &A, double tol=0)
 Make a matrix sparse by removing numerical zeros. More...
 
void casadi::Matrix< Scalar >::expand (const Matrix< Scalar > &ex, Matrix< Scalar > &weights, Matrix< Scalar > &terms)
 Expand the expression as a weighted sum (with constant weights) More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::pw_const (const Matrix< Scalar > &t, const Matrix< Scalar > &tval, const Matrix< Scalar > &val)
 Create a piecewise constant function. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::pw_lin (const Matrix< Scalar > &t, const Matrix< Scalar > &tval, const Matrix< Scalar > &val)
 t a scalar variable (e.g. time) More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::heaviside (const Matrix< Scalar > &x)
 Heaviside function. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::rectangle (const Matrix< Scalar > &x)
 rectangle function More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::triangle (const Matrix< Scalar > &x)
 triangle function More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::ramp (const Matrix< Scalar > &x)
 ramp function More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::mtaylor (const Matrix< Scalar > &ex, const Matrix< Scalar > &x, const Matrix< Scalar > &a, casadi_int order=1)
 multivariate Taylor series expansion More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::mtaylor (const Matrix< Scalar > &ex, const Matrix< Scalar > &x, const Matrix< Scalar > &a, casadi_int order, const std::vector< casadi_int > &order_contributions)
 multivariate Taylor series expansion More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::poly_coeff (const Matrix< Scalar > &f, const Matrix< Scalar > &x)
 extracts polynomial coefficients from an expression More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::poly_roots (const Matrix< Scalar > &p)
 Attempts to find the roots of a polynomial. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::eig_symbolic (const Matrix< Scalar > &m)
 Attempts to find the eigenvalues of a symbolic matrix. More...
 
Matrix< double > casadi::Matrix< Scalar >::evalf (const Matrix< Scalar > &expr)
 Evaluates the expression numerically. More...
 
MX casadi::MX::find (const MX &x)
 Find first nonzero, returned as row index. More...
 
MX casadi::MX::low (const MX &v, const MX &p, const Dict &options=Dict())
 Find first nonzero. More...
 
MX casadi::MX::graph_substitute (const MX &ex, const std::vector< MX > &v, const std::vector< MX > &vdef)
 Substitute single expression in graph. More...
 
std::vector< MXcasadi::MX::graph_substitute (const std::vector< MX > &ex, const std::vector< MX > &v, const std::vector< MX > &vdef)
 Substitute multiple expressions in graph. More...
 
MX casadi::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< MXcasadi::MX::matrix_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 casadi::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 casadi::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 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())
 
MX casadi::MX::convexify (const MX &H, const Dict &opts=Dict())
 
MX casadi::MX::lift (const MX &x, const MX &x_guess)
 Lift the expression. More...
 
MX casadi::MX::inv_node (const MX &x)
 Inverse node. More...
 
DM casadi::MX::evalf (const MX &expr)
 Evaluates the expression numerically. More...
 
MX casadi::MX::stop_diff (const MX &expr, casadi_int order)
 Stop derivatives of an expression wrt to all its symbolic variables. More...
 
MX casadi::MX::no_grad (const MX &expr)
 Stop first derivatives of an expression wrt to all its symbolic variables. More...
 
MX casadi::MX::no_hess (const MX &expr)
 Stop second derivatives of an expression wrt to all its symbolic variables. More...
 
MX casadi::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< MXcasadi::MX::difference (const std::vector< MX > &a, const std::vector< MX > &b)
 
MatType casadi::GenericMatrix< MatType >::einstein (const MatType &A, const MatType &B, const MatType &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)
 Compute any contraction of two dense tensors, using index/einstein notation. More...
 
MatType casadi::GenericMatrix< MatType >::einstein (const MatType &A, const MatType &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)
 Compute any contraction of two dense tensors, using index/einstein notation. More...
 
MatType casadi::GenericMatrix< MatType >::bilin (const MatType &A, const MatType &x, const MatType &y)
 Calculate bilinear/quadratic form x^T A y. More...
 
MatType casadi::GenericMatrix< MatType >::bilin (const MatType &A, const MatType &x)
 Calculate bilinear/quadratic form x^T A y. More...
 
static MatType casadi::GenericMatrix< MatType >::bilin (const MatType &A, const MatType &x, const MatType &y)
 Calculate bilinear/quadratic form x^T A y. More...
 
MatType casadi::GenericMatrix< MatType >::rank1 (const MatType &A, const MatType &alpha, const MatType &x, const MatType &y)
 Make a rank-1 update to a matrix A. More...
 
static MatType casadi::GenericMatrix< MatType >::rank1 (const MatType &A, const MatType &alpha, const MatType &x, const MatType &y)
 Make a rank-1 update to a matrix A. More...
 
MatType casadi::GenericMatrix< MatType >::hessian (const MatType &ex, const MatType &arg, const Dict &opts=Dict())
 Hessian and (optionally) gradient. More...
 
MatType casadi::GenericMatrix< MatType >::hessian (const MatType &ex, const MatType &arg, MatType &output_g, const Dict &opts=Dict())
 Hessian and (optionally) gradient. More...
 
MatType casadi::GenericMatrix< MatType >::mmin (const MatType &x)
 Smallest element in a matrix. More...
 
MatType casadi::GenericMatrix< MatType >::mmax (const MatType &x)
 Largest element in a matrix. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::gauss_quadrature (const Matrix< Scalar > &f, const Matrix< Scalar > &x, const Matrix< Scalar > &a, const Matrix< Scalar > &b, casadi_int order=5)
 Integrate f from a to b using Gaussian quadrature with n points. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::gauss_quadrature (const Matrix< Scalar > &f, const Matrix< Scalar > &x, const Matrix< Scalar > &a, const Matrix< Scalar > &b, casadi_int order, const Matrix< Scalar > &w)
 Integrate f from a to b using Gaussian quadrature with n points. More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::taylor (const Matrix< Scalar > &ex, const Matrix< Scalar > &x, const Matrix< Scalar > &a, casadi_int order=1)
 univariate Taylor series expansion More...
 
Matrix< Scalar > casadi::Matrix< Scalar >::taylor (const Matrix< Scalar > &ex, const Matrix< Scalar > &x)
 univariate Taylor series expansion More...
 
static MatType casadi::GenericMatrix< MatType >::jtimes (const MatType &ex, const MatType &arg, const MatType &v, bool tr=false, const Dict &opts=Dict())
 
static MatType casadi::GenericMatrix< MatType >::gradient (const MatType &ex, const MatType &arg, const Dict &opts=Dict())
 
static MatType casadi::GenericMatrix< MatType >::tangent (const MatType &ex, const MatType &arg, const Dict &opts=Dict())
 
static MatType casadi::GenericMatrix< MatType >::linearize (const MatType &f, const MatType &x, const MatType &x0, const Dict &opts=Dict())
 
static MatType casadi::GenericMatrix< MatType >::mpower (const MatType &x, const MatType &y)
 
static MatType casadi::GenericMatrix< MatType >::soc (const MatType &x, const MatType &y)
 

Detailed Description

Function Documentation

◆ bilin()

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

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

◆ gradient()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::gradient ( const MatType &  ex,
const MatType &  arg,
const Dict opts = Dict() 
)
static

Functions called by friend functions defined here

◆ jtimes()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::jtimes ( const MatType &  ex,
const MatType &  arg,
const MatType &  v,
bool  tr = false,
const Dict opts = Dict() 
)
static

Functions called by friend functions defined here

◆ linearize()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::linearize ( const MatType &  f,
const MatType &  x,
const MatType &  x0,
const Dict opts = Dict() 
)
static

Functions called by friend functions defined here

◆ logsumexp()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::logsumexp ( const MatType &  x)
static

◆ mpower()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::mpower ( const MatType &  x,
const MatType &  y 
)
static

Functions called by friend functions defined here

◆ rank1()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::rank1 ( const MatType &  A,
const MatType &  alpha,
const MatType &  x,
const MatType &  y 
)
static

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

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

◆ soc()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::soc ( const MatType &  x,
const MatType &  y 
)
static

Functions called by friend functions defined here

◆ tangent()

template<typename MatType >
static MatType casadi::GenericMatrix< MatType >::tangent ( const MatType &  ex,
const MatType &  arg,
const Dict opts = Dict() 
)
static

Functions called by friend functions defined here

Friends

◆ adj

template<typename Scalar >
Matrix<Scalar> adj ( const Matrix< Scalar > &  A)
friend

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

Definition at line 504 of file matrix_decl.hpp.

◆ all

template<typename Scalar >
Matrix<Scalar> all ( const Matrix< Scalar > &  x)
friend

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

Definition at line 597 of file matrix_decl.hpp.

◆ any

template<typename Scalar >
Matrix<Scalar> any ( const Matrix< Scalar > &  x)
friend

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

Definition at line 590 of file matrix_decl.hpp.

◆ bilin [1/2]

template<typename MatType >
MatType bilin ( const MatType &  A,
const MatType &  x 
)
friend
Parameters
[in]ycan be omitted, in which case x^T A x is calculated

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

Definition at line 406 of file generic_matrix.hpp.

◆ bilin [2/2]

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::bilin ( const MatType &  A,
const MatType &  x,
const MatType &  y 
)
friend
Parameters
[in]ycan be omitted, in which case x^T A x is calculated

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

Definition at line 403 of file generic_matrix.hpp.

◆ bspline [1/2]

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

Definition at line 766 of file mx.hpp.

◆ bspline [2/2]

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

Definition at line 775 of file mx.hpp.

◆ bspline_dual

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

Definition at line 783 of file mx.hpp.

◆ chol

template<typename Scalar >
Matrix<Scalar> chol ( const Matrix< Scalar > &  A)
friend

Performs and LDL transformation [L,D] = ldl(A) and returns diag(sqrt(D))*L'

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

Definition at line 562 of file matrix_decl.hpp.

◆ cofactor

template<typename Scalar >
Matrix<Scalar> cofactor ( const Matrix< Scalar > &  x,
casadi_int  i,
casadi_int  j 
)
friend

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

Definition at line 518 of file matrix_decl.hpp.

◆ conditional

template<typename MatType >
MatType conditional ( const MatType &  ind,
const std::vector< MatType > &  x,
const MatType &  x_default,
bool  short_circuit = false 
)
friend

If the condition

Parameters
indevaluates to the integer k, where 0<=k<f.size(), then x[k] will be returned, otherwise
x_defaultwill be returned.

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

Definition at line 647 of file generic_matrix.hpp.

◆ convexify

MX convexify ( const MX H,
const Dict opts = Dict() 
)
friend

Definition at line 790 of file mx.hpp.

◆ cross

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::cross ( const MatType &  a,
const MatType &  b,
casadi_int  dim = -1 
)
friend

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

Definition at line 467 of file generic_matrix.hpp.

◆ cse [1/2]

template<typename MatType >
MatType cse ( const MatType &  e)
friend

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

Definition at line 694 of file generic_matrix.hpp.

◆ cse [2/2]

template<typename MatType >
std::vector<MatType> cse ( const std::vector< MatType > &  e)
friend

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

Definition at line 702 of file generic_matrix.hpp.

◆ cumsum

template<typename MatType >
MatType cumsum ( const MatType &  x,
casadi_int  axis = -1 
)
friend

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

Definition at line 556 of file generic_matrix.hpp.

◆ densify [1/2]

template<typename MatType >
MatType densify ( const MatType &  x)
friend

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

Definition at line 610 of file generic_matrix.hpp.

◆ densify [2/2]

template<typename MatType >
MatType densify ( const MatType &  x,
const MatType &  val 
)
friend

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

Definition at line 617 of file generic_matrix.hpp.

◆ depends_on

template<typename MatType >
bool depends_on ( const MatType &  f,
const MatType &  arg 
)
friend

The argument must be symbolic

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

Definition at line 657 of file generic_matrix.hpp.

◆ det

template<typename MatType >
MatType det ( const MatType &  A)
friend

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

Definition at line 488 of file generic_matrix.hpp.

◆ diag

template<typename MatType >
MatType diag ( const MatType &  A)
friend

When the input is square, the diagonal elements are returned. If the input is vector-like, a diagonal matrix is constructed with it.

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

Definition at line 596 of file generic_matrix.hpp.

◆ diff

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::diff ( const MatType &  x,
casadi_int  n = 1,
casadi_int  axis = -1 
)
friend

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

Definition at line 549 of file generic_matrix.hpp.

◆ difference

std::vector<MX> difference ( const std::vector< MX > &  a,
const std::vector< MX > &  b 
)
friend

\bried Return all elements of a that do not occur in b, preserving order

Definition at line 854 of file mx.hpp.

◆ dot

template<typename MatType >
MatType dot ( const MatType &  x,
const MatType &  y 
)
friend

with x and y matrices of the same dimension

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

Definition at line 565 of file generic_matrix.hpp.

◆ eig_symbolic

template<typename Scalar >
Matrix<Scalar> eig_symbolic ( const Matrix< Scalar > &  m)
friend

This will only work for up to 3x3 matrices

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

Definition at line 833 of file matrix_decl.hpp.

◆ einstein [1/2]

template<typename MatType >
MatType einstein ( const MatType &  A,
const MatType &  B,
const MatType &  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 
)
friend

einstein(A, B, a, b, c) -> C

Given two tensors, A and B, computes a third tensor C such that:

C_c = A_a * B_b

With a, b, c representing einstein indices. Instead of the classical index labels i,j,k,... we employ -1,-2,-3,...

A, B, C are represented as CasADi vectors, with dim_a, dim_b, dim_c indictating theire tensorial dimensions.

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

Definition at line 355 of file generic_matrix.hpp.

◆ einstein [2/2]

template<typename MatType >
MatType einstein ( const MatType &  A,
const MatType &  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 
)
friend

einstein(A, B, a, b, c) -> C

Given two tensors, A and B, computes a third tensor C such that:

C_c = A_a * B_b

With a, b, c representing einstein indices. Instead of the classical index labels i,j,k,... we employ -1,-2,-3,...

A, B, C are represented as CasADi vectors, with dim_a, dim_b, dim_c indictating theire tensorial dimensions.

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

Definition at line 364 of file generic_matrix.hpp.

◆ evalf [1/2]

template<typename Scalar >
Matrix<double> evalf ( const Matrix< Scalar > &  expr)
friend

An error is raised when the expression contains symbols

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

Definition at line 843 of file matrix_decl.hpp.

◆ evalf [2/2]

DM evalf ( const MX expr)
friend

An error is raised when the expression contains symbols

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

Definition at line 816 of file mx.hpp.

◆ expand

template<typename Scalar >
void expand ( const Matrix< Scalar > &  ex,
Matrix< Scalar > &  weights,
Matrix< Scalar > &  terms 
)
friend

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

Definition at line 620 of file matrix_decl.hpp.

◆ expm

template<typename MatType >
MatType expm ( const MatType &  A)
friend

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

Definition at line 790 of file generic_matrix.hpp.

◆ expm_const

template<typename MatType >
MatType expm_const ( const MatType &  A,
const MatType &  t 
)
friend

Computes expm(A*t) with A constant

Parameters
A[in]Square matrix
t[in]Scalar

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

Definition at line 782 of file generic_matrix.hpp.

◆ extract

template<typename MatType >
void extract ( std::vector< MatType > &  ex,
std::vector< MatType > &  v,
std::vector< MatType > &  vdef,
const Dict opts = Dict() 
)
friend

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

Definition at line 959 of file generic_matrix.hpp.

◆ find

MX find ( const MX x)
friend

If failed, returns the number of rows

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

Definition at line 704 of file mx.hpp.

◆ forward

template<typename MatType >
std::vector<std::vector<MatType> > forward ( const std::vector< MatType > &  ex,
const std::vector< MatType > &  arg,
const std::vector< std::vector< MatType > > &  v,
const Dict opts = Dict() 
)
friend

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

Definition at line 841 of file generic_matrix.hpp.

◆ gauss_quadrature [1/2]

template<typename Scalar >
Matrix<Scalar> gauss_quadrature ( const Matrix< Scalar > &  f,
const Matrix< Scalar > &  x,
const Matrix< Scalar > &  a,
const Matrix< Scalar > &  b,
casadi_int  order,
const Matrix< Scalar > &  w 
)
friend

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

Definition at line 732 of file matrix_decl.hpp.

◆ gauss_quadrature [2/2]

template<typename Scalar >
Matrix<Scalar> gauss_quadrature ( const Matrix< Scalar > &  f,
const Matrix< Scalar > &  x,
const Matrix< Scalar > &  a,
const Matrix< Scalar > &  b,
casadi_int  order = 5 
)
friend

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

Definition at line 726 of file matrix_decl.hpp.

◆ gradient

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::gradient ( const MatType &  ex,
const MatType &  arg,
const Dict opts = Dict() 
)
friend
Parameters
ex[in]Scalar expression to take the gradient of
arg[in]Vector expression of symbols
opts[in]Options
Returns
Dense column vector

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

Definition at line 812 of file generic_matrix.hpp.

◆ graph_substitute [1/2]

MX graph_substitute ( const MX ex,
const std::vector< MX > &  v,
const std::vector< MX > &  vdef 
)
friend

Substitute variable v with expression vdef in an expression ex, preserving nodes

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

Definition at line 722 of file mx.hpp.

◆ graph_substitute [2/2]

std::vector<MX> graph_substitute ( const std::vector< MX > &  ex,
const std::vector< MX > &  v,
const std::vector< MX > &  vdef 
)
friend

Substitute variable var with expression expr in multiple expressions, preserving nodes

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

Definition at line 734 of file mx.hpp.

◆ heaviside

template<typename Scalar >
Matrix<Scalar> heaviside ( const Matrix< Scalar > &  x)
friend

\[ \begin {cases} H(x) = 0 & x<0 \\ H(x) = 1/2 & x=0 \\ H(x) = 1 & x>0 \\ \end {cases} \]

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

Definition at line 668 of file matrix_decl.hpp.

◆ hessian [1/2]

template<typename MatType >
MatType hessian ( const MatType &  ex,
const MatType &  arg,
const Dict opts = Dict() 
)
friend

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

Definition at line 861 of file generic_matrix.hpp.

◆ hessian [2/2]

template<typename MatType >
MatType hessian ( const MatType &  ex,
const MatType &  arg,
MatType &  output_g,
const Dict opts = Dict() 
)
friend

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

Definition at line 865 of file generic_matrix.hpp.

◆ if_else

template<typename MatType >
MatType if_else ( const MatType &  cond,
const MatType &  if_true,
const MatType &  if_false,
bool  short_circuit = false 
)
friend

Ternary operator, "cond ? if_true : if_false"

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

Definition at line 636 of file generic_matrix.hpp.

◆ interp1d

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::interp1d ( const std::vector< double > &  x,
const MatType &  v,
const std::vector< double > &  xq,
const std::string &  mode,
bool  equidistant = false 
)
friend

The data-points to be interpolated are given as (x[i], v[i]). xq[j] is used as interplating value

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

Definition at line 311 of file generic_matrix.hpp.

◆ inv [1/2]

template<typename MatType >
MatType inv ( const MatType &  A)
friend

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

Definition at line 498 of file generic_matrix.hpp.

◆ inv [2/2]

template<typename MatType >
MatType inv ( const MatType &  A,
const std::string &  lsolver,
const Dict options = Dict() 
)
friend

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

Definition at line 505 of file generic_matrix.hpp.

◆ inv_minor

template<typename MatType >
MatType inv_minor ( const MatType &  A)
friend

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

Definition at line 493 of file generic_matrix.hpp.

◆ inv_node

MX inv_node ( const MX x)
friend

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

Definition at line 807 of file mx.hpp.

◆ inv_skew

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::inv_skew ( const MatType &  a)
friend

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

Definition at line 481 of file generic_matrix.hpp.

◆ is_linear

template<typename MatType >
bool casadi::GenericMatrix< MatType >::is_linear ( const MatType &  expr,
const MatType &  var 
)
friend

False negatives are possible (an expression may not be recognised as linear while it really is), false positives not.

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

Definition at line 895 of file generic_matrix.hpp.

◆ is_quadratic

template<typename MatType >
bool casadi::GenericMatrix< MatType >::is_quadratic ( const MatType &  expr,
const MatType &  var 
)
friend

False negatives are possible (an expression may not be recognised as quadratic while it really is), false positives not.

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

Definition at line 906 of file generic_matrix.hpp.

◆ jacobian

template<typename MatType >
MatType jacobian ( const MatType &  ex,
const MatType &  arg,
const Dict opts = Dict() 
)
friend
Returns
Sparse matrix

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

Definition at line 799 of file generic_matrix.hpp.

◆ jacobian_sparsity

template<typename MatType >
Sparsity jacobian_sparsity ( const MatType &  f,
const MatType &  x 
)
friend

Equivalent to, but cheaper to compute than, jacobian(f,x).sparsity()

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

Definition at line 884 of file generic_matrix.hpp.

◆ jtimes

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::jtimes ( const MatType &  ex,
const MatType &  arg,
const MatType &  v,
bool  tr = false,
const Dict opts = Dict() 
)
friend

This is equivalent to mul(jacobian(ex, arg), v) or mul(jacobian(ex, arg).T, v) for tr set to false and true respectively. If contrast to these expressions, it will use directional derivatives which is typically (but not necessarily) more efficient if the complete Jacobian is not needed and v has few rows.

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

Definition at line 832 of file generic_matrix.hpp.

◆ ldl

template<typename Scalar >
void ldl ( const Matrix< Scalar > &  A,
Matrix< Scalar > &  D,
Matrix< Scalar > &  LT,
std::vector< casadi_int > &  p,
bool  amd = true 
)
friend

Returns D and the strictly upper triangular entries of L^T I.e. ones on the diagonal are ignored. Only guarenteed to work for positive definite matrices.

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

Definition at line 573 of file matrix_decl.hpp.

◆ ldl_solve

template<typename Scalar >
Matrix<Scalar> ldl_solve ( const Matrix< Scalar > &  b,
const Matrix< Scalar > &  D,
const Matrix< Scalar > &  LT,
const std::vector< casadi_int > &  p 
)
friend

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

Definition at line 582 of file matrix_decl.hpp.

◆ lift

MX lift ( const MX x,
const MX x_guess 
)
friend

Experimental feature

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

Definition at line 800 of file mx.hpp.

◆ linear_coeff

template<typename MatType >
void casadi::GenericMatrix< MatType >::linear_coeff ( const MatType &  expr,
const MatType &  var,
MatType &  A,
MatType &  b,
bool  check = true 
)
friend

A x + b

Parameters
check[in]When true (default)m, A is checked to be independent of x. Provided to deal with false positive dependency checks.

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

Definition at line 933 of file generic_matrix.hpp.

◆ linearize

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::linearize ( const MatType &  f,
const MatType &  x,
const MatType &  x0,
const Dict opts = Dict() 
)
friend

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

Definition at line 740 of file generic_matrix.hpp.

◆ linspace

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::linspace ( const MatType &  a,
const MatType &  b,
casadi_int  nsteps 
)
friend

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

Definition at line 460 of file generic_matrix.hpp.

◆ logsumexp [1/2]

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::logsumexp ( const MatType &  x)
friend

Can be used to achieve a smooth max.

Implementations for DM/SX/MX are hardened against overflow Implementations for DM/MX are more accurate with log1p (*)

(*) https://nhigham.com/2021/01/05/what-is-the-log-sum-exp-function/

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

Definition at line 443 of file generic_matrix.hpp.

◆ logsumexp [2/2]

template<typename MatType >
MatType logsumexp ( const MatType &  x,
const MatType &  margin 
)
friend

Scaled such that max(x) <= logsumexp(x, margin) <= max(x)+margin

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

Definition at line 451 of file generic_matrix.hpp.

◆ low

MX low ( const MX v,
const MX p,
const Dict options = Dict() 
)
friend

If failed, returns the number of rows

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

Definition at line 713 of file mx.hpp.

◆ matrix_expand [1/2]

MX matrix_expand ( const MX e,
const std::vector< MX > &  boundary = std::vector<MX>(),
const Dict options = Dict() 
)
friend

Expand the given expression e, optionally supplying expressions contained in it at which expansion should stop.

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

Definition at line 747 of file mx.hpp.

◆ matrix_expand [2/2]

std::vector<MX> matrix_expand ( const std::vector< MX > &  e,
const std::vector< MX > &  boundary = std::vector<MX>(),
const Dict options = Dict() 
)
friend

Expand the given expression e, optionally supplying expressions contained in it at which expansion should stop.

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

Definition at line 759 of file mx.hpp.

◆ minor

template<typename Scalar >
Matrix<Scalar> minor ( const Matrix< Scalar > &  x,
casadi_int  i,
casadi_int  j 
)
friend

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

Definition at line 511 of file matrix_decl.hpp.

◆ mldivide

template<typename MatType >
MatType mldivide ( const MatType &  x,
const MatType &  n 
)
friend

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

Definition at line 383 of file generic_matrix.hpp.

◆ mmax

template<typename MatType >
MatType mmax ( const MatType &  x)
friend

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

Definition at line 997 of file generic_matrix.hpp.

◆ mmin

template<typename MatType >
MatType mmin ( const MatType &  x)
friend

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

Definition at line 988 of file generic_matrix.hpp.

◆ mpower

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::mpower ( const MatType &  x,
const MatType &  n 
)
friend

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

Definition at line 319 of file generic_matrix.hpp.

◆ mrdivide

template<typename MatType >
MatType mrdivide ( const MatType &  x,
const MatType &  n 
)
friend

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

Definition at line 376 of file generic_matrix.hpp.

◆ mtaylor [1/2]

template<typename Scalar >
Matrix<Scalar> mtaylor ( const Matrix< Scalar > &  ex,
const Matrix< Scalar > &  x,
const Matrix< Scalar > &  a,
casadi_int  order,
const std::vector< casadi_int > &  order_contributions 
)
friend

Do Taylor expansions until the aggregated order of a term is equal to 'order'. The aggregated order of $x^n y^m$ equals $n+m$.

The argument order_contributions can denote how match each variable contributes to the aggregated order. If x=[x, y] and order_contributions=[1, 2], then the aggregated order of $x^n y^m$ equals $1n+2m$.

Example usage

taylor(sin(x+y),[x, y],[a, b], 1)
friend Matrix< Scalar > taylor(const Matrix< Scalar > &ex, const Matrix< Scalar > &x, const Matrix< Scalar > &a, casadi_int order=1)
univariate Taylor series expansion

$ \sin(b+a)+\cos(b+a)(x-a)+\cos(b+a)(y-b) $

taylor(sin(x+y),[x, y],[0, 0], 4)

$ y+x-(x^3+3y x^2+3 y^2 x+y^3)/6 $

taylor(sin(x+y),[x, y],[0, 0], 4,[1, 2])

$ (-3 x^2 y-x^3)/6+y+x $

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

Definition at line 801 of file matrix_decl.hpp.

◆ mtaylor [2/2]

template<typename Scalar >
Matrix<Scalar> mtaylor ( const Matrix< Scalar > &  ex,
const Matrix< Scalar > &  x,
const Matrix< Scalar > &  a,
casadi_int  order = 1 
)
friend

Do Taylor expansions until the aggregated order of a term is equal to 'order'. The aggregated order of $x^n y^m$ equals $n+m$.

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

Definition at line 770 of file matrix_decl.hpp.

◆ n_nodes

template<typename MatType >
casadi_int n_nodes ( const MatType &  A)
friend

Count number of nodes

Definition at line 939 of file generic_matrix.hpp.

◆ no_grad

MX no_grad ( const MX expr)
friend

\seealso stop_diff

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

Definition at line 832 of file mx.hpp.

◆ no_hess

MX no_hess ( const MX expr)
friend

\seealso stop_diff

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

Definition at line 841 of file mx.hpp.

◆ norm_1

template<typename MatType >
MatType norm_1 ( const MatType &  x)
friend

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

Definition at line 539 of file generic_matrix.hpp.

◆ norm_2

template<typename MatType >
MatType norm_2 ( const MatType &  x)
friend

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

Definition at line 534 of file generic_matrix.hpp.

◆ norm_fro

template<typename MatType >
MatType norm_fro ( const MatType &  x)
friend

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

Definition at line 529 of file generic_matrix.hpp.

◆ norm_inf

template<typename MatType >
MatType norm_inf ( const MatType &  x)
friend

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

Definition at line 544 of file generic_matrix.hpp.

◆ norm_inf_mul

template<typename Scalar >
Matrix<Scalar> norm_inf_mul ( const Matrix< Scalar > &  x,
const Matrix< Scalar > &  y 
)
friend

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

Definition at line 605 of file matrix_decl.hpp.

◆ nullspace

template<typename MatType >
MatType nullspace ( const MatType &  A)
friend

Finds Z m-by-(m-n) such that AZ = 0 with A n-by-m with m > n

Assumes A is full rank

Inspired by Numerical Methods in Scientific Computing by Ake Bjorck

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

Definition at line 579 of file generic_matrix.hpp.

◆ pinv [1/2]

template<typename MatType >
MatType pinv ( const MatType &  A)
friend

If the matrix A is fat (size1<size2), mul(A, pinv(A)) is unity.

pinv(A)' = (AA')^(-1) A

If the matrix A is slender (size1>size2), mul(pinv(A), A) is unity.

pinv(A) = (A'A)^(-1) A'

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

Definition at line 757 of file generic_matrix.hpp.

◆ pinv [2/2]

template<typename MatType >
MatType pinv ( const MatType &  A,
const std::string &  lsolver,
const Dict dict = Dict() 
)
friend

If the matrix A is fat (size1>size2), mul(A, pinv(A)) is unity. If the matrix A is slender (size2<size1), mul(pinv(A), A) is unity.

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

Definition at line 767 of file generic_matrix.hpp.

◆ poly_coeff

template<typename Scalar >
Matrix<Scalar> poly_coeff ( const Matrix< Scalar > &  f,
const Matrix< Scalar > &  x 
)
friend
Parameters
exScalar expression that represents a polynomial
xScalar symbol that the polynomial is build up with

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

Definition at line 813 of file matrix_decl.hpp.

◆ poly_roots

template<typename Scalar >
Matrix<Scalar> poly_roots ( const Matrix< Scalar > &  p)
friend

This will only work for polynomials up to order 3 It is assumed that the roots are real.

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

Definition at line 824 of file matrix_decl.hpp.

◆ polyval

template<typename MatType >
MatType polyval ( const MatType &  p,
const MatType &  x 
)
friend

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

Definition at line 586 of file generic_matrix.hpp.

◆ print_operator

template<typename MatType >
std::string print_operator ( const MatType &  xb,
const std::vector< std::string > &  args 
)
friend

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

Definition at line 952 of file generic_matrix.hpp.

◆ project

template<typename MatType >
MatType project ( const MatType &  A,
const Sparsity sp,
bool  intersect = false 
)
friend

nonzeros taken from an existing matrix

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

Definition at line 626 of file generic_matrix.hpp.

◆ pw_const

template<typename Scalar >
Matrix<Scalar> pw_const ( const Matrix< Scalar > &  t,
const Matrix< Scalar > &  tval,
const Matrix< Scalar > &  val 
)
friend

Create a piecewise constant function with n=val.size() intervals

Inputs:

Parameters
ta scalar variable (e.g. time)
tvalvector with the discrete values of t at the interval transitions (length n-1)
valvector with the value of the function for each interval (length n)

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

Definition at line 635 of file matrix_decl.hpp.

◆ pw_lin

template<typename Scalar >
Matrix<Scalar> pw_lin ( const Matrix< Scalar > &  t,
const Matrix< Scalar > &  tval,
const Matrix< Scalar > &  val 
)
friend

Create a piecewise linear function

Create a piecewise linear function:

Inputs:

tval vector with the the discrete values of t (monotonically increasing)

val vector with the corresponding function values (same length as tval)

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

Definition at line 652 of file matrix_decl.hpp.

◆ qr

template<typename Scalar >
void qr ( const Matrix< Scalar > &  A,
Matrix< Scalar > &  Q,
Matrix< Scalar > &  R 
)
friend

More stable than the classical Gram-Schmidt, but may break down if the rows of A are nearly linearly dependent See J. Demmel: Applied Numerical Linear Algebra (algorithm 3.1.). Note that in SWIG, Q and R are returned by value.

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

Definition at line 530 of file matrix_decl.hpp.

◆ qr_solve

template<typename Scalar >
Matrix<Scalar> qr_solve ( const Matrix< Scalar > &  b,
const Matrix< Scalar > &  v,
const Matrix< Scalar > &  r,
const Matrix< Scalar > &  beta,
const std::vector< casadi_int > &  prinv,
const std::vector< casadi_int > &  pc,
bool  tr = false 
)
friend

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

Definition at line 549 of file matrix_decl.hpp.

◆ qr_sparse

template<typename Scalar >
void qr_sparse ( const Matrix< Scalar > &  A,
Matrix< Scalar > &  V,
Matrix< Scalar > &  R,
Matrix< Scalar > &  beta,
std::vector< casadi_int > &  prinv,
std::vector< casadi_int > &  pc,
bool  amd = true 
)
friend

See T. Davis: Direct Methods for Sparse Linear Systems

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

Definition at line 539 of file matrix_decl.hpp.

◆ quadratic_coeff

template<typename MatType >
void casadi::GenericMatrix< MatType >::quadratic_coeff ( const MatType &  expr,
const MatType &  var,
MatType &  A,
MatType &  b,
MatType &  c,
bool  check = true 
)
friend

1/2*x' A x + b' x + c

e = 0.5*bilin(A,x,x)+dot(b,x)+c

Parameters
check[in]When true (default), A is checked to be independent of x. Provided to deal with false positive dependency checks.

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

Definition at line 920 of file generic_matrix.hpp.

◆ ramp

template<typename Scalar >
Matrix<Scalar> ramp ( const Matrix< Scalar > &  x)
friend

\[ \begin {cases} R(x) = 0 & x <= 1 \\ R(x) = x & x > 1 \\ \end {cases} \]

Also called: slope function

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

Definition at line 717 of file matrix_decl.hpp.

◆ rank1

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::rank1 ( const MatType &  A,
const MatType &  alpha,
const MatType &  x,
const MatType &  y 
)
friend

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

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

Definition at line 418 of file generic_matrix.hpp.

◆ rectangle

template<typename Scalar >
Matrix<Scalar> rectangle ( const Matrix< Scalar > &  x)
friend

\[ \begin {cases} \Pi(x) = 1 & |x| < 1/2 \\ \Pi(x) = 1/2 & |x| = 1/2 \\ \Pi(x) = 0 & |x| > 1/2 \\ \end {cases} \]

Also called: gate function, block function, band function, pulse function, window function

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

Definition at line 685 of file matrix_decl.hpp.

◆ repsum

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::repsum ( const MatType &  A,
casadi_int  n,
casadi_int  m = 1 
)
friend

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

Definition at line 980 of file generic_matrix.hpp.

◆ reverse

template<typename MatType >
std::vector<std::vector<MatType> > reverse ( const std::vector< MatType > &  ex,
const std::vector< MatType > &  arg,
const std::vector< std::vector< MatType > > &  v,
const Dict opts = Dict() 
)
friend

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

Definition at line 851 of file generic_matrix.hpp.

◆ shared

template<typename MatType >
void shared ( std::vector< MatType > &  ex,
std::vector< MatType > &  v,
std::vector< MatType > &  vdef,
const std::string &  v_prefix = "v_",
const std::string &  v_suffix = "" 
)
friend

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

Definition at line 969 of file generic_matrix.hpp.

◆ simplify

template<typename MatType >
MatType simplify ( const MatType &  x)
friend

Definition at line 944 of file generic_matrix.hpp.

◆ skew

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::skew ( const MatType &  a)
friend

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

Definition at line 474 of file generic_matrix.hpp.

◆ soc

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::soc ( const MatType &  x,
const MatType &  y 
)
friend
Parameters
[in]xvector expression of size n
[in]yscalar expression

soc(x,y) computes [y*eye(n) x; x' y]

soc(x,y) positive semi definite <=> || x ||_2 <= y

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

Definition at line 334 of file generic_matrix.hpp.

◆ solve [1/2]

template<typename MatType >
MatType solve ( const MatType &  A,
const MatType &  b 
)
friend

The solve routine works similar to Matlab's backslash when A is square and nonsingular. The algorithm used is the following:

  1. A simple forward or backward substitution if A is upper or lower triangular
  2. If the linear system is at most 3-by-3, form the inverse via minor expansion and multiply
  3. Permute the variables and equations as to get a (structurally) nonzero diagonal, then perform a QR factorization without pivoting and solve the factorized system.

Note 1: If there are entries of the linear system known to be zero, these will be removed. Elements that are very small, or will evaluate to be zero, can still cause numerical errors, due to the lack of pivoting (which is not possible since cannot compare the size of entries)

Note 2: When permuting the linear system, a BLT (block lower triangular) transformation is formed. Only the permutation part of this is however used. An improvement would be to solve block-by-block if there are multiple BLT blocks.

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

Definition at line 724 of file generic_matrix.hpp.

◆ solve [2/2]

template<typename MatType >
MatType solve ( const MatType &  A,
const MatType &  b,
const std::string &  lsolver,
const Dict dict = Dict() 
)
friend

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

Definition at line 731 of file generic_matrix.hpp.

◆ sparsify

template<typename Scalar >
Matrix<Scalar> sparsify ( const Matrix< Scalar > &  A,
double  tol = 0 
)
friend

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

Definition at line 613 of file matrix_decl.hpp.

◆ stop_diff [1/2]

MX stop_diff ( const MX expr,
casadi_int  order 
)
friend

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

Definition at line 823 of file mx.hpp.

◆ stop_diff [2/2]

MX stop_diff ( const MX expr,
const MX var,
casadi_int  order 
)
friend

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

Definition at line 849 of file mx.hpp.

◆ substitute [1/2]

template<typename MatType >
MatType substitute ( const MatType &  ex,
const MatType &  v,
const MatType &  vdef 
)
friend

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

Definition at line 664 of file generic_matrix.hpp.

◆ substitute [2/2]

template<typename MatType >
std::vector<MatType> substitute ( const std::vector< MatType > &  ex,
const std::vector< MatType > &  v,
const std::vector< MatType > &  vdef 
)
friend

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

Definition at line 673 of file generic_matrix.hpp.

◆ substitute_inplace

template<typename MatType >
void substitute_inplace ( const std::vector< MatType > &  v,
std::vector< MatType > &  inout_vdef,
std::vector< MatType > &  inout_ex,
bool  reverse = false 
)
friend

Substitute variables v out of the expressions vdef sequentially, as well as out of a number of other expressions piggyback

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

Definition at line 685 of file generic_matrix.hpp.

◆ sumsqr

template<typename MatType >
MatType sumsqr ( const MatType &  x)
friend

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

Definition at line 429 of file generic_matrix.hpp.

◆ symvar

template<typename MatType >
std::vector<MatType> symvar ( const MatType &  x)
friend

Get all symbols on which the supplied expression depends

See also
SXFunction::getFree(), MXFunction::getFree()

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

Definition at line 393 of file generic_matrix.hpp.

◆ tangent

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::tangent ( const MatType &  ex,
const MatType &  arg,
const Dict opts = Dict() 
)
friend

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

Definition at line 819 of file generic_matrix.hpp.

◆ taylor [1/2]

template<typename Scalar >
Matrix<Scalar> taylor ( const Matrix< Scalar > &  ex,
const Matrix< Scalar > &  x 
)
friend

Calculate the Taylor expansion of expression 'ex' up to order 'order' with respect to variable 'x' around the point 'a'

$(x)=f(a)+f'(a)(x-a)+f''(a)\frac {(x-a)^2}{2!}+f'''(a)\frac{(x-a)^3}{3!}+\ldots$

Example usage:

taylor(sin(x), x)
>>   x 

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

Definition at line 758 of file matrix_decl.hpp.

◆ taylor [2/2]

template<typename Scalar >
Matrix<Scalar> taylor ( const Matrix< Scalar > &  ex,
const Matrix< Scalar > &  x,
const Matrix< Scalar > &  a,
casadi_int  order = 1 
)
friend

Calculate the Taylor expansion of expression 'ex' up to order 'order' with respect to variable 'x' around the point 'a'

$(x)=f(a)+f'(a)(x-a)+f''(a)\frac {(x-a)^2}{2!}+f'''(a)\frac{(x-a)^3}{3!}+\ldots$

Example usage:

taylor(sin(x), x)
>>   x 

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

Definition at line 754 of file matrix_decl.hpp.

◆ trace

template<typename MatType >
MatType trace ( const MatType &  x)
friend

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

Definition at line 514 of file generic_matrix.hpp.

◆ triangle

template<typename Scalar >
Matrix<Scalar> triangle ( const Matrix< Scalar > &  x)
friend

\[ \begin {cases} \Lambda(x) = 0 & |x| >= 1 \\ \Lambda(x) = 1-|x| & |x| < 1 \end {cases} \]

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

Definition at line 700 of file matrix_decl.hpp.

◆ tril2symm

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::tril2symm ( const MatType &  a)
friend

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

Definition at line 519 of file generic_matrix.hpp.

◆ triu2symm

template<typename MatType >
MatType casadi::GenericMatrix< MatType >::triu2symm ( const MatType &  a)
friend

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

Definition at line 524 of file generic_matrix.hpp.

◆ unite

template<typename MatType >
MatType unite ( const MatType &  A,
const MatType &  B 
)
friend

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

Definition at line 603 of file generic_matrix.hpp.

◆ which_depends

template<typename MatType >
std::vector<bool> which_depends ( const MatType &  expr,
const MatType &  var,
casadi_int  order,
bool  tr 
)
friend

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

Definition at line 874 of file generic_matrix.hpp.