numerics 0.1.0
Loading...
Searching...
No Matches
eig.cpp
Go to the documentation of this file.
1/// @file eigen/eig.cpp
2/// @brief Full symmetric eigendecomposition dispatcher.
3///
4/// Backend routing:
5/// Backend::lapack -> backends::lapack::eig_sym (LAPACKE_dsyevd,
6/// divide-and-conquer) Backend::omp -> backends::omp::eig_sym (cyclic
7/// Jacobi, parallel inner loops) everything else -> backends::seq::eig_sym
8/// (cyclic Jacobi, sequential)
9
10#include "backends/lapack/impl.hpp"
11#include "backends/omp/impl.hpp"
12#include "backends/seq/impl.hpp"
14
15namespace num {
16
17EigenResult eig_sym(const Matrix &A, real tol, idx max_sweeps,
18 Backend backend) {
19 switch (backend) {
20 case Backend::lapack:
22 case Backend::omp:
23 return backends::omp::eig_sym(A, tol, max_sweeps);
24 default:
25 return backends::seq::eig_sym(A, tol, max_sweeps);
26 }
27}
28
29} // namespace num
Dense row-major matrix with optional GPU storage.
Definition matrix.hpp:12
Full symmetric eigendecomposition via cyclic Jacobi sweeps.
EigenResult eig_sym(const Matrix &A)
EigenResult eig_sym(const Matrix &A, real tol, idx max_sweeps)
EigenResult eig_sym(const Matrix &A, real tol, idx max_sweeps)
double real
Definition types.hpp:10
Backend
Selects which backend handles a linalg operation.
Definition policy.hpp:19
@ omp
OpenMP parallel blocked loops.
@ lapack
LAPACKE – industry-standard factorizations, SVD, eigen.
std::size_t idx
Definition types.hpp:11
EigenResult eig_sym(const Matrix &A, real tol=1e-12, idx max_sweeps=100, Backend backend=lapack_backend)
Full eigendecomposition of a real symmetric matrix.
Definition eig.cpp:17
Full eigendecomposition result: A = V * diag(values) * V^T.