};
-
-/**
- * Poor man's matrix product of two sparse matrices. Stores two matrices #m1
- * and #m2 of arbitrary type SparseMatrix and implements matrix-vector
- * multiplications for the product <i>M<sub>1</sub>M<sub>2</sub></i> by
- * performing multiplication with both factors consecutively.
- *
- * The documentation of ProductMatrix applies with exception that these
- * matrices here may be rectangular.
- *
- * @deprecated If deal.II was configured with C++11 support, use the
- * LinearOperator class instead, see the module on
- * @ref LAOperators "linear operators"
- * for further details.
- *
- * @author Guido Kanschat, 2000, 2001, 2002, 2005
- */
-template<typename number, typename vector_number>
-class ProductSparseMatrix : public PointerMatrixBase<Vector<vector_number> >
-{
-public:
- /**
- * Define the type of matrices used.
- */
- typedef SparseMatrix<number> MatrixType;
-
- /**
- * Define the type of vectors we plly this matrix to.
- */
- typedef Vector<vector_number> VectorType;
-
- /**
- * Constructor. Additionally to the two constituting matrices, a memory
- * pool for the auxiliary vector must be provided.
- */
- ProductSparseMatrix (const MatrixType &m1,
- const MatrixType &m2,
- VectorMemory<VectorType> &mem);
-
- /**
- * Constructor leaving an uninitialized matrix. initialize() must be called,
- * before the matrix can be used.
- */
- ProductSparseMatrix();
-
- void initialize (const MatrixType &m1,
- const MatrixType &m2,
- VectorMemory<VectorType> &mem);
-
- // Doc in PointerMatrixBase
- void clear();
-
- /**
- * Matrix-vector product <i>w = m1 * m2 * v</i>.
- */
- virtual void vmult (VectorType &w,
- const VectorType &v) const;
-
- /**
- * Transposed matrix-vector product <i>w = m2<sup>T</sup> * m1<sup>T</sup> *
- * v</i>.
- */
- virtual void Tvmult (VectorType &w,
- const VectorType &v) const;
-
- /**
- * Adding matrix-vector product <i>w += m1 * m2 * v</i>
- */
- virtual void vmult_add (VectorType &w,
- const VectorType &v) const;
-
- /**
- * Adding, transposed matrix-vector product <i>w += m2<sup>T</sup> *
- * m1<sup>T</sup> * v</i>.
- */
- virtual void Tvmult_add (VectorType &w,
- const VectorType &v) const;
-
-private:
- /**
- * The left matrix of the product.
- */
- SmartPointer<const MatrixType,ProductSparseMatrix<number,vector_number> > m1;
-
- /**
- * The right matrix of the product.
- */
- SmartPointer<const MatrixType,ProductSparseMatrix<number,vector_number> > m2;
-
- /**
- * Memory for auxiliary vector.
- */
- SmartPointer<VectorMemory<VectorType>,ProductSparseMatrix<number,vector_number> > mem;
-};
-
-
/**
* Mean value filter. The vmult() functions of this matrix filter out mean
* values of the vector. If the vector is of type BlockVector, then an
component(component)
{}
-
-template<typename number, typename vnumber>
-ProductSparseMatrix<number, vnumber>::ProductSparseMatrix(
- const MatrixType &mat1,
- const MatrixType &mat2,
- VectorMemory<VectorType> &mem)
- :
- m1(&mat1, typeid(*this).name()),
- m2(&mat2, typeid(*this).name()),
- mem(&mem, typeid(*this).name())
-{
- Assert(mat1.n() == mat2.m(), ExcDimensionMismatch(mat1.n(),mat2.m()));
-}
-
-
-template<typename number, typename vnumber>
-ProductSparseMatrix<number, vnumber>::ProductSparseMatrix()
- :
- m1(0, typeid(*this).name()),
- m2(0, typeid(*this).name()),
- mem(0, typeid(*this).name())
-{}
-
-
-template<typename number, typename vnumber>
-void
-ProductSparseMatrix<number, vnumber>::initialize(
- const MatrixType &mat1,
- const MatrixType &mat2,
- VectorMemory<VectorType> &memory)
-{
- Assert(mat1.n() == mat2.m(), ExcDimensionMismatch(mat1.n(),mat2.m()));
- mem = &memory;
- m1 = &mat1;
- m2 = &mat2;
-}
-
-
-template<typename number, typename vnumber>
-void
-ProductSparseMatrix<number, vnumber>::clear()
-{
- m1 = 0;
- m2 = 0;
-}
-
-
-template<typename number, typename vnumber>
-void
-ProductSparseMatrix<number, vnumber>::vmult (VectorType &dst, const VectorType &src) const
-{
- Assert(mem != 0, ExcNotInitialized());
- Assert(m1 != 0, ExcNotInitialized());
- Assert(m2 != 0, ExcNotInitialized());
-
- VectorType *v = mem->alloc();
- v->reinit(m1->n());
- m2->vmult (*v, src);
- m1->vmult (dst, *v);
- mem->free(v);
-}
-
-
-template<typename number, typename vnumber>
-void
-ProductSparseMatrix<number, vnumber>::vmult_add (VectorType &dst, const VectorType &src) const
-{
- Assert(mem != 0, ExcNotInitialized());
- Assert(m1 != 0, ExcNotInitialized());
- Assert(m2 != 0, ExcNotInitialized());
-
- VectorType *v = mem->alloc();
- v->reinit(m1->n());
- m2->vmult (*v, src);
- m1->vmult_add (dst, *v);
- mem->free(v);
-}
-
-
-template<typename number, typename vnumber>
-void
-ProductSparseMatrix<number, vnumber>::Tvmult (VectorType &dst, const VectorType &src) const
-{
- Assert(mem != 0, ExcNotInitialized());
- Assert(m1 != 0, ExcNotInitialized());
- Assert(m2 != 0, ExcNotInitialized());
-
- VectorType *v = mem->alloc();
- v->reinit(m1->n());
- m1->Tvmult (*v, src);
- m2->Tvmult (dst, *v);
- mem->free(v);
-}
-
-
-template<typename number, typename vnumber>
-void
-ProductSparseMatrix<number, vnumber>::Tvmult_add (VectorType &dst, const VectorType &src) const
-{
- Assert(mem != 0, ExcNotInitialized());
- Assert(m1 != 0, ExcNotInitialized());
- Assert(m2 != 0, ExcNotInitialized());
-
- VectorType *v = mem->alloc();
- v->reinit(m1->n());
- m1->Tvmult (*v, src);
- m2->Tvmult_add (dst, *v);
- mem->free(v);
-}
-
-
-template class ProductSparseMatrix<double, double>;
-template class ProductSparseMatrix<double, float>;
-template class ProductSparseMatrix<float, double>;
-template class ProductSparseMatrix<float, float>;
-
template void MeanValueFilter::filter(Vector<float> &) const;
template void MeanValueFilter::filter(Vector<double> &) const;
template void MeanValueFilter::filter(BlockVector<float> &) const;