#include <DoubleHashedMatrix.hpp>


Public Types | |
| enum | Type { doubleHashedMatrix, sparseMatrix, unAssembled } |
Public Member Functions | |
| size_t | numberOfColumns () const |
| std::map< size_t, real_t * > ::iterator | beginOfColumn (const size_t &i) |
| std::map< size_t, real_t * > ::iterator | endOfColumn (const size_t &i) |
| size_t | numberOfLines () const |
| std::map< size_t, real_t * > ::iterator | beginOfLine (const size_t &i) |
| std::map< size_t, real_t * > ::iterator | endOfLine (const size_t &i) |
| std::map< size_t, real_t * > ::const_iterator | beginOfLine (const size_t &i) const |
| std::map< size_t, real_t * > ::const_iterator | endOfLine (const size_t &i) const |
| size_t | numberOfLineNonNull (const size_t &i) const |
| void | reset () |
| void | getDiagonal (BaseVector &X) const |
| used to get the diagonal of the Matrix and stores it in the vector X. | |
| void | transposedTimesX (const BaseVector &X, BaseVector &Z) const |
| Computes z = A*x+y. | |
| void | timesX (const BaseVector &X, BaseVector &Z) const |
| Computes z = A*x. | |
| DoubleHashedMatrix (const size_t &i, const size_t &j) | |
| real_t & | operator() (const size_t &i, const size_t &j) |
| ~DoubleHashedMatrix () | |
| const size_t & | size () const |
| const BaseMatrix::Type & | type () const |
Protected Attributes | |
| BaseMatrix::Type | __type |
| size_t | __size |
Private Attributes | |
| std::vector< std::map< size_t, real_t * > > | __lines |
| allows to browse lines | |
| std::vector< std::map< size_t, real_t * > > | __columns |
| allows to brows columns | |
| std::map< DoubleEntry, real_t > | __elements |
| stored the elements | |
Classes | |
| class | const_iterator |
| class | DoubleEntry |
| class | iterator |
Definition at line 42 of file DoubleHashedMatrix.hpp.
enum BaseMatrix::Type [inherited] |
Definition at line 30 of file BaseMatrix.hpp.
00030 { 00031 doubleHashedMatrix, 00032 sparseMatrix, 00033 #ifdef HAVE_PETSC 00034 petscMatrix, 00035 #endif // HAVE_PETSC 00036 unAssembled 00037 };
| DoubleHashedMatrix::DoubleHashedMatrix | ( | const size_t & | i, | |
| const size_t & | j | |||
| ) | [inline] |
Definition at line 307 of file DoubleHashedMatrix.hpp.
References __columns, and __lines.
00308 : BaseMatrix(BaseMatrix::doubleHashedMatrix,i) 00309 { 00310 __lines.resize(i); 00311 __columns.resize(j); 00312 }
| DoubleHashedMatrix::~DoubleHashedMatrix | ( | ) | [inline] |
| size_t DoubleHashedMatrix::numberOfColumns | ( | ) | const [inline] |
Definition at line 220 of file DoubleHashedMatrix.hpp.
References __columns.
00221 { 00222 return __columns.size(); 00223 }
| std::map<size_t,real_t*>::iterator DoubleHashedMatrix::beginOfColumn | ( | const size_t & | i | ) | [inline] |
| std::map<size_t,real_t*>::iterator DoubleHashedMatrix::endOfColumn | ( | const size_t & | i | ) | [inline] |
| size_t DoubleHashedMatrix::numberOfLines | ( | ) | const [inline] |
Definition at line 237 of file DoubleHashedMatrix.hpp.
References __lines.
Referenced by timesX().
00238 { 00239 return __lines.size(); 00240 }
| std::map<size_t,real_t*>::iterator DoubleHashedMatrix::beginOfLine | ( | const size_t & | i | ) | [inline] |
Definition at line 242 of file DoubleHashedMatrix.hpp.
References __lines, and ASSERT.
Referenced by SparseMatrix::SparseMatrix(), and timesX().
| std::map<size_t,real_t*>::iterator DoubleHashedMatrix::endOfLine | ( | const size_t & | i | ) | [inline] |
Definition at line 248 of file DoubleHashedMatrix.hpp.
References __lines, and ASSERT.
Referenced by SparseMatrix::SparseMatrix(), and timesX().
| std::map<size_t,real_t*>::const_iterator DoubleHashedMatrix::beginOfLine | ( | const size_t & | i | ) | const [inline] |
| std::map<size_t,real_t*>::const_iterator DoubleHashedMatrix::endOfLine | ( | const size_t & | i | ) | const [inline] |
| size_t DoubleHashedMatrix::numberOfLineNonNull | ( | const size_t & | i | ) | const [inline] |
Definition at line 266 of file DoubleHashedMatrix.hpp.
References __lines.
Referenced by SparseMatrix::SparseMatrix().
00267 { 00268 return __lines[i].size(); 00269 }
| void DoubleHashedMatrix::reset | ( | ) | [inline, virtual] |
Sets the matrix to zero
Implements BaseMatrix.
Definition at line 271 of file DoubleHashedMatrix.hpp.
References __columns, __elements, and __lines.
00272 { 00273 __lines.clear(); 00274 __columns.clear(); 00275 __elements.clear(); 00276 }
| void DoubleHashedMatrix::getDiagonal | ( | BaseVector & | X | ) | const [inline, virtual] |
used to get the diagonal of the Matrix and stores it in the vector X.
Implements BaseMatrix.
Definition at line 278 of file DoubleHashedMatrix.hpp.
References ErrorHandler::unexpected.
00279 { 00280 throw ErrorHandler(__FILE__, __LINE__, 00281 "not implemented", 00282 ErrorHandler::unexpected); 00283 }
| void DoubleHashedMatrix::transposedTimesX | ( | const BaseVector & | X, | |
| BaseVector & | Z | |||
| ) | const [inline, virtual] |
Computes z = A*x+y.
Implements BaseMatrix.
Definition at line 285 of file DoubleHashedMatrix.hpp.
References ErrorHandler::unexpected.
00286 { 00287 throw ErrorHandler(__FILE__, __LINE__, 00288 "not implemented", 00289 ErrorHandler::unexpected); 00290 }
| void DoubleHashedMatrix::timesX | ( | const BaseVector & | X, | |
| BaseVector & | Z | |||
| ) | const [inline, virtual] |
Computes z = A*x.
Implements BaseMatrix.
Definition at line 293 of file DoubleHashedMatrix.hpp.
References beginOfLine(), endOfLine(), and numberOfLines().
00295 { 00296 const Vector<real_t>& x =dynamic_cast<const Vector<real_t>&>(X); 00297 Vector<real_t>& z =dynamic_cast<Vector<real_t>&>(Z); 00298 z=0; 00299 for (size_t i=0; i<this->numberOfLines(); ++i) { 00300 for(std::map<size_t,real_t*>::const_iterator j = this->beginOfLine(i); 00301 j != this->endOfLine(i); ++j) { 00302 z[i] += (*(*j).second)*x[(*j).first]; 00303 } 00304 } 00305 }

| real_t& DoubleHashedMatrix::operator() | ( | const size_t & | i, | |
| const size_t & | j | |||
| ) | [inline] |
Definition at line 314 of file DoubleHashedMatrix.hpp.
References __columns, __elements, __lines, and ASSERT.
00315 { 00316 ASSERT ((i<__lines.size())&&(j<__columns.size())); 00317 00318 // seeks if the element is already stored 00319 std::map<DoubleEntry, real_t>::iterator elem 00320 = __elements.find(DoubleEntry(i,j)); 00321 00322 if (elem != __elements.end()) { 00323 return (*elem).second; 00324 } else { 00325 // create lines and columns 00326 __lines[i][j] = __columns[j][i] = &__elements[DoubleEntry(i,j)]; 00327 00328 return __elements[DoubleEntry(i,j)]; 00329 } 00330 }
| const size_t& BaseMatrix::size | ( | ) | const [inline, inherited] |
Definition at line 62 of file BaseMatrix.hpp.
References BaseMatrix::__size.
Referenced by IncompleteCholeskiFactorization::computes(), SparseMatrix::copyProfile(), SparseMatrix::getDiagonal(), IncompleteCholeskiFactorization::initializes(), DiagPrecond::initializes(), SparseMatrix::operator()(), and SparseMatrix::transposedTimesX().
00063 { 00064 return __size; 00065 }
| const BaseMatrix::Type& BaseMatrix::type | ( | ) | const [inline, inherited] |
Definition at line 67 of file BaseMatrix.hpp.
References BaseMatrix::__type.
Referenced by FEMDiscretization< Structured3DMesh, TypeOfDiscretization >::assembleMatrix(), IncompleteCholeskiFactorization::IncompleteCholeskiFactorization(), and KrylovSolverDim().
00068 { 00069 return __type; 00070 }
std::vector<std::map<size_t,real_t*> > DoubleHashedMatrix::__lines [private] |
allows to browse lines
Definition at line 212 of file DoubleHashedMatrix.hpp.
Referenced by beginOfLine(), DoubleHashedMatrix(), endOfLine(), numberOfLineNonNull(), numberOfLines(), operator()(), and reset().
std::vector<std::map<size_t,real_t*> > DoubleHashedMatrix::__columns [private] |
allows to brows columns
Definition at line 215 of file DoubleHashedMatrix.hpp.
Referenced by beginOfColumn(), DoubleHashedMatrix(), endOfColumn(), numberOfColumns(), operator()(), and reset().
std::map<DoubleEntry, real_t> DoubleHashedMatrix::__elements [private] |
stored the elements
Definition at line 218 of file DoubleHashedMatrix.hpp.
Referenced by operator()(), and reset().
BaseMatrix::Type BaseMatrix::__type [protected, inherited] |
size_t BaseMatrix::__size [protected, inherited] |
Definition at line 42 of file BaseMatrix.hpp.
Referenced by SparseMatrix::copyProfile(), SparseMatrix::line(), SparseMatrix::operator*(), SparseMatrix::reset(), BaseMatrix::size(), SparseMatrix::SparseMatrix(), and SparseMatrix::transposedTimesX().
1.5.6