RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDNumeric::EigenSolvers Namespace Reference

Functions

bool RDKIT_EIGENSOLVERS_EXPORT powerEigenSolver (unsigned int numEig, DoubleSymmMatrix &mat, DoubleVector &eigenValues, DoubleMatrix *eigenVectors=nullptr, int seed=-1)
 
static bool powerEigenSolver (unsigned int numEig, DoubleSymmMatrix &mat, DoubleVector &eigenValues, DoubleMatrix &eigenVectors, int seed=-1)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Function Documentation

◆ powerEigenSolver() [1/2]

static bool RDNumeric::EigenSolvers::powerEigenSolver ( unsigned int  numEig,
DoubleSymmMatrix mat,
DoubleVector eigenValues,
DoubleMatrix eigenVectors,
int  seed = -1 
)
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 60 of file PowerEigenSolver.h.

References powerEigenSolver().

◆ powerEigenSolver() [2/2]

bool RDKIT_EIGENSOLVERS_EXPORT RDNumeric::EigenSolvers::powerEigenSolver ( unsigned int  numEig,
DoubleSymmMatrix mat,
DoubleVector eigenValues,
DoubleMatrix eigenVectors = nullptr,
int  seed = -1 
)

Compute the numEig largest eigenvalues and, optionally, the corresponding eigenvectors.

Parameters
numEigthe number of eigenvalues we are interested in
matsymmetric input matrix of dimension N*N
eigenValuesVector used to return the eigenvalues (size = numEig)
eigenVectorsOptional matrix used to return the eigenvectors (size = N*numEig)
seedOptional values to seed the random value generator used to initialize the eigen vectors
Returns
a boolean indicating whether or not the calculation converged.

Notes:

  • The matrix, mat, is changed in this function

Algorithm:

We use the iterative power method, which works like this:

 u = arbitrary unit vector
 tol = 0.001
 currEigVal = 0.0;
 prevEigVal = -1.0e100
 while (abs(currEigVal - prevEigVal) > tol) :
     v = Au
     prevEigVal = currEigVal
     currEigVal = v[i] // where i is the id of the largest absolute component
     u = c*v

Referenced by powerEigenSolver().