List of all members | Public Member Functions | Static Public Member Functions
casadi::Linsol Class Reference

Linear solver. More...

#include <linsol.hpp>

Detailed Description

Create a solver for linear systems of equations Solves the linear system A*X = B or A^T*X = B for X with A square and non-singular

If A is structurally singular, an error will be thrown during init. If A is numerically singular, the prepare step will fail.

General information

List of plugins

- csparsecholesky

- csparse

- ma27

- lapacklu

- lapackqr

- mumps

- ldl

- qr

- tridiag

- symbolicqr

Note: some of the plugins in this list might not be available on your system. Also, there might be extra plugins available to you that are not listed here. You can obtain their documentation with Linsol.doc("myextraplugin")


csparsecholesky

Linsol with CSparseCholesky Interface

Extra doc: https://github.com/casadi/casadi/wiki/L_21u


csparse

Linsol with CSparse Interface

Extra doc: https://github.com/casadi/casadi/wiki/L_21t


ma27

Interface to the sparse direct linear solver MA27 Works for symmetric indefinite systems Partly adopted from qpOASES 3.2

Author
Joel Andersson
Date
2016

Extra doc: https://github.com/casadi/casadi/wiki/L_229


lapacklu

This class solves the linear system A.x=b by making an LU factorization of A:
A = L.U, with L lower and U upper triangular

Extra doc: https://github.com/casadi/casadi/wiki/L_22h


List of available options
IdTypeDescription
allow_equilibration_failureOT_BOOLNon-fatal error when equilibration fails
equilibrationOT_BOOLEquilibrate the matrix

lapackqr

This class solves the linear system A.x=b by making an QR factorization of A:
A = Q.R, with Q orthogonal and R upper triangular

Extra doc: https://github.com/casadi/casadi/wiki/L_22g


List of available options
IdTypeDescription
max_nrhsOT_INTMaximum number of right-hand-sides that get processed in a single pass [default:10].

mumps

Interface to the sparse direct linear solver MUMPS Works for symmetric indefinite systems

Author
Joel Andersson
Date
2019

Extra doc: https://github.com/casadi/casadi/wiki/L_22t


List of available options
IdTypeDescription
posdefOT_BOOLPositive definite
symmetricOT_BOOLSymmetric matrix

ldl

Linear solver using sparse direct LDL factorization

Extra doc: https://github.com/casadi/casadi/wiki/L_233


qr

Linear solver using sparse direct QR factorization

Extra doc: https://github.com/casadi/casadi/wiki/L_22z


tridiag

Linear solver for tridiagonal matrices

Extra doc: https://github.com/casadi/casadi/wiki/L_22v


symbolicqr

Linear solver for sparse least-squares problems Inspired from https://github.com/scipy/scipy/blob/v0.14.0/scipy/sparse/linalg/isolve/lsqr.py#L96

Extra doc: https://github.com/casadi/casadi/wiki/L_230

Linsol based on QR factorization with sparsity pattern based reordering without partial pivoting

Extra doc: https://github.com/casadi/casadi/wiki/L_231


List of available options
IdTypeDescription
foptsOT_DICTOptions to be passed to generated function objects
Author
Joel Andersson
Date
2011-2016

Extra doc: https://github.com/casadi/casadi/wiki/L_1kh

Definition at line 53 of file linsol.hpp.

Inheritance diagram for casadi::Linsol:
Inheritance graph
[legend]

Public Member Functions

 Linsol ()
 Default constructor. More...
 
 Linsol (const std::string &name, const std::string &solver, const Sparsity &sp, const Dict &opts=Dict())
 Constructor. More...
 
LinsolInternal * operator-> ()
 Access functions of the node. More...
 
const LinsolInternal * operator-> () const
 
std::string plugin_name () const
 Query plugin name. More...
 
const Sparsitysparsity () const
 Get linear system sparsity. More...
 
void sfact (const DM &A) const
 Symbolic factorization of the linear system, e.g. selecting pivots. More...
 
void nfact (const DM &A) const
 Numeric factorization of the linear system. More...
 
casadi_int neig (const DM &A) const
 Number of negative eigenvalues. More...
 
casadi_int rank (const DM &A) const
 Matrix rank. More...
 
Dict stats (int mem=1) const
 Get all statistics obtained at the end of the last evaluate call. More...
 
std::string class_name () const
 Get class name. More...
 
void disp (std::ostream &stream, bool more=false) const
 Print a description of the object. More...
 
std::string get_str (bool more=false) const
 Get string representation. More...
 
bool is_null () const
 Is a null pointer? More...
 
casadi_int __hash__ () const
 Returns a number that is unique for a given Node. More...
 
DM solve (const DM &A, const DM &B, bool tr=false) const
 
MX solve (const MX &A, const MX &B, bool tr=false) const
 

Static Public Member Functions

static std::string type_name ()
 Get type name. More...
 
static bool has_plugin (const std::string &name)
 Check if a plugin is available. More...
 
static void load_plugin (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
static std::string doc (const std::string &name)
 Get solver specific documentation. More...
 

Constructor & Destructor Documentation

◆ Linsol() [1/2]

casadi::Linsol::Linsol ( )

◆ Linsol() [2/2]

casadi::Linsol::Linsol ( const std::string &  name,
const std::string &  solver,
const Sparsity sp,
const Dict opts = Dict() 
)
explicit

Member Function Documentation

◆ __hash__()

casadi_int casadi::SharedObject::__hash__ ( ) const
inherited

If the Object does not point to any node, "0" is returned.

Extra doc: https://github.com/casadi/casadi/wiki/L_av

◆ class_name()

std::string casadi::SharedObject::class_name ( ) const
inherited

◆ disp()

void casadi::SharedObject::disp ( std::ostream &  stream,
bool  more = false 
) const
inherited

◆ doc()

static std::string casadi::Linsol::doc ( const std::string &  name)
static

◆ get_str()

std::string casadi::SharedObject::get_str ( bool  more = false) const
inlineinherited

Definition at line 138 of file shared_object.hpp.

◆ has_plugin()

static bool casadi::Linsol::has_plugin ( const std::string &  name)
static

◆ is_null()

bool casadi::SharedObject::is_null ( ) const
inherited

◆ load_plugin()

static void casadi::Linsol::load_plugin ( const std::string &  name)
static

◆ neig()

casadi_int casadi::Linsol::neig ( const DM A) const

Not available for all solvers

Extra doc: https://github.com/casadi/casadi/wiki/L_1kk

◆ nfact()

void casadi::Linsol::nfact ( const DM A) const

◆ operator->() [1/2]

LinsolInternal* casadi::Linsol::operator-> ( )

◆ operator->() [2/2]

const LinsolInternal* casadi::Linsol::operator-> ( ) const

◆ plugin_name()

std::string casadi::Linsol::plugin_name ( ) const

◆ rank()

casadi_int casadi::Linsol::rank ( const DM A) const

Not available for all solvers

Extra doc: https://github.com/casadi/casadi/wiki/L_1kl

◆ sfact()

void casadi::Linsol::sfact ( const DM A) const

◆ solve() [1/2]

DM casadi::Linsol::solve ( const DM A,
const DM B,
bool  tr = false 
) const

Solve linear system of equations

◆ solve() [2/2]

MX casadi::Linsol::solve ( const MX A,
const MX B,
bool  tr = false 
) const

Solve linear system of equations

◆ sparsity()

const Sparsity& casadi::Linsol::sparsity ( ) const

◆ stats()

Dict casadi::Linsol::stats ( int  mem = 1) const

◆ type_name()

static std::string casadi::Linsol::type_name ( )
inlinestatic

Extra doc: https://github.com/casadi/casadi/wiki/L_1ki

Definition at line 60 of file linsol.hpp.


The documentation for this class was generated from the following file: