Poster of Linux kernelThe best gift for a Linux geek
EigenSolver

EigenSolver

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

NAME

EigenSolver -  

SYNOPSIS


#include <eigen_solver.h>

Inherits ReferenceCountedObject< EigenSolver< T > >.

Inherited by SlepcEigenSolver< T >.  

Public Member Functions


EigenSolver ()

virtual ~EigenSolver ()

bool initialized () const

virtual void clear ()

virtual void init ()=0

EigenSolverType eigen_solver_type () const

EigenProblemType eigen_problem_type () const

PositionOfSpectrum postition_of_spectrum () const

void set_eigensolver_type (const EigenSolverType est)

void set_eigenproblem_type (EigenProblemType ept)

void set_position_of_spectrum (PositionOfSpectrum pos)

virtual std::pair< unsigned int, unsigned int > solve_standard (SparseMatrix< T > &matrix_A, int nev, int ncv, const double tol, const unsigned int m_its)=0

virtual std::pair< unsigned int, unsigned int > solve_standard (ShellMatrix< T > &matrix_A, int nev, int ncv, const double tol, const unsigned int m_its)=0

virtual std::pair< unsigned int, unsigned int > solve_generalized (SparseMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0

virtual std::pair< unsigned int, unsigned int > solve_generalized (ShellMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0

virtual std::pair< unsigned int, unsigned int > solve_generalized (SparseMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0

virtual std::pair< unsigned int, unsigned int > solve_generalized (ShellMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, int nev, int ncv, const double tol, const unsigned int m_its)=0

virtual std::pair< Real, Real > get_eigenpair (unsigned int i, NumericVector< T > &solution)=0

virtual void attach_deflation_space (NumericVector< T > &deflation_vector)=0
 

Static Public Member Functions


static AutoPtr< EigenSolver< T > > build (const SolverPackage solver_package=SLEPC_SOLVERS)

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


EigenSolverType _eigen_solver_type

EigenProblemType _eigen_problem_type

PositionOfSpectrum _position_of_spectrum

bool _is_initialized
 

Static Protected Attributes


static Counts _counts

static Threads::atomic< unsigned int > _n_objects

static Threads::spin_mutex _mutex
 

Detailed Description

 

template<typename T> class EigenSolver< T >

This class provides an interface to solvers for eigenvalue problems.

Definition at line 51 of file eigen_solver.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 > EigenSolver< T >::EigenSolver () [inline]Constructor. Initializes Solver data structures

Definition at line 235 of file eigen_solver.h.

                             :
  
  _eigen_solver_type    (ARNOLDI),
  _eigen_problem_type   (NHEP),
  _position_of_spectrum (LARGEST_MAGNITUDE),
  _is_initialized       (false)
{
}
 

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

Definition at line 248 of file eigen_solver.h.

{
  this->clear ();
}
 

Member Function Documentation

 

template<typename T> virtual void EigenSolver< T >::attach_deflation_space (NumericVector< T > &deflation_vector) [pure virtual]Attach a deflation space defined by a single vector.

Implemented in SlepcEigenSolver< T >.  

template<typename T > AutoPtr< EigenSolver< T > > EigenSolver< T >::build (const SolverPackagesolver_package = SLEPC_SOLVERS) [static]Builds an EigenSolver using the linear solver package specified by solver_package

Definition at line 36 of file eigen_solver.C.

References libMeshEnums::SLEPC_SOLVERS.

{
  // Build the appropriate solver
  switch (solver_package)
    {



#ifdef LIBMESH_HAVE_SLEPC
        case SLEPC_SOLVERS:
      {
        AutoPtr<EigenSolver<T> > ap(new SlepcEigenSolver<T>);
        return ap;
      }
#endif


    default:
      std::cerr << 'ERROR:  Unrecognized eigen solver package: '
                << solver_package
                << std::endl;
      libmesh_error();
    }
    
  AutoPtr<EigenSolver<T> > ap(NULL);
  return ap;    
}
 

template<typename T> virtual void EigenSolver< T >::clear () [inline, virtual]Release all memory and clear data structures.

Reimplemented in SlepcEigenSolver< T >.

Definition at line 82 of file eigen_solver.h.

{}
 

template<typename T> EigenProblemType EigenSolver< T >::eigen_problem_type () const [inline]Returns the type of the eigen problem.

Definition at line 97 of file eigen_solver.h.

{ return _eigen_problem_type;}
 

template<typename T> EigenSolverType EigenSolver< T >::eigen_solver_type () const [inline]Returns the type of eigensolver to use.

Definition at line 92 of file eigen_solver.h.

{ return _eigen_solver_type; }
 

template<typename T> virtual std::pair<Real, Real> EigenSolver< T >::get_eigenpair (unsigned inti, NumericVector< T > &solution) [pure virtual]Returns the ith eigenvalue (real and imaginary part), and copies the \ ith eigen vector to the solution vector.

Implemented in SlepcEigenSolver< T >.  

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> virtual void EigenSolver< T >::init () [pure virtual]Initialize data structures if not done so already.

Implemented in SlepcEigenSolver< T >.  

template<typename T> bool EigenSolver< T >::initialized () const [inline]Returns:

true if the data structures are initialized, false otherwise.

Definition at line 76 of file eigen_solver.h.

{ return _is_initialized; }
 

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; }
 

template<typename T> PositionOfSpectrum EigenSolver< T >::postition_of_spectrum () const [inline]Returns the position of the spectrum to compute.

Definition at line 102 of file eigen_solver.h.

    { return _position_of_spectrum;}
 

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 EigenSolver< T >::set_eigenproblem_type (EigenProblemTypeept) [inline]Sets the type of the eigenproblem.

Definition at line 114 of file eigen_solver.h.

    {_eigen_problem_type = ept;}
 

template<typename T> void EigenSolver< T >::set_eigensolver_type (const EigenSolverTypeest) [inline]Sets the type of eigensolver to use.

Definition at line 108 of file eigen_solver.h.

    { _eigen_solver_type = est; }
 

template<typename T> void EigenSolver< T >::set_position_of_spectrum (PositionOfSpectrumpos) [inline]Sets the position of the spectrum.

Definition at line 120 of file eigen_solver.h.

    {_position_of_spectrum= pos;}
 

template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (SparseMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when matrix_A is a SparseMatrix and matrix_B is a ShellMatrix.

Implemented in SlepcEigenSolver< T >.  

template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (ShellMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when both matrix_A and matrix_B are of type ShellMatrix.

Implemented in SlepcEigenSolver< T >.  

template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (ShellMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when matrix_A is a ShellMatrix and matrix_B is a SparseMatrix.

Implemented in SlepcEigenSolver< T >.  

template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (SparseMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when both matrix_A and matrix_B are of type SparseMatrix and returns the number of converged eigenpairs and the number of iterations.

Implemented in SlepcEigenSolver< T >.  

template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_standard (ShellMatrix< T > &matrix_A, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the standard eigen problem when matrix_A is a ShellMatrix, and returns the number of converged eigenpairs and the number of iterations.

Implemented in SlepcEigenSolver< T >.  

template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_standard (SparseMatrix< T > &matrix_A, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the standard eigen problem when matrix_A is a SparseMatrix, and returns the number of converged eigenpairs and the number of iterations.

Implemented in SlepcEigenSolver< T >.  

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().  

template<typename T> EigenProblemType EigenSolver< T >::_eigen_problem_type [protected]Enum stating which type of eigen problem we deal with.

Definition at line 215 of file eigen_solver.h.

Referenced by EigenSolver< Number >::eigen_problem_type(), and EigenSolver< Number >::set_eigenproblem_type().  

template<typename T> EigenSolverType EigenSolver< T >::_eigen_solver_type [protected]Enum stating which type of eigensolver to use.

Definition at line 210 of file eigen_solver.h.

Referenced by EigenSolver< Number >::eigen_solver_type(), and EigenSolver< Number >::set_eigensolver_type().  

template<typename T> bool EigenSolver< T >::_is_initialized [protected]Flag indicating if the data structures have been initialized.

Definition at line 225 of file eigen_solver.h.

Referenced by EigenSolver< Number >::initialized().  

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> PositionOfSpectrum EigenSolver< T >::_position_of_spectrum [protected]Enum stating where to evaluate the spectrum.

Definition at line 220 of file eigen_solver.h.

Referenced by EigenSolver< Number >::postition_of_spectrum(), and EigenSolver< Number >::set_position_of_spectrum().

 

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 EigenSolver< 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 > EigenSolver< T >::EigenSolver () [inline]Constructor. Initializes Solver data structures
template<typename T > EigenSolver< T >::~EigenSolver () [inline, virtual]Destructor.
Member Function Documentation
template<typename T> virtual void EigenSolver< T >::attach_deflation_space (NumericVector< T > &deflation_vector) [pure virtual]Attach a deflation space defined by a single vector.
template<typename T > AutoPtr< EigenSolver< T > > EigenSolver< T >::build (const SolverPackagesolver_package = SLEPC_SOLVERS) [static]Builds an EigenSolver using the linear solver package specified by solver_package
template<typename T> virtual void EigenSolver< T >::clear () [inline, virtual]Release all memory and clear data structures.
template<typename T> EigenProblemType EigenSolver< T >::eigen_problem_type () const [inline]Returns the type of the eigen problem.
template<typename T> EigenSolverType EigenSolver< T >::eigen_solver_type () const [inline]Returns the type of eigensolver to use.
template<typename T> virtual std::pair<Real, Real> EigenSolver< T >::get_eigenpair (unsigned inti, NumericVector< T > &solution) [pure virtual]Returns the ith eigenvalue (real and imaginary part), and copies the \ ith eigen vector to the solution vector.
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> virtual void EigenSolver< T >::init () [pure virtual]Initialize data structures if not done so already.
template<typename T> bool EigenSolver< T >::initialized () const [inline]Returns:
static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.
template<typename T> PositionOfSpectrum EigenSolver< T >::postition_of_spectrum () const [inline]Returns the position of the spectrum to compute.
void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.
template<typename T> void EigenSolver< T >::set_eigenproblem_type (EigenProblemTypeept) [inline]Sets the type of the eigenproblem.
template<typename T> void EigenSolver< T >::set_eigensolver_type (const EigenSolverTypeest) [inline]Sets the type of eigensolver to use.
template<typename T> void EigenSolver< T >::set_position_of_spectrum (PositionOfSpectrumpos) [inline]Sets the position of the spectrum.
template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (SparseMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when matrix_A is a SparseMatrix and matrix_B is a ShellMatrix.
template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (ShellMatrix< T > &matrix_A, ShellMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when both matrix_A and matrix_B are of type ShellMatrix.
template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (ShellMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when matrix_A is a ShellMatrix and matrix_B is a SparseMatrix.
template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_generalized (SparseMatrix< T > &matrix_A, SparseMatrix< T > &matrix_B, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the generalized eigen problem when both matrix_A and matrix_B are of type SparseMatrix and returns the number of converged eigenpairs and the number of iterations.
template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_standard (ShellMatrix< T > &matrix_A, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the standard eigen problem when matrix_A is a ShellMatrix, and returns the number of converged eigenpairs and the number of iterations.
template<typename T> virtual std::pair<unsigned int, unsigned int> EigenSolver< T >::solve_standard (SparseMatrix< T > &matrix_A, intnev, intncv, const doubletol, const unsigned intm_its) [pure virtual]Solves the standard eigen problem when matrix_A is a SparseMatrix, and returns the number of converged eigenpairs and the number of iterations.
Member Data Documentation
ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.
template<typename T> EigenProblemType EigenSolver< T >::_eigen_problem_type [protected]Enum stating which type of eigen problem we deal with.
template<typename T> EigenSolverType EigenSolver< T >::_eigen_solver_type [protected]Enum stating which type of eigensolver to use.
template<typename T> bool EigenSolver< T >::_is_initialized [protected]Flag indicating if the data structures have been initialized.
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> PositionOfSpectrum EigenSolver< T >::_position_of_spectrum [protected]Enum stating where to evaluate the spectrum.
Author

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