/* ------------------------- Template functions ---------------------- */
+template <typename number>
+inline
+unsigned int
+BlockSparseMatrix<number>::n_block_cols () const
+{
+ return columns;
+};
+
+
+
+template <typename number>
+inline
+unsigned int
+BlockSparseMatrix<number>::n_block_rows () const
+{
+ return rows;
+};
+
+
template <typename number>
inline
SparseMatrix<number> &
template <typename number>
template <typename somenumber>
void
-BlockSparseMatrix<number>::Tvmult (BlockVector<somenumber> &/*dst*/,
- const BlockVector<somenumber> &/*src*/) const
+BlockSparseMatrix<number>::Tvmult (BlockVector<somenumber>& dst,
+ const BlockVector<somenumber>& src) const
{
- // presently not
- // implemented. should be simple,
- // but don't have the time right
- // now.
- Assert (false, ExcNotImplemented());
+ Assert (dst.n_blocks() == n_block_cols(),
+ ExcDimensionMismatch(dst.n_blocks(), n_block_cols()));
+ Assert (src.n_blocks() == n_block_rows(),
+ ExcDimensionMismatch(src.n_blocks(), n_block_rows()));
+
+ dst = 0.;
+
+ for (unsigned int row=0; row<n_block_rows(); ++row)
+ {
+ for (unsigned int col=0; col<n_block_cols(); ++col)
+ block(row,col).Tvmult_add (dst.block(col),
+ src.block(row));
+ };
};
template <typename number>
template <typename somenumber>
void
-BlockSparseMatrix<number>::Tvmult_add (BlockVector<somenumber> &/*dst*/,
- const BlockVector<somenumber> &/*src*/) const
+BlockSparseMatrix<number>::Tvmult_add (BlockVector<somenumber>& dst,
+ const BlockVector<somenumber>& src) const
{
- // presently not
- // implemented. should be simple,
- // but don't have the time right
- // now.
- Assert (false, ExcNotImplemented());
+ Assert (dst.n_blocks() == n_block_cols(),
+ ExcDimensionMismatch(dst.n_blocks(), n_block_cols()));
+ Assert (src.n_blocks() == n_block_rows(),
+ ExcDimensionMismatch(src.n_blocks(), n_block_rows()));
+
+ for (unsigned int row=0; row<n_block_rows(); ++row)
+ {
+ for (unsigned int col=0; col<n_block_cols(); ++col)
+ block(row,col).Tvmult_add (dst.block(col),
+ src.block(row));
+ };
};
};
-template <typename number>
-inline
-unsigned int
-BlockSparseMatrix<number>::n_block_cols () const
-{
- return columns;
-};
-
-
-
-template <typename number>
-inline
-unsigned int
-BlockSparseMatrix<number>::n_block_rows () const
-{
- return rows;
-};
-
-
#endif // __deal2__block_sparse_matrix_h