dune-fem 2.8.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector > Class Template Reference

SparseRowMatrix. More...

#include <dune/fem/operator/matrix/spmatrix.hh>

Inheritance diagram for Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >:
Inheritance graph

Public Types

typedef T field_type
 matrix field type
 
typedef IndexT size_type
 matrix index type
 
typedef SparseRowMatrix< field_type, size_type, ValuesVector, IndicesVector > ThisType
 
typedef ThisType MatrixBaseType
 

Public Member Functions

 SparseRowMatrix (const ThisType &)=delete
 
 SparseRowMatrix ()
 construct matrix of zero size
 
 SparseRowMatrix (const size_type rows, const size_type cols, const size_type nz)
 
void reserve (const size_type rows, const size_type cols, const size_type nz)
 reserve memory for given rows, columns and number of non zeros
 
template<class Stencil >
void fillPattern (const Stencil &stencil, const size_type rowBlockSize, const size_type colBlockSize)
 reserve memory for given rows, columns and number of non zeros
 
size_type rows () const
 return number of rows
 
size_type cols () const
 return number of columns
 
void set (const size_type row, const size_type col, const field_type val)
 set entry to value (also setting 0 will result in an entry)
 
void add (const size_type row, const size_type col, const field_type val)
 add value to row,col entry
 
template<class ArgDFType , class DestDFType >
void apply (const ArgDFType &f, DestDFType &ret) const
 ret = A*f
 
field_type get (const size_type row, const size_type col) const
 return value of entry (row,col)
 
void clear ()
 set all matrix entries to zero
 
void clearRow (const size_type row)
 set all entries in row to zero
 
void scale (const size_type row, const size_type col, const field_type val)
 scale all entries in row with a given value
 
size_type maxNzPerRow () const
 
size_type numNonZeros () const
 
size_type numNonZeros (size_type row) const
 
std::pair< const field_type, size_typerealValue (size_type index) const
 
void print (std::ostream &s=std::cout, unsigned int offset=0) const
 print matrix
 
template<class SizeT , class NumericT >
void fillCSRStorage (std::vector< std::map< SizeT, NumericT > > &matrix) const
 
void compress ()
 
size_type startRow (const size_type row) const
 
size_type endRow (const size_type row) const
 
std::tuple< ValuesVector &, IndicesVector &, IndicesVector & > exportCRS ()
 

Static Public Attributes

static const size_type defaultCol = std::numeric_limits<size_type>::max()
 
static const size_type zeroCol = std::numeric_limits<size_type>::max()-1
 
static const int firstCol = 0
 

Protected Member Functions

void resize (size_type rows, size_type cols, size_type nz)
 resize matrix
 
size_type colIndex (size_type row, size_type col)
 returns local col index for given global (row,col)
 

Protected Attributes

ValuesVector values_
 
IndicesVector columns_
 
IndicesVector rows_
 
std::array< size_type, 2 > dim_
 
size_type maxNzPerRow_
 
bool compressed_
 

Detailed Description

template<class T, class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
class Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >

SparseRowMatrix.

Member Typedef Documentation

◆ field_type

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
typedef T Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::field_type

matrix field type

◆ MatrixBaseType

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
typedef ThisType Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::MatrixBaseType

type of the base matrix for consistency with ISTLMatrixObject

◆ size_type

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
typedef IndexT Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::size_type

matrix index type

◆ ThisType

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
typedef SparseRowMatrix<field_type,size_type,ValuesVector,IndicesVector> Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::ThisType

Constructor & Destructor Documentation

◆ SparseRowMatrix() [1/3]

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::SparseRowMatrix ( const ThisType )
delete

◆ SparseRowMatrix() [2/3]

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::SparseRowMatrix ( )
inlineexplicit

construct matrix of zero size

◆ SparseRowMatrix() [3/3]

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::SparseRowMatrix ( const size_type  rows,
const size_type  cols,
const size_type  nz 
)
inline

construct matrix with 'rows' rows and 'cols' columns, maximum 'nz' non zero values in each row

Member Function Documentation

◆ add()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::add ( const size_type  row,
const size_type  col,
const field_type  val 
)
inline

add value to row,col entry

◆ apply()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
template<class ArgDFType , class DestDFType >
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::apply ( const ArgDFType &  f,
DestDFType &  ret 
) const
inline

ret = A*f

◆ clear()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::clear ( )
inline

set all matrix entries to zero

◆ clearRow()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::clearRow ( const size_type  row)
inline

set all entries in row to zero

◆ colIndex()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::colIndex ( size_type  row,
size_type  col 
)
inlineprotected

returns local col index for given global (row,col)

◆ cols()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::cols ( ) const
inline

return number of columns

◆ compress()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::compress ( )
inline

◆ endRow()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::endRow ( const size_type  row) const
inline

◆ exportCRS()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
std::tuple< ValuesVector &, IndicesVector &, IndicesVector & > Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::exportCRS ( )
inline

◆ fillCSRStorage()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
template<class SizeT , class NumericT >
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::fillCSRStorage ( std::vector< std::map< SizeT, NumericT > > &  matrix) const
inline

◆ fillPattern()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
template<class Stencil >
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::fillPattern ( const Stencil stencil,
const size_type  rowBlockSize,
const size_type  colBlockSize 
)
inline

reserve memory for given rows, columns and number of non zeros

◆ get()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
field_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::get ( const size_type  row,
const size_type  col 
) const
inline

return value of entry (row,col)

◆ maxNzPerRow()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::maxNzPerRow ( ) const
inline

return max number of non zeros used in SparseRowMatrixObject::reserve

◆ numNonZeros() [1/2]

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::numNonZeros ( ) const
inline

return max number of non zeros used in SparseRowMatrixObject::reserve

◆ numNonZeros() [2/2]

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::numNonZeros ( size_type  row) const
inline

return number of non zeros in row used in ColCompMatrix::setMatrix

◆ print()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::print ( std::ostream &  s = std::cout,
unsigned int  offset = 0 
) const
inline

print matrix

◆ realValue()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
std::pair< const field_type, size_type > Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::realValue ( size_type  index) const
inline

return pair (value,column) used in ColCompMatrix::setMatrix and FemPy CRS matrix export

◆ reserve()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::reserve ( const size_type  rows,
const size_type  cols,
const size_type  nz 
)
inline

reserve memory for given rows, columns and number of non zeros

◆ resize()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::resize ( size_type  rows,
size_type  cols,
size_type  nz 
)
inlineprotected

resize matrix

◆ rows()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::rows ( ) const
inline

return number of rows

◆ scale()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::scale ( const size_type  row,
const size_type  col,
const field_type  val 
)
inline

scale all entries in row with a given value

◆ set()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
void Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::set ( const size_type  row,
const size_type  col,
const field_type  val 
)
inline

set entry to value (also setting 0 will result in an entry)

◆ startRow()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::startRow ( const size_type  row) const
inline

Member Data Documentation

◆ columns_

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
IndicesVector Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::columns_
protected

◆ compressed_

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
bool Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::compressed_
protected

◆ defaultCol

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
const size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::defaultCol = std::numeric_limits<size_type>::max()
static

◆ dim_

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
std::array<size_type,2> Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::dim_
protected

◆ firstCol

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
const int Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::firstCol = 0
static

◆ maxNzPerRow_

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::maxNzPerRow_
protected

◆ rows_

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
IndicesVector Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::rows_
protected

◆ values_

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
ValuesVector Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::values_
protected

◆ zeroCol

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
const size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::zeroCol = std::numeric_limits<size_type>::max()-1
static

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