Class exactSolver#
Defined in File sparseSolver.hpp
Class Documentation#
-
class exactSolver#
Exact dense matrix eigenvalue solver for small systems.
Solves the full eigenvalue problem for a dense matrix using LAPACK. Suitable for small to medium systems where memory/speed trade-off favors dense storage. Uses LAPACK’s dgeev for non-symmetric eigenvalue problems.
The solver finds the eigenvector corresponding to the eigenvalue with minimum absolute value, normalized so that components sum to 1.
Note
Eigenvector is returned as the ground state wavefunction
Note
Uses O(N^3) LAPACK algorithms - suitable for N < 5000
Public Functions
-
inline explicit exactSolver(size_t n = 0)#
Initialize solver with matrix size.
- Parameters:
n – Dimension of square matrix (default: 0)
-
inline void set(size_t i, size_t j, double val)#
Add a matrix element (cumulative, supports += operation).
Note
This method accumulates: a(i,j) += val
- Parameters:
i – Row index
j – Column index
val – Value to add to (i,j) element
-
inline std::vector<double> solve()#
Solve eigenvalue problem and return ground state eigenvector.
Finds left/right eigenvector pairs and eigenvalues using non-symmetric LAPACK routines. Returns the right eigenvector corresponding to the eigenvalue with smallest absolute value, normalized to unit sum.
Note
Output is normalized: sum(components) = 1.0
Note
Modifies internal matrix during computation
- Throws:
std::exception – if LAPACK eigenvalue computation fails
- Returns:
Vector containing normalized ground state eigenvector components
-
inline auto vectorDot(std::vector<double> &a)#
Compute matrix-vector product y = H·x.
- Parameters:
a – Input vector of length column
- Returns:
Result vector containing H·a
-
inline explicit exactSolver(size_t n = 0)#