26 #ifndef CASADI_SOLVE_HPP
27 #define CASADI_SOLVE_HPP
29 #include "mx_node.hpp"
30 #include "casadi_call.hpp"
62 std::string disp(
const std::vector<std::string>& arg)
const override;
77 void eval_mx(
const std::vector<MX>& arg, std::vector<MX>& res,
78 const std::vector<bool>& unique={})
const override;
83 void ad_forward(
const std::vector<std::vector<MX> >& fseed,
84 std::vector<std::vector<MX> >& fsens)
const override;
89 void ad_reverse(
const std::vector<std::vector<MX> >& aseed,
90 std::vector<std::vector<MX> >& asens)
const override;
98 int sp_forward(
const bvec_t** arg, bvec_t** res, casadi_int* iw, bvec_t* w)
const override;
103 int eval_activity(
const bvec_t** arg, bvec_t** res, casadi_int* iw, bvec_t* w)
const override;
108 int sp_reverse(bvec_t** arg, bvec_t** res, casadi_int* iw, bvec_t* w)
const override;
113 casadi_int
op()
const override {
return OP_SOLVE;}
168 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
171 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
176 size_t sz_w()
const override;
181 size_t codegen_sz_w()
const override;
187 const std::vector<casadi_int>& arg,
188 const std::vector<casadi_int>& res,
189 const std::vector<bool>& arg_is_ref,
190 std::vector<bool>& res_is_ref)
const override;
197 return linsol_.
solve(A, B, tr);
242 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
245 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
249 return A->get_solve_triu(B, tr);
256 const std::vector<casadi_int>& arg,
257 const std::vector<casadi_int>& res,
258 const std::vector<bool>& arg_is_ref,
259 std::vector<bool>& res_is_ref)
const override;
283 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
286 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
290 return A->get_solve_tril(B, tr);
297 const std::vector<casadi_int>& arg,
298 const std::vector<casadi_int>& res,
299 const std::vector<bool>& arg_is_ref,
300 std::vector<bool>& res_is_ref)
const override;
334 const Sparsity& A_sp()
const override;
339 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
341 mutable std::mutex A_sp_mtx_;
366 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
369 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
373 return A->get_solve_triu_unity(B, tr);
380 const std::vector<casadi_int>& arg,
381 const std::vector<casadi_int>& res,
382 const std::vector<bool>& arg_is_ref,
383 std::vector<bool>& res_is_ref)
const override;
407 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
410 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
414 return A->get_solve_tril_unity(B, tr);
421 const std::vector<casadi_int>& arg,
422 const std::vector<casadi_int>& res,
423 const std::vector<bool>& arg_is_ref,
424 std::vector<bool>& res_is_ref)
const override;
Helper class for C code generation.
Helper class for Serialization.
Linear solve operation with a linear solver instance.
~LinsolCall() override
Destructor.
MX solve(const MX &A, const MX &B, bool tr) const override
Solve another system with the same factorization.
Linsol linsol_
Linear solver (may be shared between multiple nodes)
DM solve(const DM &A, const DM &B, bool tr=false) const
Node class for MX objects.
Helper class for Serialization.
Linear solve with unity diagonal added.
~SolveUnity() override
Destructor.
std::string mod_suffix() const override
Modifier for linear system, after argument.
std::string mod_prefix() const override
Modifier for linear system, before argument.
An MX atomic for linear solver solution: x = r * A^-1 or x = r * A^-T.
Dict info() const override
virtual const Sparsity & A_sp() const
Sparsity pattern for the linear system.
virtual std::string mod_prefix() const
Modifier for linear system, before argument.
casadi_int op() const override
Get the operation.
virtual std::string mod_suffix() const
Modifier for linear system, after argument.
virtual MX solve(const MX &A, const MX &B, bool tr) const =0
Solve another system with the same factorization.
~Solve() override
Destructor.
casadi_int n_inplace() const override
Can the operation be performed inplace (i.e. overwrite the result)
Linear solve with an upper triangular matrix.
~TrilSolveUnity() override
Destructor.
MX solve(const MX &A, const MX &B, bool tr) const override
Solve another system with the same factorization.
Linear solve with an upper triangular matrix.
MX solve(const MX &A, const MX &B, bool tr) const override
Solve another system with the same factorization.
~TrilSolve() override
Destructor.
Linear solve with an upper triangular matrix, unity diagonal.
~TriuSolveUnity() override
Destructor.
MX solve(const MX &A, const MX &B, bool tr) const override
Solve another system with the same factorization.
Linear solve with an upper triangular matrix.
~TriuSolve() override
Destructor.
MX solve(const MX &A, const MX &B, bool tr) const override
Solve another system with the same factorization.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.