DMRGKron.hpp
38 PetscInt rstart=0;
39 PetscInt rend=0;
40 PetscInt lrows=0;
41 PetscInt cstart=0;
42 PetscInt cend=0;
43 PetscInt lcols=0;
44 PetscInt Nrows=0;
45 PetscInt Ncols=0;
69 PetscInt MinIdx=0;
72 PetscInt MaxIdx=0;
362 PetscInt num_blocks = 0;
377 PetscBool do_saveprealloc = PETSC_FALSE;
380 PetscBool do_redistribute = PETSC_FALSE;
383 PetscBool do_shell = PETSC_FALSE;
386 PetscBool called_KronSumShellSplitOwnership = PETSC_FALSE;
389 PetscInt prev_lrows = 0;
392 PetscInt prev_rstart = 0;
606 PetscInt NumStatesRight() const { return KronBlocks.RightBlock.Magnetization.Sizes()[BlockIdxRight()]; }
631 PetscInt istart_ = 0;
634 PetscInt iend_ = 0;
637 PetscInt idx_ = 0;
640 PetscInt blockidx_ = -1;
643 PetscInt locidx_ = 0;
652 PetscInt num_states = 0;
655 PetscBool updated_block = PETSC_TRUE;
std::vector< PetscInt > Sizes() const
Returns the number of basis states in each quantum number block.
Definition: DMRGKron.hpp:279
PetscInt Steps() const
Gets the number of steps incremented from the starting index.
Definition: DMRGKron.hpp:584
Block::SpinBase & RightBlockRefMod()
Returns a non-const reference to the right block object.
Definition: DMRGKron.hpp:269
PetscInt BlockSize(const PetscInt &BlockShift) const
Gets the size of the block with a shift.
Definition: DMRGKron.hpp:568
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...
Definition: DMRGKron.hpp:272
std::map< std::tuple< PetscInt, PetscInt >, PetscInt > kb_map
Kronecker product mapping from (L,R) block to the corresponding index.
Definition: DMRGKron.hpp:359
Base class for the implementation of a block of spin sites.
Definition: DMRGBlock.hpp:79
Block::SpinBase & LeftBlockRefMod()
Returns a non-const reference to the left block object.
Definition: DMRGKron.hpp:266
Calculates the sum of the Kronecker product of operators on two blocks following the terms of a Hamil...
Definition: DMRGKron.hpp:501
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; ...
Definition: DMRGKron.hpp:283
PetscInt Sizes(const PetscInt &idx) const
Returns the number of basis states for a given KronBlock index.
Definition: DMRGKron.hpp:255
std::vector< KronSumTerm > Terms
Lists down all the terms of the KronSum with Mat entries filled with local submatrices.
Definition: DMRGKron.hpp:57
PetscInt RightIdx(const PetscInt &idx) const
Returns the left quantum number index (KronBlocks 1st endtry) for a given KronBlock index...
Definition: DMRGKron.hpp:250
std::vector< PetscReal > List() const
Returns the list of quantum numbers.
Definition: DMRGKron.hpp:228
PetscErrorCode KronEye_Explicit(Block::SpinBase &LeftBlock, Block::SpinBase &RightBlock, const std::vector< Hamiltonians::Term > &Terms, Block::SpinBase &BlockOut)
Calculates a new block combining two spin-1/2 blocks.
Definition: DMRGKron.cpp:459
Op_t
Identifies the three possible spin operators and also represents the shift associated to its action o...
Definition: DMRGBlock.hpp:21
PetscBool UpdatedBlock() const
Gets the update state of the block index from the previous increment.
Definition: DMRGKron.hpp:623
PetscInt * Onnz
Preallocation data of the output matrix for local off-diagonal diagonal rows.
Definition: DMRGKron.hpp:66
std::unordered_map< PetscInt, PetscInt > MapRowsL
Maps the global indices of the rows of L and R to their local indices in the corresponding submatrice...
Definition: DMRGKron.hpp:54
PetscInt Offsets(const PetscInt &idx) const
Returns the offsets for a given index.
Definition: DMRGKron.hpp:234
std::vector< PetscReal > List() const
Returns the list of quantum numbers.
Definition: QuantumNumbers.hpp:86
PetscInt LocIdx() const
Gets the current local index in the quantum number block.
Definition: DMRGKron.hpp:553
std::vector< PetscInt > kb_size
Number of states in each quantum number block.
Definition: DMRGKron.hpp:646
std::vector< PetscInt > Maxnnz
Predicted maximum number of elements on each local row.
Definition: DMRGKron.hpp:75
std::vector< Mat * > LocalSubMats
List of unique submatrices to be destroyed later.
Definition: DMRGKron.hpp:60
KronBlocksIterator(const KronBlocks_t &KronBlocks, const PetscInt &GlobIdxStart, const PetscInt &GlobIdxEnd)
Initialize an iterator through a range of indices.
Definition: DMRGKron.hpp:508
KronBlocks_t(Block::SpinBase &LeftBlock, Block::SpinBase &RightBlock, const std::vector< PetscReal > &QNSectors, FILE *fp_prealloc, const PetscInt &GlobIdx)
Definition: DMRGKron.hpp:124
std::vector< PetscInt > ReqRowsL
List of required rows of the left and right blocks.
Definition: DMRGKron.hpp:51
PetscReal QN(const PetscInt &idx) const
Returns the left quantum number index (KronBlocks 1st endtry) for a given KronBlock index...
Definition: DMRGKron.hpp:240
std::vector< PetscInt > Sizes() const
Returns the number of basis states in each quantum number block.
Definition: QuantumNumbers.hpp:127
PetscInt * Dnnz
Preallocation data of the output matrix for local diagonal rows.
Definition: DMRGKron.hpp:63
const Block::SpinBase & LeftBlockRef() const
Returns a const reference to the left block object.
Definition: DMRGKron.hpp:260
PetscInt BlockStartIdx(const PetscInt &BlockShift) const
Gets the column index of the starting block with a shift.
Definition: DMRGKron.hpp:556
KronSumTermRow * kstr
Contains the KronSumTermRow's needed for calculating the terms of the full matrix.
Definition: DMRGKron.hpp:99
PetscBool Initialized() const
Indicates whether block has been initialized before using it.
Definition: DMRGBlock.hpp:335
std::vector< PetscInt > kb_size
(Redundant) storage for sizes of each quantum number block
Definition: DMRGKron.hpp:353
const std::vector< KronBlock_t > & data() const
Returns a const reference to the KronBlocks object.
Definition: DMRGKron.hpp:219
std::vector< PetscReal > kb_list
(Redundant) storage for quantum numbers
Definition: DMRGKron.hpp:350
PetscErrorCode KronSumSetShellMatrix(const PetscBool &do_shell_in)
Decide whether to create an implicit MATSHELL matrix.
Definition: DMRGKron.hpp:318
std::vector< PetscInt > Offsets() const
Returns the offsets for each quantum number block.
Definition: DMRGKron.hpp:231
std::tuple< PetscReal, PetscInt, PetscInt, PetscInt > KronBlock_t
Storage for information on resulting blocks of quantum numbers stored as a tuple for quick sorting...
Definition: DMRGKron.hpp:22
std::vector< PetscInt > kb_offset
Storage for offsets or starting elements of each block.
Definition: DMRGKron.hpp:356
const Block::SpinBase & RightBlockRef() const
Returns a const reference to the right block object.
Definition: DMRGKron.hpp:263
PetscInt LeftIdx(const PetscInt &idx) const
Returns the left quantum number index (KronBlocks 1st endtry) for a given KronBlock index...
Definition: DMRGKron.hpp:245
KronBlock_t data(size_t idx) const
Returns the KronBlock for specified index.
Definition: DMRGKron.hpp:222
A container of ordered KronBlock_t objects representing a Kronecker product structure.
Definition: DMRGKron.hpp:117
QuantumNumbers Magnetization
Stores the information on the magnetization Sectors.
Definition: DMRGBlock.hpp:326
KronBlock_t operator[](size_t idx) const
Returns the KronBlock for specified index.
Definition: DMRGKron.hpp:225
const KronBlocks_t & KronBlocks
Reference to the KronBlocks object on which this iterator is based on.
Definition: DMRGKron.hpp:628
MPI_Comm MPIComm() const
Gets the communicator associated to the block.
Definition: DMRGBlock.hpp:341
bool Loop() const
Determines whether the end of the range has not yet been reached.
Definition: DMRGKron.hpp:581
static bool DescendingQN(const KronBlock_t &a, const KronBlock_t &b)
Tolerance.
Definition: DMRGKron.hpp:402
PetscInt BlockIdxRight() const
Gets the block index for the right side.
Definition: DMRGKron.hpp:609
PetscInt NumStatesRight() const
Gets the number of states for the right block.
Definition: DMRGKron.hpp:606