26 #ifndef CASADI_CSPARSE_INTERFACE_HPP
27 #define CASADI_CSPARSE_INTERFACE_HPP
40 #include "casadi/core/linsol_internal.hpp"
41 #include <casadi/interfaces/csparse/casadi_linsol_csparse_export.h>
44 struct CsparseMemory :
public LinsolMemory {
58 std::vector<double> temp_;
60 std::vector<int> colind, row;
67 class CsparseInterface :
public LinsolInternal {
71 CsparseInterface(
const std::string& name,
const Sparsity& sp);
74 static LinsolInternal* creator(
const std::string& name,
const Sparsity& sp) {
75 return new CsparseInterface(name, sp);
79 ~CsparseInterface()
override;
82 void init(
const Dict& opts)
override;
85 void* alloc_mem()
const override {
return new CsparseMemory();}
88 int init_mem(
void* mem)
const override;
91 void free_mem(
void *mem)
const override {
delete static_cast<CsparseMemory*
>(mem);}
94 int sfact(
void* mem,
const double* A)
const override;
97 int nfact(
void* mem,
const double* A)
const override;
100 int solve(
void* mem,
const double* A,
double* x, casadi_int nrhs,
bool tr)
const override;
103 static const std::string meta_doc;
106 const char* plugin_name()
const override {
return "csparse";}
109 std::string class_name()
const override {
return "CsparseInterface";}
112 static ProtoFunction* deserialize(DeserializingStream& s) {
return new CsparseInterface(s); }
116 explicit CsparseInterface(DeserializingStream& s) : LinsolInternal(s) {}
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.