Skip to main content

RALEIGH: RAL EIGensolver for real symmetric and Hermitian problems

RALEIGH is a Python implementation of the block Jacobi-conjugated gradients algorithm for computing several eigenpairs (eigenvalues and corresponding eigenvectors) of large scale real symmetric and Hermitian problems.

Key features

  • Can be applied to both standard eigenvalue problem for a real symmetric or Hermitian matrix A and generalized eigenvalue problems for matrix pencils A - λ B or A B - λ I with positive definite real symmetric or Hermitian B.
  • Can employ either of the two known convergence improvement techniques for large sparse problems: shift-and-invert and preconditioning.
  • Can also compute singular values and vectors, and is actually an especially efficient tool for Principal Component Analysis (PCA) of dense data of large size (more than 10000 samples with more than 10000 features each), owing to the high efficiency of matrix multiplications on modern multicore and GPU architectures.
  • The user can specify the number of wanted eigenvalues
    • on either margin of the spectrum (e.g. 5 on the left, 10 on the right)
    • of largest magnitude
    • on either side of a given real value
    • nearest to a given real value
  • If the number of eigenvalues needed is not known in advance (as is normally the case with PCA), the computation will continue until user-specified stopping criteria are satisfied (e.g. PCA approximation to the data is satisfactory).
  • PCA capabilities include quick update of principal components after arrival of new data and incremental computation of principal components, dealing with one chunk of data at a time.
  • For sparse matrices of large size (~100K or larger), RALEIGH's partial_hevp eigensolver is much faster than eigsh from SciPy. Similarly, for large data (>10K samples with >10K features) that has large amount of redundancy, RALEIGH's pca function is considerably faster than fit_ransform method of scikit-learn and, in addition, uses much less memory.
  • The core solver is written in terms of abstract vectors, owing to which it will work on any architecture verbatim, provided that basic linear algebra operations on vectors are implemented. Currently, MKL and CUBLAS implementations are provided with the package, in the absence of these libraries NumPy algebra being used.

Dependencies

For best performance, install MKL 10.3 or later. On Linux, the latest MKL can be installed by pip install --user mkl. On Windows, one can alternatively install numpy+mkl. On Linux, the folder containing libmkl_rt.so must be listed in LD_LIBRARY_PATH. On Windows, the one containing mkl_rt.dll must be listed in PATH. Large sparse problems can only be solved if MKL is available, PCA and other dense problems can be tackled without it.

To use GPU (which must be CUDA-enabled), NVIDIA GPU Computing Toolkit needs to be installed. On Linux, the folder containing libcudart.so must be listed in LD_LIBRARY_PATH. At present, GPU can only be used for dense (SVD-related) problems.

Package structure

Basic use subpackages

Subpackage interfaces contains user-friendly SciPy-like interfaces to core solver working in terms of NumPy and SciPy data objects. Subpackage examples contains scripts illustrating their use, as well as a script illustrating basic capabilities of the core solver.

Advanced use subpackages

Subpackage algebra contains NumPy, MKL and CUBLAS implementations of abstract vectors algebra. These can be used as templates for user's own implementations. Subpackage core contains the core solver implementation and related data objects definitions.

Basic usage

To compute 10 eigenvalues closest to 0.25 of a sparse real symmetric or Hermitian matrix A in SciPy format:

from raleigh.interfaces.partial_hevp import partial_hevp
lmd, x, status = partial_hevp(A, which=10, sigma=0.25)
# lmd : eigenvalues
# x : eigenvectors
# status : execution status

To compute 10 smallest eigenvalues of a sparse positive definite real symmetric or Hermitian matrix M using its incomplete LU-factorization as the preconditioner:

from raleigh.algebra.sparse_mkl import IncompleteLU as ILU
T = ILU(A)
T.factorize()
lmd, x, status = partial_hevp(A, which=10, T=T)

To compute 100 principal components for the dataset represented by the 2D matrix A with data samples as rows:

from raleigh.interfaces.pca import pca
mean, trans, comps = pca(A, npc=100)
# mean : the average of data samples
# trans : transformed (reduced features) data set
# comps : the matrix with principal components as rows

To compute a number of principal components sufficient to approximate A with 5% tolerance to the relative PCA error (the ratio of the Frobenius norm of trans*comps - A_s to that of A_s, where the rows of A_s are the original data samples shifted by mean):

mean, trans, comps = pca(A, tol=0.05)

To quickly update mean, trans and comps taking into account new data A_new:

mean, trans, comps = pca(A_new, have=(mean, trans, comps))

To compute 5% accuracy PCA approximation incrementally by processing 1000 data samples at a time:

mean, trans, comps = pca(A, tol=0.05, batch_size=1000)

Documentation

Basic usage of the package is briefly described in the docstrings of modules in interfaces and examples. Advanced users will find the description of basic principles of RALEIGH's design in core module solver.

The mathematical and numerical aspects of the algorithm implemented by RALEIGH are described in the papers by E. E. Ovtchinnikov in J. Comput. Phys. 227:9477-9497 and SIAM Numer. Anal. 46:2567-2619.

Issues

Please use GitHub issue tracker or send an e-mail to Evgueni to report bugs and request features.

License

RALEIGH is released under 3-clause BSD licence.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raleigh-1.2.2.tar.gz (61.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raleigh-1.2.2-py3-none-any.whl (92.2 kB view details)

Uploaded Python 3

File details

Details for the file raleigh-1.2.2.tar.gz.

File metadata

  • Download URL: raleigh-1.2.2.tar.gz
  • Upload date:
  • Size: 61.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.0

File hashes

Hashes for raleigh-1.2.2.tar.gz
Algorithm Hash digest
SHA256 7edd24693f418614e8cf6cebcaea68861f91ddd7b35233cd39dafc753ad66f59
MD5 d0a437805908587bf035d3d41ed95f52
BLAKE2b-256 aa9e16272215a8bacc24cd00605c00b3d236acfb7f63d03a59a56ef927f20b36

See more details on using hashes here.

File details

Details for the file raleigh-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: raleigh-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 92.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.0

File hashes

Hashes for raleigh-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4678d3907149d1fb9afd1acc7b3b446378df45da1c95bcc9584d6a54601c1e
MD5 29d4b95a973449719bfd9949ece95933
BLAKE2b-256 2505c416e1e0ee3633c9df7945484c6f4fddc696a6bac91e76c0a974f01ef351

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page