Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProductMatrix< VECTOR > Class Template Reference

#include <matrix_lib.h>

Inheritance diagram for ProductMatrix< VECTOR >:
[legend]

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
 
- Public Member Functions inherited from PointerMatrixBase< VECTOR >
virtual ~PointerMatrixBase ()
 
bool operator== (const PointerMatrixBase< VECTOR > &) const
 
bool operator!= (const PointerMatrixBase< VECTOR > &) const
 
bool operator< (const PointerMatrixBase< VECTOR > &) const
 
bool operator<= (const PointerMatrixBase< VECTOR > &) const
 
bool operator> (const PointerMatrixBase< VECTOR > &) const
 
bool operator>= (const PointerMatrixBase< VECTOR > &) const
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
void subscribe (const char *identifier=0) const
 
void unsubscribe (const char *identifier=0) const
 
unsigned int n_subscriptions () const
 
void list_subscribers () const
 
 DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects.\n"<< "(Additional information: "<< arg3<< ")\n"<< "Note the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "more information on what this error means.")
 
 DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier \""<< arg2<< "\" did subscribe to this object of class "<< arg1)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Member Functions

virtual const void * get () const
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from PointerMatrixBase< VECTOR >
typedef VECTOR::value_type value_type
 

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 30050 2013-07-18 20:03:31Z maier @f$
//
// Copyright (C) 2005 - 2013 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
// See documentation of ProductMatrix for documentation of this example
#include <deal.II/base/logstream.h>
#include <deal.II/lac/matrix_lib.h>
#include <deal.II/lac/full_matrix.h>
#include <deal.II/lac/vector.h>
using namespace dealii;
double Adata[] =
{
.5, .1,
.4, .2
};
double Bdata[] =
{
.866, .5,
-.5, .866
};
int main()
{
A.fill(Adata);
B.fill(Bdata);
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

Definition at line 49 of file matrix_lib.h.

Constructor & Destructor Documentation

template<class VECTOR >
ProductMatrix< VECTOR >::ProductMatrix ( )

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

Definition at line 589 of file matrix_lib.h.

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

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

Definition at line 595 of file matrix_lib.h.

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

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

Definition at line 602 of file matrix_lib.h.

template<class VECTOR >
ProductMatrix< VECTOR >::~ProductMatrix ( )

Destructor.

Definition at line 644 of file matrix_lib.h.

Member Function Documentation

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

Change the matrices.

Definition at line 616 of file matrix_lib.h.

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

Change the matrices and memory pool.

Definition at line 630 of file matrix_lib.h.

template<class VECTOR >
void ProductMatrix< VECTOR >::clear ( )
virtual

Reset pointer and release the matrix pointed to.

Implements PointerMatrixBase< VECTOR >.

Definition at line 653 of file matrix_lib.h.

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

Matrix-vector product w = m1 * m2 * v.

Implements PointerMatrixBase< VECTOR >.

Definition at line 664 of file matrix_lib.h.

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

Tranposed matrix-vector product w = m2T * m1T * v.

Implements PointerMatrixBase< VECTOR >.

Definition at line 696 of file matrix_lib.h.

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

Adding matrix-vector product w += m1 * m2 * v

Implements PointerMatrixBase< VECTOR >.

Definition at line 680 of file matrix_lib.h.

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

Adding, tranposed matrix-vector product w += m2T * m1T * v.

Implements PointerMatrixBase< VECTOR >.

Definition at line 712 of file matrix_lib.h.

template<class VECTOR >
const void * ProductMatrix< VECTOR >::get ( ) const
privatevirtual

Return some kind of identifier.

Implements PointerMatrixBase< VECTOR >.

Definition at line 728 of file matrix_lib.h.

Member Data Documentation

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

The left matrix of the product.

Definition at line 134 of file matrix_lib.h.

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

The right matrix of the product.

Definition at line 139 of file matrix_lib.h.

template<class VECTOR >
SmartPointer<VectorMemory<VECTOR>,ProductMatrix<VECTOR> > ProductMatrix< VECTOR >::mem
private

Memory for auxiliary vector.

Definition at line 144 of file matrix_lib.h.


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