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,
86 const Vector<ValueTypeOperand, memorySpace> &initialGuess);
87
89 const size_type maxKrylovSubspaceSize,
90 const size_type numLowerExtermeEigenValues,
91 const size_type numUpperExtermeEigenValues,
92 std::vector<double> &tolerance,
93 double lanczosBetaTolerance,
94 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
95 mpiPatternP2P,
96 std::shared_ptr<LinAlgOpContext<memorySpace>> linAlgOpContext);
97
103
104 void
105 reinit(const size_type maxKrylovSubspaceSize,
106 const size_type numLowerExtermeEigenValues,
107 const size_type numUpperExtermeEigenValues,
108 std::vector<double> &tolerance,
109 double lanczosBetaTolerance,
110 const Vector<ValueTypeOperand, memorySpace> &initialGuess);
111
112 void
113 reinit(const size_type maxKrylovSubspaceSize,
114 const size_type numLowerExtermeEigenValues,
115 const size_type numUpperExtermeEigenValues,
116 std::vector<double> &tolerance,
117 double lanczosBetaTolerance,
118 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
119 mpiPatternP2P,
120 std::shared_ptr<LinAlgOpContext<memorySpace>> linAlgOpContext);
121
123 solve(const OpContext & A,
124 std::vector<RealType> & eigenValues,
126 bool computeEigenVectors = false,
127 const OpContext &B = IdentityOperatorContext<ValueTypeOperator,
128 ValueTypeOperand,
129 memorySpace>(),
130 const OpContext &BInv =
131 IdentityOperatorContext<ValueTypeOperator,
132 ValueTypeOperand,
133 memorySpace>()) override;
134
135 void
136 getTridiagonalMatrix(std::vector<RealType> &diagonal,
137 std::vector<RealType> &subDiagonal) const;
138
139 private:
144 std::vector<double> d_tolerance;
146 std::vector<RealType> d_diagonal;
147 std::vector<RealType> d_subDiagonal;
149
150
151 }; // end of class LanczosExtremeEigenSolver
152 } // namespace linearAlgebra
153} // end of namespace dftefe
155#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:146
size_type d_numUpperExtermeEigenValues
Definition: LanczosExtremeEigenSolver.h:143
size_type d_maxKrylovSubspaceSize
Definition: LanczosExtremeEigenSolver.h:141
Vector< ValueTypeOperand, memorySpace > d_initialGuess
Definition: LanczosExtremeEigenSolver.h:140
void getTridiagonalMatrix(std::vector< RealType > &diagonal, std::vector< RealType > &subDiagonal) const
Definition: LanczosExtremeEigenSolver.t.cpp:589
void reinit(const size_type maxKrylovSubspaceSize, const size_type numLowerExtermeEigenValues, const size_type numUpperExtermeEigenValues, std::vector< double > &tolerance, double lanczosBetaTolerance, const Vector< ValueTypeOperand, memorySpace > &initialGuess)
Definition: LanczosExtremeEigenSolver.t.cpp:138
~LanczosExtremeEigenSolver()=default
Default Destructor.
double d_lanczosBetaTolerance
Definition: LanczosExtremeEigenSolver.h:145
size_type d_numLowerExtermeEigenValues
Definition: LanczosExtremeEigenSolver.h:142
bool d_isSolved
Definition: LanczosExtremeEigenSolver.h:148
blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand > ValueType
define ValueType as the superior (bigger set) of the ValueTypeOperator and ValueTypeOperand (e....
Definition: LanczosExtremeEigenSolver.h:70
std::vector< RealType > d_subDiagonal
Definition: LanczosExtremeEigenSolver.h:147
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:220
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:144
Definition: LinAlgOpContext.h:38
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
A class that encapsulates a vector. This is a vector in the mathematical sense and not in the sense o...
Definition: Vector.h:122
A class template to store the communication pattern (i.e., which entries/nodes to receive from which ...
Definition: MPIPatternP2P.h:197
blas::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:70
blas::real_type< ValueType > real_type
Definition: BlasLapackTypedef.h:64
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8
Definition: LinearAlgebraTypes.h:127