ProductMatrix< VECTOR > Class Template Reference
[Derived matrices]

Inheritance diagram for ProductMatrix< VECTOR >:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ProductMatrix ()
 ProductMatrix (VectorMemory< VECTOR > &mem)
template<class MATRIX1 , class MATRIX2 >
 ProductMatrix (const MATRIX1 &m1, const MATRIX2 &m2, VectorMemory< VECTOR > &mem)
template<class MATRIX1 , class MATRIX2 >
void reinit (const MATRIX1 &m1, const MATRIX2 &m2)
template<class MATRIX1 , class MATRIX2 >
void initialize (const MATRIX1 &m1, const MATRIX2 &m2, VectorMemory< VECTOR > &mem)
 ~ProductMatrix ()
void clear ()
virtual void vmult (VECTOR &w, const VECTOR &v) const
virtual void Tvmult (VECTOR &w, const VECTOR &v) const
virtual void vmult_add (VECTOR &w, const VECTOR &v) const
virtual void Tvmult_add (VECTOR &w, const VECTOR &v) const

Private Member Functions

virtual const void * get () const

Private Attributes

PointerMatrixBase< VECTOR > * m1
PointerMatrixBase< VECTOR > * m2
SmartPointer< VectorMemory
< VECTOR > > 
mem


Detailed Description

template<class VECTOR>
class ProductMatrix< VECTOR >

Poor man's matrix product of two quadratic matrices. Stores two quadratic matrices m1 and m2 of arbitrary types and implements matrix-vector multiplications for the product M1M2 by performing multiplication with both factors consecutively.

Here an example multiplying two different FullMatrix objects:

//---------------------------------------------------------------------------
//    @f$Id: product_matrix.cc 16263 2008-05-28 16:41:01Z kanschat @f$
//
//    Copyright (C) 2005, 2006 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//---------------------------------------------------------------------------

// See documentation of Product for documentation of this example

#include <base/logstream.h>
#include <lac/matrix_lib.h>
#include <lac/full_matrix.h>
#include <lac/vector.h>

using namespace dealii;

double Adata[] =
{
      .5, .1,
      .4, .2
};

double Bdata[] =
{
      .866, .5,
      -.5, .866
};


int main()
{
  FullMatrix<float> A(2,2);
  FullMatrix<double> B(2,2);

  A.fill(Adata);
  B.fill(Bdata);
  
  GrowingVectorMemory<Vector<double> > mem;
  
  ProductMatrix<Vector<double> > AB(A,B,mem);

  Vector<double> u(2);
  Vector<double> v(2);

  u(0) = 1.;
  u(1) = 2.;

  AB.vmult(v,u);

  deallog << v(0) << '\t' << v(1) << std::endl;

  AB.Tvmult(v,u);

  deallog << v(0) << '\t' << v(1) << std::endl;
}

Author:
Guido Kanschat, 2000, 2001, 2002, 2005

Constructor & Destructor Documentation

template<class VECTOR >
ProductMatrix< VECTOR >::ProductMatrix (  )  [inline]

Standard constructor. Matrices and the memory pool must be added later using initialize().

template<class VECTOR >
ProductMatrix< VECTOR >::ProductMatrix ( VectorMemory< VECTOR > &  mem  )  [inline]

Constructor only assigning the memory pool. Matrices must be added by reinit() later.

template<class VECTOR >
template<class MATRIX1 , class MATRIX2 >
ProductMatrix< VECTOR >::ProductMatrix ( const MATRIX1 &  m1,
const MATRIX2 &  m2,
VectorMemory< VECTOR > &  mem 
) [inline]

Constructor. Additionally to the two constituting matrices, a memory pool for the auxiliary vector must be provided.

References ProductMatrix< VECTOR >::m1, and ProductMatrix< VECTOR >::m2.

template<class VECTOR >
ProductMatrix< VECTOR >::~ProductMatrix (  )  [inline]


Member Function Documentation

template<class VECTOR >
template<class MATRIX1 , class MATRIX2 >
void ProductMatrix< VECTOR >::reinit ( const MATRIX1 &  m1,
const MATRIX2 &  m2 
) [inline]

Change the matrices.

References ProductMatrix< VECTOR >::m1, and ProductMatrix< VECTOR >::m2.

template<class VECTOR >
template<class MATRIX1 , class MATRIX2 >
void ProductMatrix< VECTOR >::initialize ( const MATRIX1 &  m1,
const MATRIX2 &  m2,
VectorMemory< VECTOR > &  mem 
) [inline]

Change the matrices and memory pool.

References ProductMatrix< VECTOR >::m1, ProductMatrix< VECTOR >::m2, and ProductMatrix< VECTOR >::mem.

template<class VECTOR >
void ProductMatrix< VECTOR >::clear (  )  [inline, virtual]

Reset pointer and release the matrix pointed to.

Implements PointerMatrixBase< VECTOR >.

References ProductMatrix< VECTOR >::m1, and ProductMatrix< VECTOR >::m2.

template<class VECTOR >
void ProductMatrix< VECTOR >::vmult ( VECTOR &  w,
const VECTOR &  v 
) const [inline, virtual]

template<class VECTOR >
void ProductMatrix< VECTOR >::Tvmult ( VECTOR &  w,
const VECTOR &  v 
) const [inline, virtual]

template<class VECTOR >
void ProductMatrix< VECTOR >::vmult_add ( VECTOR &  w,
const VECTOR &  v 
) const [inline, virtual]

template<class VECTOR >
void ProductMatrix< VECTOR >::Tvmult_add ( VECTOR &  w,
const VECTOR &  v 
) const [inline, virtual]

template<class VECTOR >
const void * ProductMatrix< VECTOR >::get (  )  const [inline, private, virtual]

Return some kind of identifier.

Implements PointerMatrixBase< VECTOR >.

References ProductMatrix< VECTOR >::m1.


Member Data Documentation

template<class VECTOR>
PointerMatrixBase<VECTOR>* ProductMatrix< VECTOR >::m1 [private]

template<class VECTOR>
PointerMatrixBase<VECTOR>* ProductMatrix< VECTOR >::m2 [private]

template<class VECTOR>
SmartPointer<VectorMemory<VECTOR> > ProductMatrix< VECTOR >::mem [private]


The documentation for this class was generated from the following file:

deal.II documentation generated on Sat Aug 15 16:52:14 2009 by doxygen 1.5.9