26 #ifndef CASADI_LAPACK_LU_HPP
27 #define CASADI_LAPACK_LU_HPP
29 #include "casadi/core/linsol_internal.hpp"
30 #include <casadi/interfaces/lapack/casadi_linsol_lapacklu_export.h>
34 void dgetrf_(
int *m,
int *n,
double *a,
int *lda,
int *ipiv,
int *info);
37 void dgetrs_(
char* trans,
int *n,
int *nrhs,
double *a,
38 int *lda,
int *ipiv,
double *b,
int *ldb,
int *info);
41 void dgeequ_(
int *m,
int *n,
double *a,
int *lda,
double *r,
double *c,
42 double *colcnd,
double *rowcnd,
double *amax,
int *info);
45 void dlaqge_(
int *m,
int *n,
double *a,
int *lda,
double *r,
double *c,
46 double *colcnd,
double *rowcnd,
double *amax,
char *equed);
62 struct LapackLuMemory :
public LinsolMemory {
64 std::vector<double> mat;
67 std::vector<int> ipiv;
70 std::vector<double> r, c;
82 class LapackLu :
public LinsolInternal {
85 LapackLu(
const std::string& name,
const Sparsity& sp);
88 static LinsolInternal* creator(
const std::string& name,
const Sparsity& sp) {
89 return new LapackLu(name, sp);
97 static const Options options_;
98 const Options& get_options()
const override {
return options_;}
102 void init(
const Dict& opts)
override;
105 void* alloc_mem()
const override {
return new LapackLuMemory();}
108 int init_mem(
void* mem)
const override;
111 void free_mem(
void *mem)
const override {
delete static_cast<LapackLuMemory*
>(mem);}
114 int nfact(
void* mem,
const double* A)
const override;
117 int solve(
void* mem,
const double* A,
double* x, casadi_int nrhs,
bool tr)
const override;
120 static const std::string meta_doc;
123 void serialize_body(SerializingStream &s)
const override;
126 static ProtoFunction* deserialize(DeserializingStream& s) {
return new LapackLu(s); }
130 explicit LapackLu(DeserializingStream& s);
136 bool allow_equilibration_failure_;
139 const char* plugin_name()
const override {
return "lapacklu";}
142 std::string class_name()
const override {
return "LapackLu";}
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.