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>
40 #define CASADI_LAPACK_CHARLEN_1 , 1
41 #define CASADI_LAPACK_CHARLEN_DECL_1 , size_t len1
42 #define CASADI_LAPACK_CHARLEN_DECL_2 , size_t len1, size_t len2
43 #define CASADI_LAPACK_CHARLEN_DECL_4 , size_t len1, size_t len2, size_t len3, size_t len4
44 #define CASADI_LAPACK_CHARLEN_2 , 1, 1
45 #define CASADI_LAPACK_CHARLEN_4 , 1, 1, 1, 1
47 #define CASADI_LAPACK_CHARLEN_1
48 #define CASADI_LAPACK_CHARLEN_DECL_1
49 #define CASADI_LAPACK_CHARLEN_DECL_2
50 #define CASADI_LAPACK_CHARLEN_DECL_4
51 #define CASADI_LAPACK_CHARLEN_2
52 #define CASADI_LAPACK_CHARLEN_4
57 void dgetrf_(
int *m,
int *n,
double *a,
int *lda,
int *ipiv,
int *info);
60 void dgetrs_(
char* trans,
int *n,
int *nrhs,
double *a,
61 int *lda,
int *ipiv,
double *b,
int *ldb,
int *info
62 CASADI_LAPACK_CHARLEN_DECL_1);
65 void dgeequ_(
int *m,
int *n,
double *a,
int *lda,
double *r,
double *c,
66 double *colcnd,
double *rowcnd,
double *amax,
int *info);
69 void dlaqge_(
int *m,
int *n,
double *a,
int *lda,
double *r,
double *c,
70 double *colcnd,
double *rowcnd,
double *amax,
char *equed
71 CASADI_LAPACK_CHARLEN_DECL_1);
87 struct LapackLuMemory :
public LinsolMemory {
89 std::vector<double> mat;
92 std::vector<int> ipiv;
95 std::vector<double> r, c;
107 class LapackLu :
public LinsolInternal {
110 LapackLu(
const std::string& name,
const Sparsity& sp);
113 static LinsolInternal* creator(
const std::string& name,
const Sparsity& sp) {
114 return new LapackLu(name, sp);
118 ~LapackLu()
override;
122 static const Options options_;
123 const Options& get_options()
const override {
return options_;}
127 void init(
const Dict& opts)
override;
130 void* alloc_mem()
const override {
return new LapackLuMemory();}
133 int init_mem(
void* mem)
const override;
136 void free_mem(
void *mem)
const override {
delete static_cast<LapackLuMemory*
>(mem);}
139 int nfact(
void* mem,
const double* A)
const override;
142 int solve(
void* mem,
const double* A,
double* x, casadi_int nrhs,
bool tr)
const override;
145 static const std::string meta_doc;
148 void serialize_body(SerializingStream &s)
const override;
151 static ProtoFunction* deserialize(DeserializingStream& s) {
return new LapackLu(s); }
155 explicit LapackLu(DeserializingStream& s);
161 bool allow_equilibration_failure_;
164 const char* plugin_name()
const override {
return "lapacklu";}
167 std::string class_name()
const override {
return "LapackLu";}
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.