63 if (eigenvalue_index < 0 || eigenvalue_index >= size)
64 throw std::runtime_error(
"hubbard starting eigenvalue index " +
65 std::to_string(eigenvalue_index + 1) +
66 " is outside the manifold (size " + std::to_string(size) +
")");
68 std::vector<Complex> eigenvectors = matrix;
69 std::vector<Real> eigenvalues(
static_cast<size_t>(size), 0.0);
70 int work_size = std::max(1, 2 * size - 1);
71 std::vector<Complex> work(
static_cast<size_t>(work_size));
72 std::vector<Real> rwork(
static_cast<size_t>(std::max(1, 3 * size - 2)));
80 reinterpret_cast<std::complex<double>*
>(eigenvectors.data()),
83 reinterpret_cast<std::complex<double>*
>(work.data()),
88 throw std::runtime_error(
"apply_hubbard_starting_eigenvalue: ZHEEV failed, info=" +
89 std::to_string(info));
91 eigenvalues[
static_cast<size_t>(eigenvalue_index)] = value;
98 for (
int row = 0; row < size; row++) {
99 for (
int column = 0; column < size; column++) {
101 for (
int k = 0; k < size; k++) {
103 eigenvectors[
static_cast<size_t>(row) +
static_cast<size_t>(k) * size] *
104 eigenvalues[
static_cast<size_t>(k)] *
106 eigenvectors[
static_cast<size_t>(column) +
static_cast<size_t>(k) * size]);
108 matrix[
static_cast<size_t>(row) +
static_cast<size_t>(column) * size] = accumulated;
void zheev_(const char *jobz, const char *uplo, const int *n, std::complex< double > *a, const int *lda, double *w, std::complex< double > *work, const int *lwork, double *rwork, int *info)