26 #include "lapack_qr.hpp"
27 #include "../../core/casadi_misc.hpp"
32 int CASADI_LINSOL_LAPACKQR_EXPORT
35 plugin->name =
"lapackqr";
37 plugin->version = CASADI_VERSION;
60 "Maximum number of right-hand-sides that get processed in a single pass [default:10]."}}
71 for (
auto&& op : opts) {
72 if (op.first==
"max_nrhs") {
82 m->tau.resize(
ncol());
99 int lwork = m->work.size();
101 get_ptr(m->work), &lwork, &info);
103 if (
verbose_) casadi_warning(
"dgeqrf_ failed: Info: " +
str(info));
109 int LapackQr::solve(
void* mem,
const double* A,
double* x, casadi_int nrhs,
bool tr)
const {
113 casadi_int offset = 0;
134 char transR = tr ?
'T' :
'N';
137 char transQ = tr ?
'N' :
'T';
139 int k = m->tau.size();
140 int lwork = m->work.size();
147 dtrsm_(&sideR, &uploR, &transR, &diagR, &
ncol, &n_rhs, &alphaR,
154 casadi_assert(info == 0,
155 "LapackQr::solve: dormqr_ A failed to solve the linear system. Info: " +
str(info) +
".");
162 casadi_assert(info == 0,
163 "LapackQr::solve: dormqr_ B failed to solve the linear system. Info: " +
str(info) +
".");
166 dtrsm_(&sideR, &uploR, &transR, &diagR, &
ncol, &n_rhs, &alphaR,
Helper class for Serialization.
void unpack(Sparsity &e)
Reconstruct an object from the input stream.
static const Options options_
Options.
static LinsolInternal * creator(const std::string &name, const Sparsity &sp)
Create a new Linsol.
void serialize_body(SerializingStream &s) const override
Serialize an object without type information.
int init_mem(void *mem) const override
Initalize memory block.
static ProtoFunction * deserialize(DeserializingStream &s)
Deserialize with type disambiguation.
static const Options options_
Options.
int nfact(void *mem, const double *A) const override
Numeric factorization.
int solve(void *mem, const double *A, double *x, casadi_int nrhs, bool tr) const override
void init(const Dict &opts) override
Initialize.
int solve_batch(void *mem, const double *A, double *x, casadi_int nrhs, bool tr) const
static const std::string meta_doc
A documentation string.
LapackQr(const std::string &name, const Sparsity &sp)
void init(const Dict &opts) override
Initialize.
void serialize_body(SerializingStream &s) const override
Serialize an object without type information.
casadi_int nrow() const
Get sparsity pattern.
int init_mem(void *mem) const override
Initalize memory block.
static void registerPlugin(const Plugin &plugin, bool needs_lock=true)
Register an integrator in the factory.
bool verbose_
Verbose printout.
void clear_mem()
Clear all memory (called from destructor)
Helper class for Serialization.
void pack(const Sparsity &e)
Serializes an object to the output stream.
void CASADI_LINSOL_LAPACKQR_EXPORT casadi_load_linsol_lapackqr()
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_densify(const T1 *x, const casadi_int *sp_x, T2 *y, casadi_int tr)
Convert sparse to dense.
T * get_ptr(std::vector< T > &v)
Get a pointer to the data contained in the vector.
int CASADI_LINSOL_LAPACKQR_EXPORT casadi_register_linsol_lapackqr(LinsolInternal::Plugin *plugin)
std::vector< double > mat
Options metadata for a class.