Description

template<typename ScalarT>
class chrono::ChGeneralizedEigenSolverBase< ScalarT >

Base interface class for generalized eigenvalue solvers A*x = lambda*B*x.

Currently it is implied that the derived eigensolvers are iterative.

#include <ChGeneralizedEigenSolverBase.h>

Collaboration diagram for chrono::ChGeneralizedEigenSolverBase< ScalarT >:

Public Types

using ScalarType = ScalarT
 

Public Member Functions

void SetTolerance (double tolerance)
 Set the tolerance of the iterative solver (default: 1e-6).
 
double GetTolerance () const
 Get the tolerance of the iterative solver.
 
void SetMaxIterations (int max_iterations)
 Set the maximum number of iterations of the iterative solver (default: 500). More...
 
int GetMaxIterations () const
 Get the maximum number of iterations of the iterative solver.
 
void SetVerbose (bool verbose)
 Enable or disable diagnostic output (default: false).
 
void SetSortRitzPairs (bool sort)
 Enable or disable sorting the eigenpairs by increasing magnitude of the eigenvalues (default: true).
 
double GetTimeMatrixAssembly () const
 Get cumulative time for matrix assembly.
 
double GetTimeEigenSetup () const
 Get cumulative time for the eigensolver setup.
 
double GetTimeEigenSolver () const
 Get cumulative time for the eigensolver solution.
 
double GetTimeSolutionPostProcessing () const
 Get cumulative time for post-solver solution postprocessing.
 

Static Public Member Functions

static void SortRitzPairs (ChVectorDynamic< ScalarType > &eigvals, ChMatrixDynamic< ScalarType > &eigvects, std::function< bool(const ChVectorDynamic< ScalarType > &, int, int)> ordering_fun=[](const ChVectorDynamic< std::complex< double >> &eigv, int a, int b) { return std::abs(eigv(a))< std::abs(eigv(b));})
 Sort the eigenvalues and eigenvectors in the order specified by the ordering function in-place.
 
static double GetMaxResidual (const ChSparseMatrix &A, const ChSparseMatrix &B, const ChMatrixDynamic< ScalarType > &eigvects, const ChVectorDynamic< ScalarType > &eigvals)
 
static double GetMaxResidual (const ChSparseMatrix &K, const ChSparseMatrix &M, const ChSparseMatrix &Cq, const ChMatrixDynamic< ScalarType > &eigvects, const ChVectorDynamic< ScalarType > &eigvals)
 
static double GetMaxResidual (const ChSparseMatrix &K, const ChSparseMatrix &R, const ChSparseMatrix &M, const ChSparseMatrix &Cq, const ChMatrixDynamic< ScalarType > &eigvects, const ChVectorDynamic< ScalarType > &eigvals)
 
static double BuildUndampedSystem (const ChSparseMatrix &M, const ChSparseMatrix &K, const ChSparseMatrix &Cq, ChSparseMatrix &A, ChSparseMatrix &B, bool scaleCq)
 Build the quadratic eigenvalue problem matrix for the undamped case. More...
 
static double BuildDampedSystem (const ChSparseMatrix &M, const ChSparseMatrix &R, const ChSparseMatrix &K, const ChSparseMatrix &Cq, ChSparseMatrix &A, ChSparseMatrix &B, bool scaleCq)
 Build the quadratic eigenvalue problem matrix for the damped case. More...
 

Static Protected Member Functions

static void CountNonZerosForEachRow (const ChSparseMatrix &Q, Eigen::VectorXi &nonZerosPerRow, int offset)
 Add the number of nonzeros in each row of Q to nonZerosPerRow, starting at index offset.
 
static void CountNonZerosForEachRowTransposed (const ChSparseMatrix &Q_transp, Eigen::VectorXi &nonZerosPerRow, int offset)
 Add the number of nonzeros in each row of the transpose of Q_transp to nonZerosPerRow, starting at index offset.
 
static void PlaceMatrix (ChSparseMatrix &HCQ, const ChSparseMatrix &H, int row_start, int col_start, double scale=1.0)
 Write H, multiplied by scale, into HCQ with its top-left corner at (row_start, col_start).
 
static Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > GetPermutationMatrix (int num_elements, std::function< bool(int, int)> ordering_fun)
 Returns the permutation matrix to sort the given elements based on the ordering function.
 

Protected Attributes

double m_tolerance = 1e-6
 tolerance of the iterative solver
 
int m_max_iterations = 500
 maximum number of iterations of the iterative solver
 
bool m_verbose = false
 if true, print diagnostic output
 
bool m_sort_ritz_pairs = true
 if true, sort the eigenpairs by increasing magnitude of the eigenvalues
 
ChTimer m_timer_matrix_assembly
 timer for matrix assembly
 
ChTimer m_timer_eigen_setup
 timer for eigensolver setup
 
ChTimer m_timer_eigen_solver
 timer for eigensolver solution
 
ChTimer m_timer_solution_postprocessing
 timer for conversion of eigensolver solution
 
const int m_min_subspace_size = 30
 

Friends

template<typename EigSolverType >
int SolveEigenProblem (EigSolverType &eig_solver, ChSparseMatrix &A, ChSparseMatrix &B, ChMatrixDynamic< typename EigSolverType::ScalarType > &eigvects, ChVectorDynamic< typename EigSolverType::ScalarType > &eigvals, const std::list< std::pair< int, typename EigSolverType::ScalarType >> &eig_requests, bool uniquify, int eigvects_clipping_length)
 

Member Function Documentation

◆ BuildDampedSystem()

template<typename ScalarT >
static double chrono::ChGeneralizedEigenSolverBase< ScalarT >::BuildDampedSystem ( const ChSparseMatrix &  M,
const ChSparseMatrix &  R,
const ChSparseMatrix &  K,
const ChSparseMatrix &  Cq,
ChSparseMatrix &  A,
ChSparseMatrix &  B,
bool  scaleCq 
)
inlinestatic

Build the quadratic eigenvalue problem matrix for the damped case.

The optional scaling of the Cq matrix improves the conditioning of the eigenvalue problem. If enabled, the user must take care of rescaling back the eigenvectors; e.g. eigvects.bottomRows(Cq.rows()) *= scaling The scaling value is returned by the function.

◆ BuildUndampedSystem()

template<typename ScalarT >
static double chrono::ChGeneralizedEigenSolverBase< ScalarT >::BuildUndampedSystem ( const ChSparseMatrix &  M,
const ChSparseMatrix &  K,
const ChSparseMatrix &  Cq,
ChSparseMatrix &  A,
ChSparseMatrix &  B,
bool  scaleCq 
)
inlinestatic

Build the quadratic eigenvalue problem matrix for the undamped case.

The optional scaling of the Cq matrix improves the conditioning of the eigenvalue problem. If enabled, the user must take care of rescaling back the eigenvectors; e.g. eigvects.bottomRows(Cq.rows()) *= scaling The scaling value is returned by the function.

◆ SetMaxIterations()

template<typename ScalarT >
void chrono::ChGeneralizedEigenSolverBase< ScalarT >::SetMaxIterations ( int  max_iterations)
inline

Set the maximum number of iterations of the iterative solver (default: 500).

If too low, the solver might not converge.


The documentation for this class was generated from the following file:
  • /builds/uwsbel/chrono/src/chrono/solver/ChGeneralizedEigenSolverBase.h