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)
const override;
82 void ad_forward(
const std::vector<std::vector<MX> >& fseed,
83 std::vector<std::vector<MX> >& fsens)
const override;
88 void ad_reverse(
const std::vector<std::vector<MX> >& aseed,
89 std::vector<std::vector<MX> >& asens)
const override;
97 int sp_forward(
const bvec_t** arg, bvec_t** res, casadi_int* iw, bvec_t* w)
const override;
102 int sp_reverse(bvec_t** arg, bvec_t** res, casadi_int* iw, bvec_t* w)
const override;
107 casadi_int
op()
const override {
return OP_SOLVE;}
162 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
165 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
170 size_t sz_w()
const override;
176 const std::vector<casadi_int>& arg,
177 const std::vector<casadi_int>& res,
178 const std::vector<bool>& arg_is_ref,
179 std::vector<bool>& res_is_ref)
const override;
186 return linsol_.
solve(A, B, tr);
231 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
234 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
238 return A->get_solve_triu(B, tr);
245 const std::vector<casadi_int>& arg,
246 const std::vector<casadi_int>& res,
247 const std::vector<bool>& arg_is_ref,
248 std::vector<bool>& res_is_ref)
const override;
272 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
275 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
279 return A->get_solve_tril(B, tr);
286 const std::vector<casadi_int>& arg,
287 const std::vector<casadi_int>& res,
288 const std::vector<bool>& arg_is_ref,
289 std::vector<bool>& res_is_ref)
const override;
323 const Sparsity& A_sp()
const override;
328 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
330 mutable std::mutex A_sp_mtx_;
355 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
358 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
362 return A->get_solve_triu_unity(B, tr);
369 const std::vector<casadi_int>& arg,
370 const std::vector<casadi_int>& res,
371 const std::vector<bool>& arg_is_ref,
372 std::vector<bool>& res_is_ref)
const override;
396 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w)
const override;
399 int eval_sx(
const SXElem** arg,
SXElem** res, casadi_int* iw,
SXElem* w)
const override;
403 return A->get_solve_tril_unity(B, tr);
410 const std::vector<casadi_int>& arg,
411 const std::vector<casadi_int>& res,
412 const std::vector<bool>& arg_is_ref,
413 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.