13#ifndef LINEARSYSTEM_HH
14#define LINEARSYSTEM_HH
41 virtual int rows(
int rbegin,
int rend)
const = 0;
42 virtual int cols(
int colbegin,
int colend)
const = 0;
51 virtual void getRHSBlocks(std::vector<double>& rhs,
int rbegin,
int rend)
const = 0;
70 SimpleSparseLinearSystem(std::vector<int>
const& ridx, std::vector<int>
const& cidx, std::vector<double>
const& data, std::vector<double>
const& rhs_)
80 virtual void getRHSBlocks(std::vector<double>& rhs_,
int rbegin,
int rend)
const { rhs_=rhs;}
81 virtual int cols(
int colbegin,
int colend)
const {
return mat.
ncols(); }
82 virtual int rows(
int rowbegin,
int rowend)
const {
return mat.
nrows(); }
91 std::vector<double> rhs;
96 class UnknownLinearization;
99 template<
class Vector,
class Functional>
Traits class to choose the right linearization class.
UnknownLinearization Linearization
SparseIndexInt nrows() const
Returns number of rows (computes them, if not known)
SparseIndexInt ncols() const
Returns number of cols (computes them, if not known)
std::vector< SparseIndexInt > ridx
row indices
std::vector< SparseIndexInt > cidx
column indices
std::vector< Scalar > data
data
Simple Implementation for SparseLinearSystem.
virtual int rows(int rowbegin, int rowend) const
virtual void getMatrixBlocks(MatrixAsTriplet< double > &mat_, int rbegin, int rend, int colbegin, int colend) const
Return matrix blocks of the linear system in triplet format.
virtual int nRowBlocks() const
number of row blocks
SimpleSparseLinearSystem(std::vector< int >const &ridx, std::vector< int >const &cidx, std::vector< double >const &data, std::vector< double >const &rhs_)
Construction.
virtual double getValue() const
value of function
virtual void getRHSBlocks(std::vector< double > &rhs_, int rbegin, int rend) const
Return components of the right hand side of the linear system.
virtual int nColBlocks() const
number of column blocks
virtual int cols(int colbegin, int colend) const
Abstract base class for a sparse linear system.
virtual ~SparseLinearSystem()
virtual void getMatrixBlocks(MatrixAsTriplet< double > &mat, int rbegin, int rend, int colbegin, int colend) const =0
Return matrix blocks of the linear system in triplet format.
virtual void getRHSBlocks(std::vector< double > &rhs, int rbegin, int rend) const =0
Return components of the right hand side of the linear system.
virtual void getMatrix(MatrixAsTriplet< double > &mat) const
Return the matrix of the linear system in triplet format.
virtual int cols(int colbegin, int colend) const =0
virtual int nRowBlocks() const =0
number of row blocks
virtual int size() const
Return the number of variables of the linear system.
virtual int rows(int rbegin, int rend) const =0
virtual int nColBlocks() const =0
number of column blocks
virtual void getRHS(std::vector< double > &rhs) const
Return the right hand side of the linear system.
virtual double getValue() const =0
value of function