stan-dev / stan-dev/math

Speedup symmetric eigendecomposition

Open
#1,156 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

Symmetric eigendecomposition from library Eigen is implemented in a suboptimal way. It consists of two steps: tridiagonalization and tridiagonal eigensolver.

In Eigen, basic Householder tridiagonalization is implemented. This can be improved on using blocked Householder algorithm, which uses cache more efficiently and is therefore faster.

For symmetric eigensolver Eigen uses QR iteration. While very accurate, it is quite slow. For square symmetric matrix of size n it does O(n^3) operations. It can be replaced by, for example, the
MRRR algorithm that is significantly faster - O(n^2) and usually accurate enough. However, for cases where multiple eigenvalues are very close to each other - with relative difference (l1-l2)/l1 between
them close to machine precision - MRRR might produce more significant errors or in extreme cases even fail to converge.

Both steps can be further improved using GPUs.

Example

Function is added that computes symmetric eigendecomposition.

Expected Output

Symmetric eigendecomposition is faster than one implemented in Eigen.

Current Version:

v2.18.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not identify files, tests, or an entry point. Start by locating the current Eigen symmetric eigendecomposition implementation and any relevant benchmarks, then assess blocked Householder tridiagonalization and an MRRR eigensolver as alternatives. Done means faster symmetric eigendecomposition while preserving acceptable accuracy and convergence.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.