Detailed Description

A container of ordered KronBlock_t objects representing a Kronecker product structure.

Definition at line 117 of file DMRGKron.hpp.

#include <DMRGKron.hpp>

Collaboration diagram for KronBlocks_t:

Public Member Functions

 KronBlocks_t (Block::SpinBase &LeftBlock, Block::SpinBase &RightBlock, const std::vector< PetscReal > &QNSectors, FILE *fp_prealloc, const PetscInt &GlobIdx)
 
PetscInt size () const
 Returns the total number blocks. More...
 
const std::vector< KronBlock_t > & data () const
 Returns a const reference to the KronBlocks object. More...
 
KronBlock_t data (size_t idx) const
 Returns the KronBlock for specified index. More...
 
KronBlock_t operator[] (size_t idx) const
 Returns the KronBlock for specified index. More...
 
std::vector< PetscReal > List () const
 Returns the list of quantum numbers. More...
 
std::vector< PetscInt > Offsets () const
 Returns the offsets for each quantum number block. More...
 
PetscInt Offsets (const PetscInt &idx) const
 Returns the offsets for a given index. More...
 
PetscReal QN (const PetscInt &idx) const
 Returns the left quantum number index (KronBlocks 1st endtry) for a given KronBlock index. More...
 
PetscInt LeftIdx (const PetscInt &idx) const
 Returns the left quantum number index (KronBlocks 1st endtry) for a given KronBlock index. More...
 
PetscInt RightIdx (const PetscInt &idx) const
 Returns the left quantum number index (KronBlocks 1st endtry) for a given KronBlock index. More...
 
PetscInt Sizes (const PetscInt &idx) const
 Returns the number of basis states for a given KronBlock index. More...
 
const Block::SpinBaseLeftBlockRef () const
 Returns a const reference to the left block object. More...
 
const Block::SpinBaseRightBlockRef () const
 Returns a const reference to the right block object. More...
 
Block::SpinBaseLeftBlockRefMod ()
 Returns a non-const reference to the left block object. More...
 
Block::SpinBaseRightBlockRefMod ()
 Returns a non-const reference to the right block object. More...
 
PetscInt Offsets (const PetscInt &lidx, const PetscInt &ridx) const
 Returns the offsets for the KronBlock corresponding to a pair of left and right block indices. More...
 
std::vector< PetscInt > Sizes () const
 Returns the number of basis states in each quantum number block. More...
 
PetscInt Map (const PetscInt &lidx, const PetscInt &ridx) const
 Returns the position index of the KronBlock corresponding to a pair of left and right block indices; if the index is not found it returns -1. More...
 
PetscInt NumStates () const
 Returns the total number of states. More...
 
PetscErrorCode KronSumConstruct (const std::vector< Hamiltonians::Term > &Terms, Mat &MatOut)
 Constructs the explicit sum of Kronecker products of matrices from the blocks. More...
 
PetscErrorCode KronConstruct (const Mat &Mat_L, const Op_t &OpType_L, const Mat &Mat_R, const Op_t &OpType_R, Mat &MatOut)
 Constructs the explicit sum of Kronecker products of two matrices provided that they follow a fixed Kronecker product structure according to the corresponding sub-blocks. More...
 
PetscErrorCode KronSumSetShellMatrix (const PetscBool &do_shell_in)
 Decide whether to create an implicit MATSHELL matrix. More...
 
PetscErrorCode KronSumSetRedistribute (const PetscBool &do_redistribute_in=PETSC_TRUE)
 
PetscErrorCode KronSumSetToleranceFromOptions ()
 

Private Member Functions

PetscErrorCode MatKronEyeAdd (const std::vector< Mat > &Matrices, const Side_t &SideType, Mat &MatOut)
 Calculates the Kronecker product of a set of matrices with the identity and adds it to. More...
 
PetscErrorCode VerifySzAssumption (const std::vector< Mat > &Matrices, const Side_t &SideType)
 Verifies that the assumtpion of intra-block terms to follow Sz form is valid. More...
 
PetscErrorCode KronGetSubmatrices (const Mat &Mat_L, const Op_t &OpType_L, const Mat &Mat_R, const Op_t &OpType_R, KronSumCtx &ctx)
 
PetscErrorCode KronSumConstructExplicit (const std::vector< Hamiltonians::Term > &TermsLR, Mat &MatOut)
 
PetscErrorCode KronSumConstructShell (const std::vector< Hamiltonians::Term > &TermsLR, Mat &MatOut)
 
PetscErrorCode KronSumSetUpShellTerms (KronSumShellCtx *shellctx)
 
PetscErrorCode KronSumGetSubmatrices (const Mat &OpProdSumLL, const Mat &OpProdSumRR, const std::vector< Hamiltonians::Term > &TermsLR, KronSumCtx &SubMat)
 
PetscErrorCode KronSumCalcPreallocation (KronSumCtx &ctx)
 
PetscErrorCode KronSumShellSplitOwnership (const Mat &OpProdSumLL, const Mat &OpProdSumRR, const std::vector< Hamiltonians::Term > &TermsLR, const PetscInt Nrows, PetscInt &lrows, PetscInt &rstart)
 
PetscErrorCode KronSumRedistribute (KronSumCtx &ctx, PetscBool &flg)
 
PetscErrorCode KronSumPreallocate (KronSumCtx &ctx, Mat &MatOut)
 
PetscErrorCode KronSumFillMatrix (KronSumCtx &ctx, Mat &MatOut)
 
PetscErrorCode SavePreallocData (const KronSumCtx &ctx)
 

Static Private Member Functions

static bool DescendingQN (const KronBlock_t &a, const KronBlock_t &b)
 Tolerance. More...
 

Private Attributes

MPI_Comm mpi_comm = PETSC_COMM_SELF
 
PetscMPIInt mpi_rank
 
PetscMPIInt mpi_size
 
const PetscInt GlobIdx
 
std::vector< KronBlock_tKronBlocks
 Storage for kronblocks. More...
 
std::vector< PetscReal > kb_list
 (Redundant) storage for quantum numbers More...
 
std::vector< PetscInt > kb_size
 (Redundant) storage for sizes of each quantum number block More...
 
std::vector< PetscInt > kb_offset
 Storage for offsets or starting elements of each block. More...
 
std::map< std::tuple< PetscInt, PetscInt >, PetscInt > kb_map
 Kronecker product mapping from (L,R) block to the corresponding index. More...
 
PetscInt num_blocks = 0
 The number of blocks stored. More...
 
PetscInt num_states = 0
 The total number of states stored. More...
 
Block::SpinBaseLeftBlock
 Reference to the left block object. More...
 
Block::SpinBaseRightBlock
 Reference to the right block object. More...
 
FILE * fp_prealloc
 File to store preallocation data for each processor. More...
 
PetscBool do_saveprealloc = PETSC_FALSE
 Whether to store preallocation data for each processor. More...
 
PetscBool do_redistribute = PETSC_FALSE
 Whether to redistribute the resulting KronSum. More...
 
PetscBool do_shell = PETSC_FALSE
 Whether to create an implicit MATSHELL matrix. More...
 
PetscBool called_KronSumShellSplitOwnership = PETSC_FALSE
 Whether KronSumShellSplitOwnership has been called before. More...
 
PetscInt prev_lrows = 0
 Stores the resulting lrows of a previous call to KronSumShellSplitOwnership. More...
 
PetscInt prev_rstart = 0
 Stores the resulting rstart of a previous call to KronSumShellSplitOwnership. More...
 

Friends

class KronBlocksIterator
 

The documentation for this class was generated from the following files:
This site was generated by Sphinx using Doxygen with a customized theme from doxygen-bootstrapped.