#include <base/table.h>
#include <base/smartpointer.h>
#include <lac/block_indices.h>
-#include <lac/vector.h>
#include <cmath>
*/
template <class BlockMatrixType>
void add_scaled (const value_type factor,
- const BlockMatrixType &matrix);
-
- /**
- * Matrix-vector multiplication:
- * let $dst = M*src$ with $M$
- * being this matrix.
- */
- template <class BlockVectorType>
- void vmult (BlockVectorType &dst,
- const BlockVectorType &src) const;
-
- /**
- * Matrix-vector
- * multiplication. Just like the
- * previous function, but only
- * applicable if the matrix has
- * only one block column.
- */
- template <class BlockVectorType,
- class VectorType>
- void vmult (BlockVectorType &dst,
- const VectorType &src) const;
-
- /**
- * Matrix-vector
- * multiplication. Just like the
- * previous function, but only
- * applicable if the matrix has
- * only one block row.
- */
- template <class BlockVectorType,
- class VectorType>
- void vmult (VectorType &dst,
- const BlockVectorType &src) const;
-
- /**
- * Matrix-vector
- * multiplication. Just like the
- * previous function, but only
- * applicable if the matrix has
- * only one block.
- */
- template <typename number>
- void vmult (Vector<number> &dst,
- const Vector<number> &src) const;
-
- /**
- * Matrix-vector multiplication:
- * let $dst = M^T*src$ with $M$
- * being this matrix. This
- * function does the same as
- * vmult() but takes the
- * transposed matrix.
- */
- template <class BlockVectorType>
- void Tvmult (BlockVectorType &dst,
- const BlockVectorType &src) const;
+ const BlockMatrixType &matrix);
- /**
- * Matrix-vector
- * multiplication. Just like the
- * previous function, but only
- * applicable if the matrix has
- * only one block row.
- */
- template <class BlockVectorType,
- class VectorType>
- void Tvmult (BlockVectorType &dst,
- const VectorType &src) const;
-
- /**
- * Matrix-vector
- * multiplication. Just like the
- * previous function, but only
- * applicable if the matrix has
- * only one block column.
- */
- template <class BlockVectorType,
- class VectorType>
- void Tvmult (VectorType &dst,
- const BlockVectorType &src) const;
-
- /**
- * Matrix-vector
- * multiplication. Just like the
- * previous function, but only
- * applicable if the matrix has
- * only one block.
- */
- template <typename number>
- void Tvmult (Vector<number> &dst,
- const Vector<number> &src) const;
-
/**
* Adding Matrix-vector
* multiplication. Add $M*src$ on
template <class BlockVectorType>
void Tvmult_add (BlockVectorType &dst,
const BlockVectorType &src) const;
-
- /**
+
+ /**
* Return the norm of the vector
* <i>v</i> with respect to the
* norm induced by this matrix,
* therefore export this function.
*/
void collect_sizes ();
+
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M*src$ with $M$
+ * being this matrix.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class BlockVectorType>
+ void vmult_block_block (BlockVectorType &dst,
+ const BlockVectorType &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class BlockVectorType,
+ class VectorType>
+ void vmult_block_nonblock (BlockVectorType &dst,
+ const VectorType &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class BlockVectorType,
+ class VectorType>
+ void vmult_nonblock_block (VectorType &dst,
+ const BlockVectorType &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class VectorType>
+ void vmult_nonblock_nonblock (VectorType &dst,
+ const VectorType &src) const;
+
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M^T*src$ with $M$
+ * being this matrix. This
+ * function does the same as
+ * vmult() but takes the
+ * transposed matrix.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class BlockVectorType>
+ void Tvmult_block_block (BlockVectorType &dst,
+ const BlockVectorType &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class BlockVectorType,
+ class VectorType>
+ void Tvmult_block_nonblock (BlockVectorType &dst,
+ const VectorType &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class BlockVectorType,
+ class VectorType>
+ void Tvmult_nonblock_block (VectorType &dst,
+ const BlockVectorType &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ *
+ * Due to problems with deriving template
+ * arguments between the block and
+ * non-block versions of the vmult/Tvmult
+ * functions, the actual functions are
+ * implemented in derived classes, with
+ * implementations forwarding the calls
+ * to the implementations provided here
+ * under a unique name for which template
+ * arguments can be derived by the
+ * compiler.
+ */
+ template <class VectorType>
+ void Tvmult_nonblock_nonblock (VectorType &dst,
+ const VectorType &src) const;
+
/**
* Make the iterator class a
template <class MatrixType>
template <class BlockVectorType>
void
-BlockMatrixBase<MatrixType>::vmult (BlockVectorType &dst,
- const BlockVectorType &src) const
+BlockMatrixBase<MatrixType>::
+vmult_block_block (BlockVectorType &dst,
+ const BlockVectorType &src) const
{
Assert (dst.n_blocks() == n_block_rows(),
ExcDimensionMismatch(dst.n_blocks(), n_block_rows()));
template <class BlockVectorType,
class VectorType>
void
-BlockMatrixBase<MatrixType>::vmult (VectorType &dst,
- const BlockVectorType &src) const
+BlockMatrixBase<MatrixType>::
+vmult_nonblock_block (VectorType &dst,
+ const BlockVectorType &src) const
{
Assert (n_block_rows() == 1,
ExcDimensionMismatch(1, n_block_rows()));
template <class BlockVectorType,
class VectorType>
void
-BlockMatrixBase<MatrixType>::vmult (BlockVectorType &dst,
- const VectorType &src) const
+BlockMatrixBase<MatrixType>::
+vmult_block_nonblock (BlockVectorType &dst,
+ const VectorType &src) const
{
Assert (dst.n_blocks() == n_block_rows(),
ExcDimensionMismatch(dst.n_blocks(), n_block_rows()));
template <class MatrixType>
-template <typename number>
+template <class VectorType>
void
-BlockMatrixBase<MatrixType>::vmult (Vector<number> &dst,
- const Vector<number> &src) const
+BlockMatrixBase<MatrixType>::
+vmult_nonblock_nonblock (VectorType &dst,
+ const VectorType &src) const
{
Assert (1 == n_block_rows(),
ExcDimensionMismatch(1, n_block_rows()));
template <class MatrixType>
template <class BlockVectorType>
void
-BlockMatrixBase<MatrixType>::Tvmult (BlockVectorType &dst,
- const BlockVectorType &src) const
+BlockMatrixBase<MatrixType>::
+Tvmult_block_block (BlockVectorType &dst,
+ const BlockVectorType &src) const
{
Assert (dst.n_blocks() == n_block_cols(),
ExcDimensionMismatch(dst.n_blocks(), n_block_cols()));
template <class BlockVectorType,
class VectorType>
void
-BlockMatrixBase<MatrixType>::Tvmult (BlockVectorType &dst,
- const VectorType &src) const
+BlockMatrixBase<MatrixType>::
+Tvmult_block_nonblock (BlockVectorType &dst,
+ const VectorType &src) const
{
Assert (dst.n_blocks() == n_block_cols(),
ExcDimensionMismatch(dst.n_blocks(), n_block_cols()));
template <class BlockVectorType,
class VectorType>
void
-BlockMatrixBase<MatrixType>::Tvmult (VectorType &dst,
- const BlockVectorType &src) const
+BlockMatrixBase<MatrixType>::
+Tvmult_nonblock_block (VectorType &dst,
+ const BlockVectorType &src) const
{
Assert (1 == n_block_cols(),
ExcDimensionMismatch(1, n_block_cols()));
template <class MatrixType>
-template <typename number>
+template <class VectorType>
void
-BlockMatrixBase<MatrixType>::Tvmult (Vector<number> &dst,
- const Vector<number> &src) const
+BlockMatrixBase<MatrixType>::
+Tvmult_nonblock_nonblock (VectorType &dst,
+ const VectorType &src) const
{
Assert (1 == n_block_cols(),
ExcDimensionMismatch(1, n_block_cols()));
#include <base/config.h>
#include <base/table.h>
#include <lac/block_matrix_base.h>
+#include <lac/block_vector.h>
#include <lac/sparse_matrix.h>
#include <lac/block_sparsity_pattern.h>
#include <cmath>
*/
unsigned int n_actually_nonzero_elements () const;
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M*src$ with $M$
+ * being this matrix.
+ */
+ template <typename block_number>
+ void vmult (BlockVector<block_number> &dst,
+ const BlockVector<block_number> &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ */
+ template <typename block_number,
+ typename nonblock_number>
+ void vmult (BlockVector<block_number> &dst,
+ const Vector<nonblock_number> &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ */
+ template <typename block_number,
+ typename nonblock_number>
+ void vmult (Vector<nonblock_number> &dst,
+ const BlockVector<block_number> &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ */
+ template <typename nonblock_number>
+ void vmult (Vector<nonblock_number> &dst,
+ const Vector<nonblock_number> &src) const;
+
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M^T*src$ with $M$
+ * being this matrix. This
+ * function does the same as
+ * vmult() but takes the
+ * transposed matrix.
+ */
+ template <typename block_number>
+ void Tvmult (BlockVector<block_number> &dst,
+ const BlockVector<block_number> &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ */
+ template <typename block_number,
+ typename nonblock_number>
+ void Tvmult (BlockVector<block_number> &dst,
+ const Vector<nonblock_number> &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ */
+ template <typename block_number,
+ typename nonblock_number>
+ void Tvmult (Vector<nonblock_number> &dst,
+ const BlockVector<block_number> &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ */
+ template <typename nonblock_number>
+ void Tvmult (Vector<nonblock_number> &dst,
+ const Vector<nonblock_number> &src) const;
+
/**
* Apply the Jacobi
* preconditioner, which
+template <typename number>
+template <typename block_number>
+inline
+void
+BlockSparseMatrix<number>::vmult (BlockVector<block_number> &dst,
+ const BlockVector<block_number> &src) const
+{
+ BaseClass::vmult_block_block (dst, src);
+}
+
+
+
+template <typename number>
+template <typename block_number,
+ typename nonblock_number>
+inline
+void
+BlockSparseMatrix<number>::vmult (BlockVector<block_number> &dst,
+ const Vector<nonblock_number> &src) const
+{
+ BaseClass::vmult_block_nonblock (dst, src);
+}
+
+
+
+template <typename number>
+template <typename block_number,
+ typename nonblock_number>
+inline
+void
+BlockSparseMatrix<number>::vmult (Vector<nonblock_number> &dst,
+ const BlockVector<block_number> &src) const
+{
+ BaseClass::vmult_nonblock_block (dst, src);
+}
+
+
+
+template <typename number>
+template <typename nonblock_number>
+inline
+void
+BlockSparseMatrix<number>::vmult (Vector<nonblock_number> &dst,
+ const Vector<nonblock_number> &src) const
+{
+ BaseClass::vmult_nonblock_nonblock (dst, src);
+}
+
+
+template <typename number>
+template <typename block_number>
+inline
+void
+BlockSparseMatrix<number>::Tvmult (BlockVector<block_number> &dst,
+ const BlockVector<block_number> &src) const
+{
+ BaseClass::Tvmult_block_block (dst, src);
+}
+
+
+
+template <typename number>
+template <typename block_number,
+ typename nonblock_number>
+inline
+void
+BlockSparseMatrix<number>::Tvmult (BlockVector<block_number> &dst,
+ const Vector<nonblock_number> &src) const
+{
+ BaseClass::Tvmult_block_nonblock (dst, src);
+}
+
+
+
+template <typename number>
+template <typename block_number,
+ typename nonblock_number>
+inline
+void
+BlockSparseMatrix<number>::Tvmult (Vector<nonblock_number> &dst,
+ const BlockVector<block_number> &src) const
+{
+ BaseClass::Tvmult_nonblock_block (dst, src);
+}
+
+
+
+template <typename number>
+template <typename nonblock_number>
+inline
+void
+BlockSparseMatrix<number>::Tvmult (Vector<nonblock_number> &dst,
+ const Vector<nonblock_number> &src) const
+{
+ BaseClass::Tvmult_nonblock_nonblock (dst, src);
+}
+
template <typename number>
template <class BlockVectorType>
#include <base/table.h>
#include <lac/block_matrix_base.h>
#include <lac/petsc_sparse_matrix.h>
+#include <lac/petsc_block_vector.h>
#include <cmath>
void reinit (const unsigned int n_block_rows,
const unsigned int n_block_columns);
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M*src$ with $M$
+ * being this matrix.
+ */
+ void vmult (BlockVector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ */
+ void vmult (BlockVector &dst,
+ const Vector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ */
+ void vmult (Vector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ */
+ void vmult (Vector &dst,
+ const Vector &src) const;
+
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M^T*src$ with $M$
+ * being this matrix. This
+ * function does the same as
+ * vmult() but takes the
+ * transposed matrix.
+ */
+ void Tvmult (BlockVector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ */
+ void Tvmult (BlockVector &dst,
+ const Vector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ */
+ void Tvmult (Vector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ */
+ void Tvmult (Vector &dst,
+ const Vector &src) const;
/**
* This function collects the
/*@}*/
+
+// ------------- inline and template functions -----------------
+
+ inline
+ void
+ BlockSparseMatrix::vmult (BlockVector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::vmult_block_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::vmult (BlockVector &dst,
+ const Vector &src) const
+ {
+ BaseClass::vmult_block_nonblock (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::vmult (Vector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::vmult_nonblock_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::vmult (Vector &dst,
+ const Vector &src) const
+ {
+ BaseClass::vmult_nonblock_nonblock (dst, src);
+ }
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (BlockVector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::Tvmult_block_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (BlockVector &dst,
+ const Vector &src) const
+ {
+ BaseClass::Tvmult_block_nonblock (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (Vector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::Tvmult_nonblock_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (Vector &dst,
+ const Vector &src) const
+ {
+ BaseClass::Tvmult_nonblock_nonblock (dst, src);
+ }
+
}
#include <base/table.h>
#include <lac/block_matrix_base.h>
#include <lac/petsc_parallel_sparse_matrix.h>
+#include <lac/petsc_parallel_block_vector.h>
#include <cmath>
#ifdef DEAL_II_USE_PETSC
void reinit (const unsigned int n_block_rows,
const unsigned int n_block_columns);
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M*src$ with $M$
+ * being this matrix.
+ */
+ void vmult (BlockVector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ */
+ void vmult (BlockVector &dst,
+ const Vector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ */
+ void vmult (Vector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ */
+ void vmult (Vector &dst,
+ const Vector &src) const;
+
+ /**
+ * Matrix-vector multiplication:
+ * let $dst = M^T*src$ with $M$
+ * being this matrix. This
+ * function does the same as
+ * vmult() but takes the
+ * transposed matrix.
+ */
+ void Tvmult (BlockVector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block row.
+ */
+ void Tvmult (BlockVector &dst,
+ const Vector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block column.
+ */
+ void Tvmult (Vector &dst,
+ const BlockVector &src) const;
+
+ /**
+ * Matrix-vector
+ * multiplication. Just like the
+ * previous function, but only
+ * applicable if the matrix has
+ * only one block.
+ */
+ void Tvmult (Vector &dst,
+ const Vector &src) const;
+
/**
* This function collects the
* sizes of the sub-objects and
/*@}*/
+
+// ------------- inline and template functions -----------------
+
+ inline
+ void
+ BlockSparseMatrix::vmult (BlockVector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::vmult_block_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::vmult (BlockVector &dst,
+ const Vector &src) const
+ {
+ BaseClass::vmult_block_nonblock (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::vmult (Vector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::vmult_nonblock_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::vmult (Vector &dst,
+ const Vector &src) const
+ {
+ BaseClass::vmult_nonblock_nonblock (dst, src);
+ }
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (BlockVector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::Tvmult_block_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (BlockVector &dst,
+ const Vector &src) const
+ {
+ BaseClass::Tvmult_block_nonblock (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (Vector &dst,
+ const BlockVector &src) const
+ {
+ BaseClass::Tvmult_nonblock_block (dst, src);
+ }
+
+
+
+ inline
+ void
+ BlockSparseMatrix::Tvmult (Vector &dst,
+ const Vector &src) const
+ {
+ BaseClass::Tvmult_nonblock_nonblock (dst, src);
+ }
+
}
}