From e38c4c490b7fc130a110f3529b12cc5ab069cf26 Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 2 Jun 2003 13:53:46 +0000 Subject: [PATCH] added *= and /= functions for consistency. Also added print_formatted function similar to the one in BlockVector. git-svn-id: https://svn.dealii.org/trunk@7718 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_sparse_matrix.h | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/deal.II/lac/include/lac/block_sparse_matrix.h b/deal.II/lac/include/lac/block_sparse_matrix.h index 3aa562bcdf..43344c46a0 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.h @@ -410,6 +410,18 @@ class BlockSparseMatrix : public Subscriptor const unsigned int j, const number value); + /** + * Multiply the entire matrix by a + * fixed factor. + */ + BlockSparseMatrix & operator *= (const number factor); + + /** + * Divide the entire matrix by a + * fixed factor. + */ + BlockSparseMatrix & operator /= (const number factor); + /** * Add @p{value} to the element * @p{(i,j)}. Throws an error if @@ -619,6 +631,16 @@ class BlockSparseMatrix : public Subscriptor const BlockVector &src, const number omega = 1.) const; + /* call print functions for + * the SparseMatrix blocks. + */ + void print_formatted (std::ostream &out, + const unsigned int precision = 3, + const bool scientific = true, + const unsigned int width = 0, + const char *zero_string = " ", + const double denominator = 1.) const; + /** * Return a (constant) reference * to the underlying sparsity @@ -667,6 +689,10 @@ class BlockSparseMatrix : public Subscriptor * Exception */ DeclException0 (ExcMatrixNotBlockSquare); + /** + * Exception + */ + DeclException0 (ExcMatrixNotInitialized); private: @@ -1023,6 +1049,40 @@ BlockSparseMatrix::set (const unsigned int i, +template +inline +BlockSparseMatrix & +BlockSparseMatrix::operator *= (const number factor) +{ + Assert (columns != 0, ExcMatrixNotInitialized()); + Assert (rows != 0, ExcMatrixNotInitialized()); + + for (unsigned int r=0; r +inline +BlockSparseMatrix & +BlockSparseMatrix::operator /= (const number factor) +{ + Assert (columns != 0, ExcMatrixNotInitialized()); + Assert (rows != 0, ExcMatrixNotInitialized()); + + for (unsigned int r=0; r inline void -- 2.39.5