GQCP
Loading...
Searching...
No Matches
DenseDiagonalization.hpp
Go to the documentation of this file.
1// This file is part of GQCG-GQCP.
2//
3// Copyright (C) 2017-2020 the GQCG developers
4//
5// GQCG-GQCP is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GQCG-GQCP is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GQCG-GQCP. If not, see <http://www.gnu.org/licenses/>.
17
18#pragma once
19
20
23
24#include <Eigen/Dense>
25
26
27namespace GQCP {
28
29
35template <typename _Scalar>
37 public Step<EigenproblemEnvironment<_Scalar>> {
38public:
39 // The scalar type of the matrix elements: real or complex.
40 using Scalar = _Scalar;
41
42
43public:
44 /*
45 * PUBLIC OVERRIDDEN METHODS
46 */
47
51 std::string description() const override {
52 return "Read the matrix from the environment, diagonalize it and write the number of requested eigenpairs to it.";
53 }
54
55
61 void execute(EigenproblemEnvironment<Scalar>& environment) override {
62
63 // Solve the eigenvalue problem using Eigen's routines.
64 const auto& A = environment.A;
65 Eigen::SelfAdjointEigenSolver<Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>> eigensolver {A};
66
67 // Write the eigenvalues and eigenvectors to the environment.
68 environment.eigenvalues = eigensolver.eigenvalues();
69 environment.eigenvectors = eigensolver.eigenvectors();
70 }
71};
72
73
74} // namespace GQCP
Definition: DenseDiagonalization.hpp:37
_Scalar Scalar
Definition: DenseDiagonalization.hpp:40
std::string description() const override
Definition: DenseDiagonalization.hpp:51
void execute(EigenproblemEnvironment< Scalar > &environment) override
Definition: DenseDiagonalization.hpp:61
Definition: EigenproblemEnvironment.hpp:35
VectorX< double > eigenvalues
Definition: EigenproblemEnvironment.hpp:57
SquareMatrix< Scalar > A
Definition: EigenproblemEnvironment.hpp:47
MatrixX< Scalar > eigenvectors
Definition: EigenproblemEnvironment.hpp:60
Definition: Step.hpp:37
Definition: BaseOneElectronIntegralBuffer.hpp:25