DFT-EFE
 
Loading...
Searching...
No Matches
LanczosExtremeEigenSolver.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Avirup Sircar
24 */
25
26#ifndef dftefeLanczosExtremeEigenSolver_h
27#define dftefeLanczosExtremeEigenSolver_h
28
37#include <memory>
38
39namespace dftefe
40{
41 namespace linearAlgebra
42 {
54 template <typename ValueTypeOperator,
55 typename ValueTypeOperand,
56 utils::MemorySpace memorySpace>
58 : public HermitianIterativeEigenSolver<ValueTypeOperator,
59 ValueTypeOperand,
60 memorySpace>
61 {
62 public:
69 using ValueType =
72 using OpContext =
73 typename HermitianIterativeEigenSolver<ValueTypeOperator,
74 ValueTypeOperand,
75 memorySpace>::OpContext;
76
81 const size_type maxKrylovSubspaceSize,
82 const size_type numLowerExtermeEigenValues,
83 const size_type numUpperExtermeEigenValues,
84 std::vector<double> &tolerance,
85 double lanczosBetaTolerance,
87 bool isAdaptiveSolve = true);
88
90 const size_type maxKrylovSubspaceSize,
91 const size_type numLowerExtermeEigenValues,
92 const size_type numUpperExtermeEigenValues,
93 std::vector<double> &tolerance,
94 double lanczosBetaTolerance,
95 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
96 mpiPatternP2P,
97 std::shared_ptr<LinAlgOpContext<memorySpace>> linAlgOpContext,
98 bool isAdaptiveSolve,
99 size_type numSpaces);
100
106
107 void
108 reinit(const size_type maxKrylovSubspaceSize,
109 const size_type numLowerExtermeEigenValues,
110 const size_type numUpperExtermeEigenValues,
111 std::vector<double> &tolerance,
112 double lanczosBetaTolerance,
114
115 void
116 reinit(const size_type maxKrylovSubspaceSize,
117 const size_type numLowerExtermeEigenValues,
118 const size_type numUpperExtermeEigenValues,
119 std::vector<double> &tolerance,
120 double lanczosBetaTolerance,
121 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
122 mpiPatternP2P,
123 std::shared_ptr<LinAlgOpContext<memorySpace>> linAlgOpContext,
124 size_type numSpaces);
125
127 solve(const OpContext & A,
128 std::vector<RealType> & eigenValues,
130 bool computeEigenVectors = false,
131 const OpContext &B = IdentityOperatorContext<ValueTypeOperator,
132 ValueTypeOperand,
133 memorySpace>(),
134 const OpContext &BInv =
135 IdentityOperatorContext<ValueTypeOperator,
136 ValueTypeOperand,
137 memorySpace>()) override;
138
139 void
140 getTridiagonalMatrix(std::vector<RealType> &diagonal,
141 std::vector<RealType> &subDiagonal) const;
142
143 private:
148 std::vector<double> d_tolerance;
150 std::vector<RealType> d_diagonal;
151 std::vector<RealType> d_subDiagonal;
154
155
156 }; // end of class LanczosExtremeEigenSolver
157 } // namespace linearAlgebra
158} // end of namespace dftefe
160#endif // dftefeLanczosExtremeEigenSolver_h
Abstract class to encapsulate the action of a discrete operator on vectors, matrices,...
Definition: IdentityOperatorContext.h:53
A derived class of OperatorContext to encapsulate the action of a discrete operator on vectors,...
Definition: LanczosExtremeEigenSolver.h:61
std::vector< RealType > d_diagonal
Definition: LanczosExtremeEigenSolver.h:150
const bool d_isAdaptiveSolve
Definition: LanczosExtremeEigenSolver.h:153
size_type d_numUpperExtermeEigenValues
Definition: LanczosExtremeEigenSolver.h:147
size_type d_maxKrylovSubspaceSize
Definition: LanczosExtremeEigenSolver.h:145
void getTridiagonalMatrix(std::vector< RealType > &diagonal, std::vector< RealType > &subDiagonal) const
Definition: LanczosExtremeEigenSolver.t.cpp:586
~LanczosExtremeEigenSolver()=default
Default Destructor.
double d_lanczosBetaTolerance
Definition: LanczosExtremeEigenSolver.h:149
size_type d_numLowerExtermeEigenValues
Definition: LanczosExtremeEigenSolver.h:146
bool d_isSolved
Definition: LanczosExtremeEigenSolver.h:152
void reinit(const size_type maxKrylovSubspaceSize, const size_type numLowerExtermeEigenValues, const size_type numUpperExtermeEigenValues, std::vector< double > &tolerance, double lanczosBetaTolerance, const MultiVector< ValueTypeOperand, memorySpace > &initialGuess)
Definition: LanczosExtremeEigenSolver.t.cpp:99
blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand > ValueType
define ValueType as the superior (bigger set) of the ValueTypeOperator and ValueTypeOperand (e....
Definition: LanczosExtremeEigenSolver.h:70
MultiVector< ValueTypeOperand, memorySpace > d_initialGuess
Definition: LanczosExtremeEigenSolver.h:144
std::vector< RealType > d_subDiagonal
Definition: LanczosExtremeEigenSolver.h:151
EigenSolverError solve(const OpContext &A, std::vector< RealType > &eigenValues, MultiVector< ValueType, memorySpace > &eigenVectors, bool computeEigenVectors=false, const OpContext &B=IdentityOperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace >(), const OpContext &BInv=IdentityOperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace >()) override
Definition: LanczosExtremeEigenSolver.t.cpp:160
typename HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::OpContext OpContext
Definition: LanczosExtremeEigenSolver.h:75
blasLapack::real_type< ValueType > RealType
Definition: LanczosExtremeEigenSolver.h:71
std::vector< double > d_tolerance
Definition: LanczosExtremeEigenSolver.h:148
Definition: LinAlgOpContext.h:52
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
A class template to store the communication pattern (i.e., which entries/nodes to receive from which ...
Definition: MPIPatternP2P.h:197
typeInternal::real_type< ValueType > real_type
Definition: BlasLapackTypedef.h:177
typeInternal::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:183
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9
Definition: LinearAlgebraTypes.h:154