DFT-EFE
 
Loading...
Searching...
No Matches
dftefe::linearAlgebra::MultiVectorOps Class Reference

Stateless class of static functions for spin-aware projection and rotation of product-space multivectors. More...

#include <MultiVectorOps.h>

Static Public Member Functions

template<typename ValueTypeOperator , typename ValueTypeOperand , utils::MemorySpace memorySpace>
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). More...
 
template<typename ValueTypeOperator , typename ValueTypeOperand , utils::MemorySpace memorySpace>
static void project (const OperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace > &Op, MultiVectorProductSpace< ValueTypeOperand, memorySpace > &X, ScaLAPACKMatrix< blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand > > &P, 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)
 Coupled overload (unpolarized S=1 / non-collinear S=2, MultiVectorProductSpace). More...
 
template<typename ValueType , utils::MemorySpace memorySpace>
static void rotate (MultiVectorProductSpaceBlocked< ValueType, memorySpace > &X, const std::vector< ScaLAPACKMatrix< ValueType > > &Qs, const ElpaScalapackManager &elpa)
 Blocked rotate overload (collinear, MultiVectorProductSpaceBlocked). More...
 
template<typename ValueType , utils::MemorySpace memorySpace>
static void rotate (MultiVectorProductSpace< ValueType, memorySpace > &X, const ScaLAPACKMatrix< ValueType > &Q, const ElpaScalapackManager &elpa)
 Coupled rotate overload (unpolarized / non-collinear, MultiVectorProductSpace). More...
 
template<typename ValueType1 , typename ValueType2 , utils::MemorySpace memorySpace>
static void copyToBatch (const MultiVectorProductSpace< ValueType1, memorySpace > &X, size_type srcStart, size_type numVecBatch, MultiVector< ValueType2, memorySpace > &Xbatch, LinAlgOpContext< memorySpace > &context)
 
template<typename ValueType1 , typename ValueType2 , utils::MemorySpace memorySpace>
static void copyFromBatch (const MultiVector< ValueType1, memorySpace > &Ybatch, size_type dstStart, size_type numVecBatch, MultiVectorProductSpace< ValueType2, memorySpace > &Y, LinAlgOpContext< memorySpace > &context)
 

Detailed Description

Stateless class of static functions for spin-aware projection and rotation of product-space multivectors.

project() computes P = X^H Op X. rotate() performs X <- X * Q in-place.

Two overloads per function, selected at compile time by the multivector type (most-derived-first):

MultiVectorProductSpaceBlocked (collinear): Blocked loop over S independent N×N sub-problems. Spin-s columns accessed via ptr = X.data() + s*N, lda = S*N — no intermediate copy.

MultiVectorProductSpace (unpolarized S=1 or non-collinear S=2): Single call on the full S*N columns as a coupled unit. S=1 degenerates exactly to the existing scalar path.

scratchXin / scratchXout / scratchXinSmall / scratchXoutSmall for project() are owned by the caller and persist across SCF calls to avoid repeated allocation. All other scratch (SBlock, rotation buffers) is allocated internally per call, consistent with ElpaScalapackOperations.

dynamic_cast is NOT performed inside these functions. The caller (RayleighRitzEigenSolver::solve, OrthonormalizationFunctions methods) performs one dynamic_cast per call, then passes the correctly-typed reference here so the compiler selects the right overload.

Member Function Documentation

◆ copyFromBatch()

template<typename ValueType1 , typename ValueType2 , utils::MemorySpace memorySpace>
void dftefe::linearAlgebra::MultiVectorOps::copyFromBatch ( const MultiVector< ValueType1, memorySpace > &  Ybatch,
size_type  dstStart,
size_type  numVecBatch,
MultiVectorProductSpace< ValueType2, memorySpace > &  Y,
LinAlgOpContext< memorySpace > &  context 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyToBatch()

template<typename ValueType1 , typename ValueType2 , utils::MemorySpace memorySpace>
void dftefe::linearAlgebra::MultiVectorOps::copyToBatch ( const MultiVectorProductSpace< ValueType1, memorySpace > &  X,
size_type  srcStart,
size_type  numVecBatch,
MultiVector< ValueType2, memorySpace > &  Xbatch,
LinAlgOpContext< memorySpace > &  context 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ project() [1/2]

template<typename ValueTypeOperator , typename ValueTypeOperand , utils::MemorySpace memorySpace>
void dftefe::linearAlgebra::MultiVectorOps::project ( const OperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace > &  Op,
MultiVectorProductSpace< ValueTypeOperand, memorySpace > &  X,
ScaLAPACKMatrix< blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand > > &  P,
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 
)
static

Coupled overload (unpolarized S=1 / non-collinear S=2, MultiVectorProductSpace).

Computes a single overlap matrix: P = X^H Op X (S*N × S*N) The full S*N columns are treated as a coupled unit. S=1 degenerates to the existing N×N scalar path.

Parameters
OpOperator context.
XCoupled product-space multivector (M × S*N).
POutput: single ScaLAPACK S*N×S*N matrix (pre-allocated).
elpaELPA/ScaLAPACK manager.
scratchXinScratch multivector (M × batchSize), caller-owned.
scratchXoutScratch multivector (M × batchSize), caller-owned.
scratchXinSmallTail-batch scratch, nullptr on first call; cached.
scratchXoutSmallTail-batch scratch, nullptr on first call; cached.
Here is the call graph for this function:

◆ project() [2/2]

template<typename ValueTypeOperator , typename ValueTypeOperand , utils::MemorySpace memorySpace>
void dftefe::linearAlgebra::MultiVectorOps::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 
)
static

Blocked overload (collinear, MultiVectorProductSpaceBlocked).

Computes S independent overlap matrices: Ps[s] = Xs^H Op Xs (N×N each) where Xs is the spin-s block of X accessed as ptr = X.data() + s * X.numVectorsPerSpace(), lda = X.numVectors()

Parameters
OpOperator context (e.g. B metric or identity).
XBlocked product-space multivector (M × S*N).
PsOutput: S ScaLAPACK N×N matrices (pre-allocated by caller).
elpaELPA/ScaLAPACK manager (provides process grid).
scratchXinScratch multivector (M × batchSize), caller-owned.
scratchXoutScratch multivector (M × batchSize), caller-owned.
scratchXinSmallTail-batch scratch, nullptr on first call; cached.
scratchXoutSmallTail-batch scratch, nullptr on first call; cached.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotate() [1/2]

template<typename ValueType , utils::MemorySpace memorySpace>
void dftefe::linearAlgebra::MultiVectorOps::rotate ( MultiVectorProductSpace< ValueType, memorySpace > &  X,
const ScaLAPACKMatrix< ValueType > &  Q,
const ElpaScalapackManager elpa 
)
static

Coupled rotate overload (unpolarized / non-collinear, MultiVectorProductSpace).

Performs a single in-place subspace rotation on all S*N columns: X <- X * Q One M×S*N scratch buffer (unavoidable for in-place operation). S=1 degenerates to the existing scalar rotation path.

Parameters
XCoupled multivector, modified in place.
QSingle rotation matrix (S*N × S*N).
elpaELPA/ScaLAPACK manager.
Here is the call graph for this function:

◆ rotate() [2/2]

template<typename ValueType , utils::MemorySpace memorySpace>
void dftefe::linearAlgebra::MultiVectorOps::rotate ( MultiVectorProductSpaceBlocked< ValueType, memorySpace > &  X,
const std::vector< ScaLAPACKMatrix< ValueType > > &  Qs,
const ElpaScalapackManager elpa 
)
static

Blocked rotate overload (collinear, MultiVectorProductSpaceBlocked).

Performs S independent in-place subspace rotations: Xs <- Xs * Qs[s] using ptr = X.data() + s*N, lda = S*N. scratchRotBlock (M×N) is reused across s iterations — S× smaller than the coupled scratch.

Parameters
XBlocked multivector, modified in place.
QsS rotation matrices (N×N each).
elpaELPA/ScaLAPACK manager.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: