27 #include "ma27_interface.hpp"
28 #include "casadi/core/global_options.hpp"
33 int CASADI_LINSOL_MA27_EXPORT
36 plugin->name =
"ma27";
38 plugin->version = CASADI_VERSION;
68 ma27id_(m->icntl, m->cntl);
74 casadi_int N = this->
ncol();
75 casadi_int
nnz = this->
nnz();
76 double liw_factor = 2;
77 m->iw.resize(ceil(liw_factor * (2*
nnz+3*N+1)));
79 m->nz.resize(ceil(la_factor *
nnz));
89 casadi_assert_dev(A!=
nullptr);
92 const casadi_int
ncol = this->
ncol();
94 const casadi_int*
row = this->
row();
98 for (casadi_int cc=0; cc<
ncol; ++cc) {
100 casadi_int rr=
row[el];
113 int N = this->
ncol();
116 int LIW = m->iw.size();
121 get_ptr(m->ikeep),
get_ptr(m->iw1), &m->nsteps, &iflag, m->icntl, m->cntl,
124 casadi_int ierror = info[1];
126 casadi_int nirnec = info[5];
127 casadi_assert(iflag==0,
128 "ma27ad_ returns iflag = " +
str(iflag) +
" with ierror = " +
str(ierror));
131 double la_init_factor = 20.0;
132 casadi_int la_min = ceil(la_init_factor * nirnec);
133 if (la_min > m->nz.size()) m->nz.resize(la_min);
134 double liw_init_factor = 5.0;
135 casadi_int liw_min = ceil(liw_init_factor * nirnec);
136 if (liw_min > m->iw.size()) m->iw.resize(liw_min);
139 int LA = m->nz.size();
143 &m->maxfrt,
get_ptr(m->iw1), m->icntl, m->cntl, info);
149 }
else if (iflag == -5) {
152 }
else if (iflag != 0) {
153 casadi_error(
"ma2bd_ returns iflag = " +
str(iflag)
154 +
" with ierror = " +
str(ierror));
160 if (m->w.size() < m->maxfrt) m->w.resize(m->maxfrt);
166 casadi_assert_dev(m->is_nfact);
172 casadi_assert_dev(m->is_nfact);
180 int N = this->
ncol();
181 int LA = m->nz.size();
182 int LIW = m->iw.size();
183 for (casadi_int k=0; k<nrhs; ++k) {
185 &m->maxfrt, x,
get_ptr(m->iw1), &m->nsteps, m->icntl, m->cntl);
const casadi_int * colind() const
void init(const Dict &opts) override
Initialize.
const casadi_int * row() const
int init_mem(void *mem) const override
Initalize memory block.
Ma27Interface(const std::string &name, const Sparsity &sp)
casadi_int neig(void *mem, const double *A) const override
Number of negative eigenvalues.
int solve(void *mem, const double *A, double *x, casadi_int nrhs, bool tr) const override
static const std::string meta_doc
A documentation string.
casadi_int rank(void *mem, const double *A) const override
Matrix rank.
int nfact(void *mem, const double *A) const override
Numeric factorization.
void init(const Dict &opts) override
Initialize.
~Ma27Interface() override
static ProtoFunction * deserialize(DeserializingStream &s)
Deserialize with type disambiguation.
int init_mem(void *mem) const override
Initalize memory block.
static LinsolInternal * creator(const std::string &name, const Sparsity &sp)
Create a new Linsol.
static void registerPlugin(const Plugin &plugin, bool needs_lock=true)
Register an integrator in the factory.
static const Options options_
Options.
void clear_mem()
Clear all memory (called from destructor)
void CASADI_LINSOL_MA27_EXPORT casadi_load_linsol_ma27()
std::string str(const T &v)
String representation, any type.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
int CASADI_LINSOL_MA27_EXPORT casadi_register_linsol_ma27(LinsolInternal::Plugin *plugin)
T * get_ptr(std::vector< T > &v)
Get a pointer to the data contained in the vector.