|
Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
|
#include <serial.hpp>
Inheritance diagram for q3::SerialSubspaceDiagonalizer:Public Member Functions | |
| std::string | name () const override |
| int | solve (int basis_size, Complex *hamiltonian_matrix, Complex *overlap_matrix, Real *eigenvalues, Complex *eigenvector_matrix, bool is_gamma_only=false) override |
Public Member Functions inherited from q3::SubspaceDiagonalizer | |
| virtual | ~SubspaceDiagonalizer ()=default |
| virtual bool | is_collective () const |
Definition at line 16 of file serial.hpp.
|
inlineoverridevirtual |
Implements q3::SubspaceDiagonalizer.
Definition at line 148 of file serial.hpp.
|
inlineoverridevirtual |
Solve the generalized eigenvalue problem: H * C = S * C * E
| basis_size | Dimension of the subspace (matrix size). |
| hamiltonian_matrix | Projected Hamiltonian (destroyed/overwritten). May be the same buffer as eigenvector_matrix: every implementation reads it whole before it writes any eigenvector, which is what lets the caller keep one copy of H rather than two. |
| overlap_matrix | Projected overlap (destroyed/overwritten). |
| eigenvalues | Output eigenvalues (size basis_size). |
| eigenvector_matrix | Output eigenvectors (basis_size x basis_size). |
Gamma-only: H_sub and S_sub are real symmetric matrices, so dsygv solves them and its eigenvectors come out real.
Both are packed to real in place rather than into copies of their own: the real part of complex entry i is written to double entry i, which lies inside complex entry i/2 – already read – so a forward pass is safe, and the eigenvectors are expanded back to complex by a backward pass for the same reason. The matrices are the caller's to overwrite, and the Hamiltonian is usually the eigenvector buffer itself.
Non-gamma: use zhegv for complex Hermitian matrices. It leaves the eigenvectors where the Hamiltonian was, so the Hamiltonian goes into the eigenvector buffer – unless the caller already handed the same buffer as both.
Implements q3::SubspaceDiagonalizer.
Definition at line 18 of file serial.hpp.
References q3::lapack::dsygv_(), and q3::lapack::zhegv_().