// $Id$
// Version: $Name$
//
-// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
template<class VECTOR> class VectorMemory;
+class IdentityMatrix;
+template <typename number> class FullMatrix;
+template <typename number> class LAPACKFullMatrix;
+template <typename number> class SparseMatrix;
+template <typename number> class BlockSparseMatrix;
+template <typename number> class SparseMatrixEZ;
+template <typename number> class BlockSparseMatrixEZ;
+template <typename number> class BlockMatrixArray;
+template <typename number> class TridiagonalMatrix;
+
+
/*! @addtogroup Matrix2
*@{
*/
* BlockMatrixArray.
*/
typedef typename VECTOR::value_type value_type;
-
+
/**
* Virtual destructor. Does
* nothing except making sure that
* matrix pointed to.
*/
virtual void clear () = 0;
-
+
/**
* Find out if two matrices point
* to the same object.
*/
bool operator == (const PointerMatrixBase<VECTOR>&) const;
-
+
/**
* Find out if two matrices do
* not point to the same object.
*/
bool operator != (const PointerMatrixBase<VECTOR>&) const;
-
+
/**
* Find out if this pointer is
* less.
*/
bool operator < (const PointerMatrixBase<VECTOR>&) const;
-
+
/**
* Find out if this pointer is
* less or equal.
*/
bool operator <= (const PointerMatrixBase<VECTOR>&) const;
-
+
/**
* Find out if this pointer is
* greater.
*/
bool operator > (const PointerMatrixBase<VECTOR>&) const;
-
+
/**
* Find out if this pointer is
* greater or equal.
*/
bool operator >= (const PointerMatrixBase<VECTOR>&) const;
-
-
+
+
/**
* Matrix-vector product.
*/
virtual void vmult (VECTOR& dst,
const VECTOR& src) const = 0;
-
+
/**
* Tranposed matrix-vector product.
*/
virtual void Tvmult (VECTOR& dst,
const VECTOR& src) const = 0;
-
+
/**
* Matrix-vector product, adding to
* <tt>dst</tt>.
*/
virtual void vmult_add (VECTOR& dst,
const VECTOR& src) const = 0;
-
+
/**
* Tranposed matrix-vector product,
* adding to <tt>dst</tt>.
* SmartPointer for this object.
*/
PointerMatrix(const char* name);
-
+
/**
* Constructor. <tt>M</tt> points
* to a matrix which must live
// Use doc from base class
virtual void clear();
-
+
/**
* Return whether the object is
- * empty.
+ * empty.
*/
bool empty () const;
-
+
/**
* Assign a new matrix
* pointer. Deletes the old pointer
* @see SmartPointer
*/
const PointerMatrix& operator= (const MATRIX* M);
-
+
/**
* Matrix-vector product.
*/
virtual void vmult (VECTOR& dst,
const VECTOR& src) const;
-
+
/**
* Tranposed matrix-vector product.
*/
virtual void Tvmult (VECTOR& dst,
const VECTOR& src) const;
-
+
/**
* Matrix-vector product, adding to
* <tt>dst</tt>.
*/
virtual void vmult_add (VECTOR& dst,
const VECTOR& src) const;
-
+
/**
* Tranposed matrix-vector product,
* adding to <tt>dst</tt>.
*/
virtual void Tvmult_add (VECTOR& dst,
const VECTOR& src) const;
-
+
private:
/**
* Return the address of the
// Use doc from base class
virtual void clear();
-
+
/**
* Return whether the object is
- * empty.
+ * empty.
*/
bool empty () const;
* vectors.
*/
void set_memory(VectorMemory<VECTOR>* mem);
-
+
/**
* Assign a new matrix
* pointer. Deletes the old pointer
* @see SmartPointer
*/
const PointerMatrixAux& operator= (const MATRIX* M);
-
+
/**
* Matrix-vector product.
*/
virtual void vmult (VECTOR& dst,
const VECTOR& src) const;
-
+
/**
* Tranposed matrix-vector product.
*/
virtual void Tvmult (VECTOR& dst,
const VECTOR& src) const;
-
+
/**
* Matrix-vector product, adding to
* <tt>dst</tt>.
*/
virtual void vmult_add (VECTOR& dst,
const VECTOR& src) const;
-
+
/**
* Tranposed matrix-vector product,
* adding to <tt>dst</tt>.
*/
virtual void Tvmult_add (VECTOR& dst,
const VECTOR& src) const;
-
+
private:
/**
* Return the address of the
* auxiliary vector.
*/
mutable SmartPointer<VectorMemory<VECTOR>,PointerMatrixAux<MATRIX,VECTOR> > mem;
-
+
/**
* The pointer to the actual matrix.
*/
* SmartPointer for this object.
*/
PointerMatrixVector (const char* name);
-
+
/**
* Constructor. <tt>M</tt> points
* to a matrix which must live
// Use doc from base class
virtual void clear();
-
+
/**
* Return whether the object is
- * empty.
+ * empty.
*/
bool empty () const;
-
+
/**
* Assign a new matrix
* pointer. Deletes the old pointer
* @see SmartPointer
*/
const PointerMatrixVector& operator= (const Vector<number>* M);
-
+
/**
* Matrix-vector product,
* actually the scalar product of
*/
virtual void vmult (Vector<number>& dst,
const Vector<number>& src) const;
-
+
/**
* Tranposed matrix-vector
* product, actually the
*/
virtual void Tvmult (Vector<number>& dst,
const Vector<number>& src) const;
-
+
/**
* Matrix-vector product, adding to
* <tt>dst</tt>.
*/
virtual void vmult_add (Vector<number>& dst,
const Vector<number>& src) const;
-
+
/**
* Tranposed matrix-vector product,
* adding to <tt>dst</tt>.
*/
virtual void Tvmult_add (Vector<number>& dst,
const Vector<number>& src) const;
-
+
private:
/**
* Return the address of the
return new PointerMatrixAux<MATRIX, VECTOR>(0, &matrix, name);
}
-class IdentityMatrix;
-template <typename number> class FullMatrix;
-template <typename number> class LAPACKFullMatrix;
-template <typename number> class SparseMatrix;
-template <typename number> class BlockSparseMatrix;
-template <typename number> class SparseMatrixEZ;
-template <typename number> class BlockSparseMatrixEZ;
-template <typename number> class BlockMatrixArray;
-template <typename number> class TridiagonalMatrix;
-
/**
* Specialized version for IdentityMatrix.
*
//---------------------------------------------------------------------------
template<class VECTOR>
-inline
+inline
PointerMatrixBase<VECTOR>::~PointerMatrixBase ()
{}
{
Assert (m != 0, ExcNotInitialized());
Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1));
-
+
dst(0) = *m * src;
}
{
Assert (m != 0, ExcNotInitialized());
Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1));
-
+
dst.equ (src(0), *m);
}
{
Assert (m != 0, ExcNotInitialized());
Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1));
-
+
dst(0) += *m * src;
}
{
Assert (m != 0, ExcNotInitialized());
Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1));
-
+
dst.add (src(0), *m);
}