Poster of Linux kernelThe best gift for a Linux geek
TensorShellMatrix

TensorShellMatrix

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

TensorShellMatrix -  

SYNOPSIS


#include <tensor_shell_matrix.h>

Inherits ShellMatrix< T >.  

Public Member Functions


TensorShellMatrix (const NumericVector< T > &v, const NumericVector< T > &w)

virtual ~TensorShellMatrix ()

virtual unsigned int m () const

virtual unsigned int n () const

virtual void vector_mult (NumericVector< T > &dest, const NumericVector< T > &arg) const

virtual void vector_mult_add (NumericVector< T > &dest, const NumericVector< T > &arg) const

virtual void get_diagonal (NumericVector< T > &dest) const
 

Static Public Member Functions


static std::string get_info ()

static void print_info ()

static unsigned int n_objects ()
 

Protected Types


typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 

Protected Member Functions


void increment_constructor_count (const std::string &name)

void increment_destructor_count (const std::string &name)
 

Protected Attributes


const NumericVector< T > & _v

const NumericVector< T > & _w
 

Static Protected Attributes


static Counts _counts

static Threads::atomic< unsigned int > _n_objects

static Threads::spin_mutex _mutex
 

Detailed Description

 

template<typename T> class TensorShellMatrix< T >

Shell matrix that is given by a tensor of two vectors, i.e. A = v*w^T.

Author:

Tim Kroeger, 2008

Definition at line 41 of file tensor_shell_matrix.h.  

Member Typedef Documentation

 

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.

Definition at line 105 of file reference_counter.h.  

Constructor & Destructor Documentation

 

template<typename T > TensorShellMatrix< T >::TensorShellMatrix (const NumericVector< T > &v, const NumericVector< T > &w) [inline]Constructor; takes references to the two vectors as arguments. The vectors themselves have to be stored elsewhere.

Definition at line 105 of file tensor_shell_matrix.h.

                                                                   :
  ShellMatrix<T>(),
  _v(v),
  _w(w)
{}
 

template<typename T > TensorShellMatrix< T >::~TensorShellMatrix () [inline, virtual]Destructor.

Definition at line 116 of file tensor_shell_matrix.h.

{}
 

Member Function Documentation

 

template<typename T > void TensorShellMatrix< T >::get_diagonal (NumericVector< T > &dest) const [virtual]Copies the diagonal part of the matrix into dest.

Implements ShellMatrix< T >.

Definition at line 45 of file tensor_shell_matrix.C.

References NumericVector< T >::pointwise_mult().

{
  dest.pointwise_mult(_v,_w);
}
 

std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.

Definition at line 45 of file reference_counter.C.

References ReferenceCounter::_counts, and Quality::name().

Referenced by ReferenceCounter::print_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)

  std::ostringstream out;
  
  out << '
      << ' ---------------------------------------------------------------------------- 
      << '| Reference count information                                                |
      << ' ---------------------------------------------------------------------------- ;
  
  for (Counts::iterator it = _counts.begin();
       it != _counts.end(); ++it)
    {
      const std::string name(it->first);
      const unsigned int creations    = it->second.first;
      const unsigned int destructions = it->second.second;

      out << '| ' << name << ' reference count information:
          << '|  Creations:    ' << creations    << '
          << '|  Destructions: ' << destructions << ';
    }
  
  out << ' ---------------------------------------------------------------------------- ;

  return out.str();

#else

  return '';
  
#endif
}
 

void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.

Definition at line 149 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.first++;
}
 

void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.

Definition at line 167 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::~ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.second++;
}
 

template<typename T > unsigned int TensorShellMatrix< T >::m () const [inline, virtual]Returns:

m, the row-dimension of the matrix where the marix is $ M imes N $.

Implements ShellMatrix< T >.

Definition at line 123 of file tensor_shell_matrix.h.

{
  return _v.size();
}
 

template<typename T > unsigned int TensorShellMatrix< T >::n () const [inline, virtual]Returns:

n, the column-dimension of the matrix where the marix is $ M imes N $.

Implements ShellMatrix< T >.

Definition at line 132 of file tensor_shell_matrix.h.

{
  return _w.size();
}
 

static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 76 of file reference_counter.h.

References ReferenceCounter::_n_objects.

Referenced by System::read_serialized_blocked_dof_objects(), and System::write_serialized_blocked_dof_objects().

  { return _n_objects; }
 

void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.

Definition at line 83 of file reference_counter.C.

References ReferenceCounter::get_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
  
  std::cout << ReferenceCounter::get_info();
  
#endif
}
 

template<typename T > void TensorShellMatrix< T >::vector_mult (NumericVector< T > &dest, const NumericVector< T > &arg) const [virtual]Multiplies the matrix with arg and stores the result in dest.

Implements ShellMatrix< T >.

Definition at line 26 of file tensor_shell_matrix.C.

References NumericVector< T >::scale().

{
  dest = _v;
  dest.scale(_w.dot(arg));
}
 

template<typename T > void TensorShellMatrix< T >::vector_mult_add (NumericVector< T > &dest, const NumericVector< T > &arg) const [virtual]Multiplies the matrix with arg and adds the result to dest.

Implements ShellMatrix< T >.

Definition at line 36 of file tensor_shell_matrix.C.

References NumericVector< T >::add().

{
  dest.add(_w.dot(arg),_v);
}
 

Member Data Documentation

 

ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.

Definition at line 110 of file reference_counter.h.

Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().  

Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.

Definition at line 123 of file reference_counter.h.  

Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.

Definition at line 118 of file reference_counter.h.

Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().  

template<typename T > const NumericVector<T>& TensorShellMatrix< T >::_v [protected]The column vector.

Definition at line 90 of file tensor_shell_matrix.h.  

template<typename T > const NumericVector<T>& TensorShellMatrix< T >::_w [protected]The row vector.

Definition at line 95 of file tensor_shell_matrix.h.

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Static Public Member Functions
Protected Types
Protected Member Functions
Protected Attributes
Static Protected Attributes
Detailed Description
template<typename T> class TensorShellMatrix< T >
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.
Constructor & Destructor Documentation
template<typename T > TensorShellMatrix< T >::TensorShellMatrix (const NumericVector< T > &v, const NumericVector< T > &w) [inline]Constructor; takes references to the two vectors as arguments. The vectors themselves have to be stored elsewhere.
template<typename T > TensorShellMatrix< T >::~TensorShellMatrix () [inline, virtual]Destructor.
Member Function Documentation
template<typename T > void TensorShellMatrix< T >::get_diagonal (NumericVector< T > &dest) const [virtual]Copies the diagonal part of the matrix into dest.
std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.
void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
template<typename T > unsigned int TensorShellMatrix< T >::m () const [inline, virtual]Returns:
template<typename T > unsigned int TensorShellMatrix< T >::n () const [inline, virtual]Returns:
static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.
void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.
template<typename T > void TensorShellMatrix< T >::vector_mult (NumericVector< T > &dest, const NumericVector< T > &arg) const [virtual]Multiplies the matrix with arg and stores the result in dest.
template<typename T > void TensorShellMatrix< T >::vector_mult_add (NumericVector< T > &dest, const NumericVector< T > &arg) const [virtual]Multiplies the matrix with arg and adds the result to dest.
Member Data Documentation
ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.
Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.
Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.
template<typename T > const NumericVector<T>& TensorShellMatrix< T >::_v [protected]The column vector.
template<typename T > const NumericVector<T>& TensorShellMatrix< T >::_w [protected]The row vector.
Author

This document was created by man2html, using the manual pages.
Time: 21:57:09 GMT, April 16, 2011