26 #include "slicot_expm.hpp"
27 #include "slicot_layer.hpp"
28 #include "slicot_la.hpp"
30 #include "../../core/casadi_misc.hpp"
31 #include "../../core/mx_function.hpp"
32 #include "../../core/sx_function.hpp"
41 int CASADI_EXPM_SLICOT_EXPORT
44 plugin->name =
"slicot";
46 plugin->version = CASADI_VERSION;
64 bool SlicotExpm::has_loaded_ =
false;
70 casadi_warning(
"Loaded plugin with GPL license.");
85 casadi_int*& iw,
double*& w)
const {
94 m->iwork =
reinterpret_cast<int*
>(iw);
104 casadi_int* iw,
double* w,
void* mem)
const {
107 setup(mem, arg, res, iw, w);
110 int ret =
slicot_mb05nd(n_, arg[1][0], arg[0], n_, m->A, n_, m->H, n_,
111 tol, m->iwork, m->dwork, 2*n_*n_);
112 casadi_assert(ret==0,
"Slicot mb05nd failed with status " +
str(ret) +
".");
113 if (res[0]) std::copy(m->A, m->A+n_*n_, res[0]);
void init(const Dict &opts) override
Initialize.
static const Options options_
Options.
void alloc_iw(size_t sz_iw, bool persistent=false)
Ensure required length of iw field.
virtual void set_work(void *mem, const double **&arg, double **&res, casadi_int *&iw, double *&w) const
Set the (persistent) work vectors.
void alloc_w(size_t sz_w, bool persistent=false)
Ensure required length of w field.
void setup(void *mem, const double **arg, double **res, casadi_int *iw, double *w) const
Set the (persistent and temporary) work vectors.
static void registerPlugin(const Plugin &plugin, bool needs_lock=true)
Register an integrator in the factory.
virtual int init_mem(void *mem) const
Initalize memory block.
void clear_mem()
Clear all memory (called from destructor)
static Expm * creator(const std::string &name, const Sparsity &A)
Create a new QP Solver.
~SlicotExpm() override
Destructor.
int init_mem(void *mem) const override
Initalize memory block.
int eval(const double **arg, double **res, casadi_int *iw, double *w, void *mem) const override
Evaluate numerically.
void init(const Dict &opts) override
Initialize.
static const std::string meta_doc
A documentation string.
void set_work(void *mem, const double **&arg, double **&res, casadi_int *&iw, double *&w) const override
Set the (persistent) work vectors.
casadi_int size1() const
Get the number of rows.
int CASADI_EXPM_SLICOT_EXPORT casadi_register_expm_slicot(Expm::Plugin *plugin)
std::string str(const T &v)
String representation, any type.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
void CASADI_EXPM_SLICOT_EXPORT casadi_load_expm_slicot()
int slicot_mb05nd(int n, double delta, const double *a, int lda, double *ex, int ldex, double *exint, int ldexin, double tol, int *iwork, double *dwork, int ldwork)