DFT-EFE
 
Loading...
Searching...
No Matches
MultiVectorOps.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 dftefeMultiVectorOps_h
27#define dftefeMultiVectorOps_h
28
30#include <utils/MemoryStorage.h>
37#include <vector>
38
39namespace dftefe
40{
41 namespace linearAlgebra
42 {
74 {
75 public:
76 // -----------------------------------------------------------------------
77 // project
78 // -----------------------------------------------------------------------
79
97 template <typename ValueTypeOperator,
98 typename ValueTypeOperand,
99 utils::MemorySpace memorySpace>
100 static void
101 project(
103 & Op,
105 std::vector<ScaLAPACKMatrix<
107 const ElpaScalapackManager & elpa,
108 std::shared_ptr<MultiVector<
110 memorySpace>> &scratchXin,
111 std::shared_ptr<MultiVector<
113 memorySpace>> &scratchXout,
114 std::shared_ptr<MultiVector<
116 memorySpace>> &scratchXinSmall,
117 std::shared_ptr<MultiVector<
119 memorySpace>> &scratchXoutSmall);
120
139 template <typename ValueTypeOperator,
140 typename ValueTypeOperand,
141 utils::MemorySpace memorySpace>
142 static void
143 project(
145 & Op,
149 const ElpaScalapackManager & elpa,
150 std::shared_ptr<MultiVector<
152 memorySpace>> &scratchXin,
153 std::shared_ptr<MultiVector<
155 memorySpace>> &scratchXout,
156 std::shared_ptr<MultiVector<
158 memorySpace>> &scratchXinSmall,
159 std::shared_ptr<MultiVector<
161 memorySpace>> &scratchXoutSmall);
162
163 // -----------------------------------------------------------------------
164 // rotate
165 // -----------------------------------------------------------------------
166
180 template <typename ValueType, utils::MemorySpace memorySpace>
181 static void
183 const std::vector<ScaLAPACKMatrix<ValueType>> & Qs,
184 const ElpaScalapackManager & elpa);
185
199 template <typename ValueType, utils::MemorySpace memorySpace>
200 static void
203 const ElpaScalapackManager & elpa);
204
205 // -----------------------------------------------------------------------
206 // copyToBatch / copyFromBatch
207 // -----------------------------------------------------------------------
208
209 // Gather numVecBatch orbitals starting at srcStart for every spin channel
210 // into a flat MultiVector batch (Xbatch columns: spin-0, then spin-1,
211 // ...). Xbatch must have numSpaces * numVecBatch components. Two-type
212 // template mirrors stridedBlockCopy<VT1,VT2>: X stores VT1, Xbatch stores
213 // VT2 (typically VT1==VT2; differs inside projectImpl).
214
215 template <typename ValueType1,
216 typename ValueType2,
217 utils::MemorySpace memorySpace>
218 static void
220 size_type srcStart,
221 size_type numVecBatch,
224
225 // Inverse of copyToBatch: scatter the batch back into the product-space
226 // multivector at orbital positions [dstStart, dstStart+numVecBatch).
227
228 template <typename ValueType1,
229 typename ValueType2,
230 utils::MemorySpace memorySpace>
231 static void
233 size_type dstStart,
234 size_type numVecBatch,
237
238 }; // class MultiVectorOps
239
240 } // namespace linearAlgebra
241} // namespace dftefe
242
244#endif // dftefeMultiVectorOps_h
Manager class for ELPA and ScaLAPACK.
Definition: ElpaScalapackManager.h:43
Definition: LinAlgOpContext.h:52
Stateless class of static functions for spin-aware projection and rotation of product-space multivect...
Definition: MultiVectorOps.h:74
static void project(const OperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace > &Op, MultiVectorProductSpaceBlocked< ValueTypeOperand, memorySpace > &X, std::vector< ScaLAPACKMatrix< blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand > > > &Ps, const ElpaScalapackManager &elpa, std::shared_ptr< MultiVector< blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand >, memorySpace > > &scratchXin, std::shared_ptr< MultiVector< blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand >, memorySpace > > &scratchXout, std::shared_ptr< MultiVector< blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand >, memorySpace > > &scratchXinSmall, std::shared_ptr< MultiVector< blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand >, memorySpace > > &scratchXoutSmall)
Blocked overload (collinear, MultiVectorProductSpaceBlocked).
Definition: MultiVectorOps.t.cpp:650
static void copyToBatch(const MultiVectorProductSpace< ValueType1, memorySpace > &X, size_type srcStart, size_type numVecBatch, MultiVector< ValueType2, memorySpace > &Xbatch, LinAlgOpContext< memorySpace > &context)
Definition: MultiVectorOps.t.cpp:811
static void copyFromBatch(const MultiVector< ValueType1, memorySpace > &Ybatch, size_type dstStart, size_type numVecBatch, MultiVectorProductSpace< ValueType2, memorySpace > &Y, LinAlgOpContext< memorySpace > &context)
Definition: MultiVectorOps.t.cpp:847
static void rotate(MultiVectorProductSpaceBlocked< ValueType, memorySpace > &X, const std::vector< ScaLAPACKMatrix< ValueType > > &Qs, const ElpaScalapackManager &elpa)
Blocked rotate overload (collinear, MultiVectorProductSpaceBlocked).
Definition: MultiVectorOps.t.cpp:756
Type-tag subclass of MultiVectorProductSpace for collinear spin (S=2).
Definition: MultiVectorProductSpaceBlocked.h:47
MultiVector for product spaces: flat layout M × S × N where S = numSpaces, N = numVectorsPerSpace.
Definition: MultiVectorProductSpace.h:52
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
Scalapack wrapper adapted from dealii library and extended implementation to complex datatype.
Definition: ScalapackWrapper.h:43
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