3#ifndef DUNE_ISTL_BTDMATRIX_HH
4#define DUNE_ISTL_BTDMATRIX_HH
6#include <dune/common/fmatrix.hh>
24 template <
class B,
class A=std::allocator<B> >
70 for (
int i=1; i<size-1; i++)
81 for (
int i=1; i<size-1; i++) {
112 void solve (V& x,
const V& rhs)
const {
116 (*this)[0][0].solve(x[0],rhs[0]);
122 std::vector<block_type> c(this->
N()-1);
123 for (
size_t i=0; i<this->
N()-1; i++)
124 c[i] = (*
this)[i][i+1];
135 typename V::block_type
d_0_tmp =
d[0];
138 for (
unsigned int i = 1; i < this->
N(); i++) {
142 FMatrixHelp::multMatrix((*
this)[i][i-1],c[i-1],
tmp);
150 FMatrixHelp::multMatrix(
id,
tmp, c[i]);
154 (*this)[i][i-1].mmv(
d[i-1],
d[i]);
155 typename V::block_type
tmpVec =
d[i];
162 x[this->
N() - 1] = d[this->
N() - 1];
163 for (
int i = this->
N() - 2; i >= 0; i--) {
166 c[i].mmv(x[i+1], x[i]);
182 void endrowsizes () {}
184 void endindices () {}
Implementation of the BCRSMatrix class.
Col col
Definition matrixmatrix.hh:347
Definition basearray.hh:19
Statistics about compression achieved in implicit mode.
Definition bcrsmatrix.hh:81
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:412
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1107
void setrowsize(size_type i, size_type s)
Set number of indices in row i to s.
Definition bcrsmatrix.hh:1075
@ random
Build entries randomly.
Definition bcrsmatrix.hh:478
::Dune::CompressionStatistics< size_type > CompressionStatistics
The type for the statistics object returned by compress()
Definition bcrsmatrix.hh:449
void addindex(size_type row, size_type col)
add index (row,col) to the matrix
Definition bcrsmatrix.hh:1149
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1206
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1892
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:867
A block-tridiagonal matrix.
Definition btdmatrix.hh:26
void solve(V &x, const V &rhs) const
Use the Thomas algorithm to solve the system Ax=b in O(n) time.
Definition btdmatrix.hh:112
A::size_type size_type
implement row_type with compressed vector
Definition btdmatrix.hh:44
A allocator_type
export the allocator type
Definition btdmatrix.hh:38
B::field_type field_type
export the type representing the field
Definition btdmatrix.hh:32
B block_type
export the type representing the components
Definition btdmatrix.hh:35
BTDMatrix(int size)
Definition btdmatrix.hh:52
BTDMatrix & operator=(const BTDMatrix &other)
assignment
Definition btdmatrix.hh:95
BTDMatrix()
Default constructor.
Definition btdmatrix.hh:50
@ blocklevel
Definition btdmatrix.hh:47