DFT-EFE
 
Loading...
Searching...
No Matches
RayleighRitzEigenSolver.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 dftefeRayleighRitzEigenSolver_h
27#define dftefeRayleighRitzEigenSolver_h
28
36#include <memory>
38
39namespace dftefe
40{
41 namespace linearAlgebra
42 {
54 template <typename ValueTypeOperator,
55 typename ValueTypeOperand,
56 utils::MemorySpace memorySpace>
58 {
59 public:
66 using ValueType =
69 using OpContext =
71
72 public:
77 const size_type eigenVectorBatchSize,
78 const ElpaScalapackManager &elpaScala,
79 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
80 mpiPatternP2P,
81 std::shared_ptr<LinAlgOpContext<memorySpace>> linAlgOpContext,
82 const bool useScalpack = true);
83
89
90 // In this case we can solve the KohnSham GHEP if the X's are B
91 // orthogonalized. X_MO^T H X_MO Q = \lambda X_MO^T M X_MO Q , or, H X =
92 // \lambda M X if X = X_MO Q
94 solve(const OpContext & A,
96 std::vector<RealType> & eigenValues,
98 bool computeEigenVectors = false);
99
100 // In this case we solve the Kohn Sham GHEP if X's are othogonalized.
101 // X_O^T H X_O Q = \lambda X_O^T M X_O Q , or,
102 // H X = \lambda M X if X = X_O Q
104 solve(const OpContext & A,
105 const OpContext & B,
107 std::vector<RealType> & eigenValues,
109 bool computeEigenVectors = false);
110
111 // /** In this case we solve the Kohn Sham GHEP for any general X
112 // * Performs cholesky factorization for orthogonalization internally.
113 // * SConj = X^T M X
114 // * SConj=LConj*L^{T}
115 // * Lconj^{-1} compute
116 // * compute HSConjProj= Lconj^{-1}*HConjProj*(Lconj^{-1})^C (C denotes
117 // * conjugate transpose LAPACK notation)
118 // * compute standard eigendecomposition HSConjProj: {QConjPrime,D}
119 // * HSConjProj=QConjPrime*D*QConjPrime^{C} QConj={Lc^{-1}}^{C}*QConjPrime
120 // * rotate the basis in the subspace
121 // * X^{T}={QConjPrime}^{C}*LConj^{-1}*X^{T}, stored in the column major
122 // * format In the above we use Q^{T}={QConjPrime}^{C}*LConj^{-1}
123 // * In other words, X_O^T H X_O Q = \lambda X_O^T M X_O Q , or,
124 // * H X = \lambda M X if X = X_O Q where X_O = X((LInv)^C) (C is conj
125 // trans)
126 // **/
127 // EigenSolverError
128 // solveGEPNoOrtho(const OpContext & A,
129 // const OpContext & B,
130 // MultiVector<ValueTypeOperand, memorySpace> &X,
131 // std::vector<RealType> & eigenValues,
132 // MultiVector<ValueType, memorySpace> & eigenVectors,
133 // bool computeEigenVectors = false);
134
135 private:
136 void
139 const OpContext & Op,
140 const bool &useBatched = true);
141
142 void
144 const std::shared_ptr<const ProcessGrid> & processGrid,
145 ScaLAPACKMatrix<ValueType> &overlapMatPar,
146 const OpContext & Op);
147
148 std::shared_ptr<MultiVector<ValueType, memorySpace>> d_XinBatchSmall,
150
153
155 const bool d_useELPA;
156 const bool d_useScalapack;
157
158 }; // end of class RayleighRitzEigenSolver
159 } // end of namespace linearAlgebra
160} // end of namespace dftefe
162#endif // dftefeRayleighRitzEigenSolver_h
Manager class for ELPA and ScaLAPACK.
Definition: ElpaScalapackManager.h:43
Definition: LinAlgOpContext.h:38
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
Abstract class to encapsulate the action of a discrete operator on vectors, matrices,...
Definition: OperatorContext.h:51
A derived class of OperatorContext to encapsulate the action of a discrete operator on vectors,...
Definition: RayleighRitzEigenSolver.h:58
size_type d_batchSizeSmall
Definition: RayleighRitzEigenSolver.h:151
const size_type d_eigenVecBatchSize
Definition: RayleighRitzEigenSolver.h:152
~RayleighRitzEigenSolver()=default
Default Destructor.
blasLapack::real_type< ValueType > RealType
Definition: RayleighRitzEigenSolver.h:68
const bool d_useScalapack
Definition: RayleighRitzEigenSolver.h:156
void computeXTransOpX(MultiVector< ValueTypeOperand, memorySpace > &X, utils::MemoryStorage< ValueType, memorySpace > &S, const OpContext &Op, const bool &useBatched=true)
Definition: RayleighRitzEigenSolver.t.cpp:488
const bool d_useELPA
Definition: RayleighRitzEigenSolver.h:155
blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand > ValueType
define ValueType as the superior (bigger set) of the ValueTypeOperator and ValueTypeOperand (e....
Definition: RayleighRitzEigenSolver.h:67
std::shared_ptr< MultiVector< ValueType, memorySpace > > d_XoutBatch
Definition: RayleighRitzEigenSolver.h:149
std::shared_ptr< MultiVector< ValueType, memorySpace > > d_XinBatchSmall
Definition: RayleighRitzEigenSolver.h:148
const ElpaScalapackManager * d_elpaScala
Definition: RayleighRitzEigenSolver.h:154
std::shared_ptr< MultiVector< ValueType, memorySpace > > d_XoutBatchSmall
Definition: RayleighRitzEigenSolver.h:149
std::shared_ptr< MultiVector< ValueType, memorySpace > > d_XinBatch
Definition: RayleighRitzEigenSolver.h:149
EigenSolverError solve(const OpContext &A, MultiVector< ValueTypeOperand, memorySpace > &X, std::vector< RealType > &eigenValues, MultiVector< ValueType, memorySpace > &eigenVectors, bool computeEigenVectors=false)
Definition: RayleighRitzEigenSolver.t.cpp:67
Scalapack wrapper adapted from dealii library and extended implementation to complex datatype.
Definition: ScalapackWrapper.h:43
Definition: MemoryStorage.h:38
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
unsigned int size_type
Definition: TypeConfig.h:8
Definition: LinearAlgebraTypes.h:147