StatMech
Loading...
Searching...
No Matches
mBodyOperatorSpace< ScalarType > Class Template Reference

#include <OperatorSpace.hpp>

Inheritance diagram for mBodyOperatorSpace< ScalarType >:
Inheritance graph
Collaboration diagram for mBodyOperatorSpace< ScalarType >:
Collaboration graph

Public Types

using Scalar = ScalarType
 
using Base = ManyBodyOperatorSpaceBase< mBodyOperatorSpace< ScalarType > >
 
using BaseSpace = typename HilbertSpaceTraits< mBodyOperatorSpace< ScalarType > >::BaseSpace
 
using LocalSpace = typename HilbertSpaceTraits< mBodyOperatorSpace< ScalarType > >::LocalSpace
 
- Public Types inherited from ManyBodyOperatorSpaceBase< mBodyOperatorSpace< ScalarType > >
using BaseSpace = typename HilbertSpaceTraits< mBodyOperatorSpace< ScalarType > >::BaseSpace
 
using LocalSpace = typename HilbertSpaceTraits< mBodyOperatorSpace< ScalarType > >::LocalSpace
 
- Public Types inherited from OperatorSpaceBase< Derived >
typedef Eigen::NumTraits< ScalarType >::Real Real
 

Public Member Functions

__host__ __device__ mBodyOperatorSpace (int m, BaseSpace const &baseSpace)
 Construct an mBodyOperatorSpace object by copying a BaseSpace object.
 
__host__ __device__ mBodyOperatorSpace (int m, int sysSize, int dimLoc)
 Construct an mBodyOperatorSpace object by copying a BaseSpace object.
 
__host__ __device__ mBodyOperatorSpace ()=default
 Default constructor.
 
__host__ __device__ mBodyOperatorSpace (mBodyOperatorSpace const &other)=default
 Copy constructor.
 
__host__ __device__ mBodyOperatorSpace (mBodyOperatorSpace &&other)=default
 Move constructor.
 
__host__ __device__ ~mBodyOperatorSpace ()=default
 Destructor.
 
- Public Member Functions inherited from ManyBodyOperatorSpaceBase< mBodyOperatorSpace< ScalarType > >
__host__ __device__ ManyBodyOperatorSpaceBase (BaseSpace const &baseSpace, int systemSize, LocalSpace const &locSpace)
 Construct a ManyBodyOperatorSpaceBase object by copying.
 
__host__ __device__ ManyBodyOperatorSpaceBase (BaseSpace &&baseSpace, int systemSize, LocalSpace &&locSpace)
 Construct a ManyBodyOperatorSpaceBase object by moving.
 
__host__ __device__ ManyBodyOperatorSpaceBase ()=default
 Default constructor.
 
__host__ __device__ ManyBodyOperatorSpaceBase (ManyBodyOperatorSpaceBase const &other)=default
 Copy constructor.
 
__host__ __device__ ManyBodyOperatorSpaceBase (ManyBodyOperatorSpaceBase &&other)=default
 Move constructor.
 
__host__ __device__ ~ManyBodyOperatorSpaceBase ()=default
 Destructor.
 
__host__ __device__ ManyBodyOperatorSpaceBaseoperator= (ManyBodyOperatorSpaceBase const &other)=default
 Copy assignment operator.
 
__host__ __device__ ManyBodyOperatorSpaceBaseoperator= (ManyBodyOperatorSpaceBase &&other)=default
 Move assignment operator.
 
- Public Member Functions inherited from OperatorSpaceBase< Derived >
__host__ __device__ OperatorSpaceBase (BaseSpace const &baseSpace)
 Construct a OperatorSpaceBase object by copying a BaseSpace object.
 
__host__ __device__ OperatorSpaceBase (BaseSpace &&baseSpace)
 Construct a OperatorSpaceBase object by moving a BaseSpace object.
 
__host__ __device__ OperatorSpaceBase ()=default
 Default constructor.
 
__host__ __device__ OperatorSpaceBase (OperatorSpaceBase const &other)=default
 Copy constructor.
 
__host__ __device__ OperatorSpaceBase (OperatorSpaceBase &&other)=default
 Move constructor.
 
__host__ __device__ ~OperatorSpaceBase ()=default
 Destructor.
 
__host__ __device__ OperatorSpaceBaseoperator= (OperatorSpaceBase const &other)=default
 Copy assignment operator.
 
__host__ __device__ OperatorSpaceBaseoperator= (OperatorSpaceBase &&other)=default
 Move assignment operator.
 
__host__ __device__ int dim () const
 
__host__ __device__ BaseSpace const & baseSpace () const
 
__host__ __device__ int baseDim () const
 
template<typename RealType >
__host__ __device__ void action (int &resBasisNum, Complex_t< RealType > &coeff, int opNum, int basisNum) const
 
template<typename RealType , class EigenDerived >
__host__ __device__ void action (int &resBasisNum, Complex_t< RealType > &coeff, int opNum, int basisNum, Eigen::DenseBase< EigenDerived > &config) const
 
__host__ __device__ std::pair< int, Complex_t< Real > > action (int opNum, int basisNum) const
 
__host__ void basisOp (Eigen::SparseMatrix< ScalarType > &res, int opNum) const
 
__host__ Eigen::SparseMatrix< ScalarTypebasisOp (int opNum) const
 
- Public Member Functions inherited from ManyBodySpaceBase< Derived >
__host__ __device__ ManyBodySpaceBase (int systemSize, LocSpace_t const &locSpace)
 Constructor1.
 
__host__ __device__ ManyBodySpaceBase (int systemSize, LocSpace_t &&locSpace)
 Constructor2.
 
template<typename... Args>
__host__ __device__ ManyBodySpaceBase (int systemSize, Args... args)
 Constructor3.
 
__host__ __device__ ManyBodySpaceBase ()=default
 Default constructor.
 
__host__ __device__ ManyBodySpaceBase (ManyBodySpaceBase const &other)
 Copy constructor.
 
__host__ __device__ ManyBodySpaceBase (ManyBodySpaceBase &&other)
 Move constructor.
 
__host__ __device__ ~ManyBodySpaceBase ()=default
 Destructor.
 
__host__ __device__ ManyBodySpaceBaseoperator= (ManyBodySpaceBase const &other)=delete
 Copy assignment operator (deleted)
 
__host__ __device__ Derived & operator= (ManyBodySpaceBase &&other)
 Move assignment operator.
 
__host__ __device__ bool operator== (ManyBodySpaceBase const &other) const
 Equality operator.
 
__host__ __device__ LocSpace_t const & locSpace () const
 
__host__ __device__ int sysSize () const
 
__host__ __device__ int dimLoc () const
 
__host__ __device__ int locState (int state, int pos) const
 
__host__ Derived const & printInString (int basisNum) const
 Print a basis state specified by the input (basisNum) in a string of integers.
 
__host__ __device__ Eigen::RowVectorXi ordinalToConfig (int basisNum) const
 
template<class EigenDerived >
__host__ __device__ int configToOrdinal (Eigen::DenseBase< EigenDerived > &config) const
 
__host__ __device__ int reverse (int state) const
 Reverse the input state.
 
__host__ __device__ Vector_t const & parityPair () const
 
__host__ __device__ int parityPair (int state) const
 
__host__ __device__ void computeParityPair () const
 
__host__ __device__ int translate (int state, int trans) const
 Translate the input state to the left by one.
 
template<class EigenDerived >
__host__ __device__ int translate (int state, int trans, Eigen::DenseBase< EigenDerived > &work) const
 
__host__ __device__ int transEqDim () const
 
__host__ __device__ Vector_t const & transEqClassRep () const
 
__host__ __device__ int transEqClassRep (int id) const
 
__host__ __device__ int transEqClassRep (int id, int trans) const
 
__host__ __device__ Vector_t const & transPeriod () const
 
__host__ __device__ int transPeriod (int id) const
 
__host__ __device__ Vector_t const & stateToTransEqClass () const
 
__host__ __device__ int stateToTransEqClass (int state) const
 
__host__ __device__ int stateToTransPeriod (int state) const
 
__host__ __device__ void computeTransEqClass () const
 
- Public Member Functions inherited from HilbertSpace< Derived >
__host__ __device__ int dim () const
 
__host__ __device__ bool operator== (HilbertSpace const &other) const
 

Private Types

template<class T >
using Vector_t = Eigen::VectorX< T >
 
template<class T >
using Array_t = Eigen::ArrayX< T >
 

Private Attributes

int m_mBody = 0
 
int m_opConfDim = 0
 
IntegerComposition m_ActingSites
 
BaseConverter< int > m_opConfig
 
Array_t< Array_t< int > > m_config
 

Operator overloads

friend HilbertSpace< mBodyOperatorSpace >
 
friend OperatorSpaceBase< mBodyOperatorSpace >
 
friend ManyBodySpaceBase< mBodyOperatorSpace >
 
__host__ __device__ mBodyOperatorSpaceoperator= (mBodyOperatorSpace const &other)=default
 Copy assignment operator.
 
__host__ __device__ mBodyOperatorSpaceoperator= (mBodyOperatorSpace &&other)=default
 Move assignment operator.
 
__host__ __device__ int m () const
 
__host__ __device__ int dim_impl () const
 
template<typename RealType >
__host__ __device__ void action_impl (int &resBasisNum, Complex_t< RealType > &coeff, int opOrdinal, int basisNum) const
 
template<typename RealType , class Derived >
__host__ __device__ void action_impl (int &resBasisNum, Complex_t< RealType > &coeff, int opOrdinal, int basisNum, Eigen::DenseBase< Derived > &config) const
 
__host__ __device__ int locState_impl (int opOrdinal, int pos) const
 
__host__ __device__ int translate_impl (int opOrdinal, int trans) const
 
template<class EigenDerived >
__host__ __device__ int translate_impl (int opOrdinal, int trans, Eigen::DenseBase< EigenDerived > &workSpace) const
 
__host__ __device__ Eigen::RowVectorXi ordinalToConfig_impl (int basisNum) const
 
template<class EigenDerived >
__host__ __device__ int configToOrdinal_impl (Eigen::DenseBase< EigenDerived > &config) const
 

Additional Inherited Members

- Protected Types inherited from ManyBodySpaceBase< Derived >
using Vector_t = Eigen::VectorX< int >
 
- Protected Attributes inherited from ManyBodySpaceBase< Derived >
int m_systemSize = 0
 
LocSpace_t m_locSpace
 
int m_transEqDim = -1
 
Vector_t m_transEqClassRep
 
Vector_t m_transPeriod
 
Vector_t m_stateToTransEqClass
 
Vector_t m_parityPair
 

Member Typedef Documentation

◆ Array_t

template<typename ScalarType >
template<class T >
using mBodyOperatorSpace< ScalarType >::Array_t = Eigen::ArrayX<T>
private

◆ Base

◆ BaseSpace

template<typename ScalarType >
using mBodyOperatorSpace< ScalarType >::BaseSpace = typename HilbertSpaceTraits< mBodyOperatorSpace<ScalarType> >::BaseSpace

◆ LocalSpace

template<typename ScalarType >
using mBodyOperatorSpace< ScalarType >::LocalSpace = typename HilbertSpaceTraits< mBodyOperatorSpace<ScalarType> >::LocalSpace

◆ Scalar

◆ Vector_t

template<typename ScalarType >
template<class T >
using mBodyOperatorSpace< ScalarType >::Vector_t = Eigen::VectorX<T>
private

Constructor & Destructor Documentation

◆ mBodyOperatorSpace() [1/5]

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace< ScalarType >::mBodyOperatorSpace ( int  m,
BaseSpace const &  baseSpace 
)
inline

Construct an mBodyOperatorSpace object by copying a BaseSpace object.

459 m_mBody{m},
460 m_opConfDim(powi(baseSpace.dimLoc() * baseSpace.dimLoc() - 1, m)),
461 m_ActingSites(m, baseSpace.sysSize(), 1),
462 m_opConfig(baseSpace.dimLoc() * baseSpace.dimLoc() - 1, m) {
463 debug_constructor_printf(1);
464#ifndef __CUDA_ARCH__
465 if(m > baseSpace.sysSize()) {
466 std::cerr << "ERROR: " << __PRETTY_FUNCTION__
467 << "\nMessage:\t m(" << m << ") > "
468 << "baseSpace.sysSize()(" << baseSpace.sysSize() << ")" << std::endl;
469 std::exit(EXIT_FAILURE);
470 }
471 m_config.resize(get_max_threads());
472 for(int j = 0; j != get_max_threads(); ++j) m_config[j].resize(this->sysSize());
473#endif
474 };
__host__ __device__ int sysSize() const
Definition HilbertSpace.hpp:265
__host__ __device__ BaseSpace const & baseSpace() const
Definition OperatorSpace.hpp:79
Definition OperatorSpace.hpp:132
ManyBodyOperatorSpaceBase< mBodyOperatorSpace< ScalarType > > Base
Definition OperatorSpace.hpp:447
int m_opConfDim
Definition OperatorSpace.hpp:438
BaseConverter< int > m_opConfig
Definition OperatorSpace.hpp:440
__host__ __device__ int m() const
Definition OperatorSpace.hpp:522
Array_t< Array_t< int > > m_config
Definition OperatorSpace.hpp:442
IntegerComposition m_ActingSites
Definition OperatorSpace.hpp:439
int m_mBody
Definition OperatorSpace.hpp:437

◆ mBodyOperatorSpace() [2/5]

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace< ScalarType >::mBodyOperatorSpace ( int  m,
int  sysSize,
int  dimLoc 
)
inline

Construct an mBodyOperatorSpace object by copying a BaseSpace object.

481 debug_constructor_printf(2);
482 };
__host__ __device__ int dimLoc() const
Definition HilbertSpace.hpp:266
typename HilbertSpaceTraits< mBodyOperatorSpace< ScalarType > >::BaseSpace BaseSpace
Definition OperatorSpace.hpp:448
__host__ __device__ mBodyOperatorSpace()=default
Default constructor.

◆ mBodyOperatorSpace() [3/5]

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace< ScalarType >::mBodyOperatorSpace ( )
default

Default constructor.

◆ mBodyOperatorSpace() [4/5]

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace< ScalarType >::mBodyOperatorSpace ( mBodyOperatorSpace< ScalarType > const &  other)
default

Copy constructor.

◆ mBodyOperatorSpace() [5/5]

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace< ScalarType >::mBodyOperatorSpace ( mBodyOperatorSpace< ScalarType > &&  other)
default

Move constructor.

◆ ~mBodyOperatorSpace()

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace< ScalarType >::~mBodyOperatorSpace ( )
default

Destructor.

Member Function Documentation

◆ action_impl() [1/2]

template<typename ScalarType >
template<typename RealType >
__host__ __device__ void mBodyOperatorSpace< ScalarType >::action_impl ( int &  resBasisNum,
Complex_t< RealType > &  coeff,
int  opOrdinal,
int  basisNum 
) const
inlineprivate
531 {
532#ifndef __CUDA_ARCH__
533 action_impl(resBasisNum, coeff, opOrdinal, basisNum, m_config[get_thread_num()]);
534#else
535 Eigen::ArrayXi config(this->sysSize());
536 action_impl(resBasisNum, coeff, opOrdinal, basisNum, config);
537#endif
538 };
__host__ __device__ void action_impl(int &resBasisNum, Complex_t< RealType > &coeff, int opOrdinal, int basisNum) const
Definition OperatorSpace.hpp:530

◆ action_impl() [2/2]

template<typename ScalarType >
template<typename RealType , class Derived >
__host__ __device__ void mBodyOperatorSpace< ScalarType >::action_impl ( int &  resBasisNum,
Complex_t< RealType > &  coeff,
int  opOrdinal,
int  basisNum,
Eigen::DenseBase< Derived > &  config 
) const
private
577 {
578// debug_print(__PRETTY_FUNCTION__);
579#ifndef NDEBUG
580 if(workSpace.size() < this->sysSize())
581 debug_printf("%s\n\tworkSpace.size()=%d\n", __PRETTY_FUNCTION__, (int)workSpace.size());
582#endif
583 assert(workSpace.size() >= this->sysSize());
584 resBasisNum = basisNum;
585 coeff = {1.0, 0};
586 int resLocBasisNum;
587 Complex_t<RealType> resLocCoeff;
588
589 int posConfNum = opOrdinal / m_opConfDim;
590 int opConfNum = opOrdinal % m_opConfDim;
591 this->m_ActingSites.ordinalToPart(workSpace, posConfNum);
592 int locOpNum, locBasisNum;
593
594 int index = 0;
595 int base = 1;
596 for(int pos = 0; pos != this->sysSize(); ++pos, base *= this->baseSpace().dimLoc()) {
597 locBasisNum = this->baseSpace().locState(basisNum, pos);
598 if(workSpace[pos] == 0) {
599 this->locSpace().action(resLocBasisNum, resLocCoeff, 0, locBasisNum);
600 coeff *= resLocCoeff;
601 continue;
602 }
603 locOpNum = 1 + this->m_opConfig.digit(opConfNum, index++);
604#ifndef NDEBUG
605 if(locOpNum >= 4) {
606 printf("Error: mBodyOperatorSpace::%s Out of bounds locOpNum = %d\n\n", __func__,
607 locOpNum);
608 #ifndef __CUDA_ARCH__
609 std::cout << "locOpNum = " << locOpNum << std::endl;
610 this->m_opConfig.status();
611 std::exit(EXIT_FAILURE);
612 #endif
613 }
614#endif
615
616 this->locSpace().action(resLocBasisNum, resLocCoeff, locOpNum, locBasisNum);
617 if(abs(resLocCoeff) < 1.0e-8) {
618 coeff = {0, 0};
619 return;
620 }
621 coeff *= resLocCoeff;
622 resBasisNum += (resLocBasisNum - locBasisNum) * base;
623 }
624 return;
625}
__host__ __device__ Integer digit(Integer const num, Integer const pos, Integer const base, Integer const length) const
Returns the (pos)-th digit of the input (num) in given base and length.
Definition BaseNnumber.hpp:113
__host__ void status(void) const
Show the status of the instance.
Definition BaseNnumber.hpp:47
Definition mytypes.hpp:147
__host__ __device__ void ordinalToPart(Vector_t &vec, Index_t const num) const
Converts an ordinal number of a composition of the integer N to a vector form.
Definition IntegerComposition.hpp:225
__host__ __device__ LocSpace_t const & locSpace() const
Definition HilbertSpace.hpp:264

◆ configToOrdinal_impl()

template<typename ScalarType >
template<class EigenDerived >
__host__ __device__ int mBodyOperatorSpace< ScalarType >::configToOrdinal_impl ( Eigen::DenseBase< EigenDerived > &  config) const
private

◆ dim_impl()

template<typename ScalarType >
__host__ __device__ int mBodyOperatorSpace< ScalarType >::dim_impl ( ) const
inlineprivate
526{ return m_ActingSites.dim() * m_opConfDim; }
__host__ __device__ Index_t dim() const
Definition IntegerComposition.hpp:90

◆ locState_impl()

template<typename ScalarType >
__host__ __device__ int mBodyOperatorSpace< ScalarType >::locState_impl ( int  opOrdinal,
int  pos 
) const
inlineprivate
546 {
547 int posConfNum = opOrdinal / m_opConfDim;
548 if(this->m_ActingSites.locNumber(posConfNum, pos) == 0)
549 return 0;
550 else {
551 int index = -1;
552 for(int l = 0; l <= (pos % this->m_systemSize); ++l) {
553 index += this->m_ActingSites.locNumber(posConfNum, l);
554 }
555 int opConfNum = opOrdinal % m_opConfDim;
556 return this->m_opConfig.digit(opConfNum, index) + 1;
557 }
558 }
__host__ __device__ int locNumber(Index_ const num, Index_ const pos) const
Definition IntegerComposition.hpp:253
int m_systemSize
Definition HilbertSpace.hpp:141

◆ m()

template<typename ScalarType >
__host__ __device__ int mBodyOperatorSpace< ScalarType >::m ( ) const
inline
522{ return m_mBody; }

◆ operator=() [1/2]

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace & mBodyOperatorSpace< ScalarType >::operator= ( mBodyOperatorSpace< ScalarType > &&  other)
default

Move assignment operator.

Parameters
other

◆ operator=() [2/2]

template<typename ScalarType >
__host__ __device__ mBodyOperatorSpace & mBodyOperatorSpace< ScalarType >::operator= ( mBodyOperatorSpace< ScalarType > const &  other)
default

Copy assignment operator.

Parameters
other

◆ ordinalToConfig_impl()

template<typename ScalarType >
__host__ __device__ Eigen::RowVectorXi mBodyOperatorSpace< ScalarType >::ordinalToConfig_impl ( int  basisNum) const
private
653 {
654 int posConfNum = basisNum / m_opConfDim;
655 int opConfNum = basisNum % m_opConfDim;
656
657 Eigen::RowVectorXi config(this->sysSize());
658 this->m_ActingSites.ordinalToPart(config, posConfNum);
659
660 int index = 0;
661 for(int pos = 0; pos != this->sysSize(); ++pos) {
662 if(config[pos] == 0) continue;
663 config[pos] = 1 + this->m_opConfig.digit(opConfNum, index++);
664 }
665 return config;
666}

◆ translate_impl() [1/2]

template<typename ScalarType >
__host__ __device__ int mBodyOperatorSpace< ScalarType >::translate_impl ( int  opOrdinal,
int  trans 
) const
inlineprivate
560 {
561 Eigen::ArrayXi work(this->sysSize());
562 return this->translate(opOrdinal, trans, work);
563 };
__host__ __device__ int translate(int state, int trans) const
Translate the input state to the left by one.
Definition HilbertSpace.hpp:300

◆ translate_impl() [2/2]

template<typename ScalarType >
template<class EigenDerived >
__host__ __device__ int mBodyOperatorSpace< ScalarType >::translate_impl ( int  opOrdinal,
int  trans,
Eigen::DenseBase< EigenDerived > &  workSpace 
) const
private
630 {
631 int posConfNum = opOrdinal / m_opConfDim;
632 int opConfNum = opOrdinal % m_opConfDim;
633#ifndef __CUDA_ARCH__
634 workSpace.resize(this->sysSize());
635#else
636 assert(workSpace.size() >= this->sysSize());
637#endif
638#ifndef NDEBUG
639 if(workSpace.size() < this->sysSize())
640 debug_printf("%s\n\tworkSpace.size()=%d\n", __PRETTY_FUNCTION__, (int)workSpace.size());
641#endif
642 m_ActingSites.ordinalToPart(workSpace, posConfNum);
643 int opTrans = 0;
644 for(int l = 0; l != trans; ++l) opTrans += workSpace[l];
645
646 posConfNum = m_ActingSites.translate(posConfNum, trans, workSpace);
647 opConfNum = this->m_opConfig.shiftDigits(opConfNum, opTrans);
648 return opConfNum + posConfNum * m_opConfDim;
649}
__host__ __device__ Integer shiftDigits(Integer const num, Integer const trans, Integer const base, Integer const length) const
Shifts a number (num) to right by (trans) in terms of the positional notation with given base and len...
Definition BaseNnumber.hpp:139
__host__ __device__ Index_t translate(Index_t const num, int trans, Vector_t &workSpace) const
Definition IntegerComposition.hpp:283

Member Data Documentation

◆ HilbertSpace< mBodyOperatorSpace >

◆ m_ActingSites

template<typename ScalarType >
IntegerComposition mBodyOperatorSpace< ScalarType >::m_ActingSites
private

◆ m_config

template<typename ScalarType >
Array_t< Array_t<int> > mBodyOperatorSpace< ScalarType >::m_config
mutableprivate

◆ m_mBody

template<typename ScalarType >
int mBodyOperatorSpace< ScalarType >::m_mBody = 0
private

◆ m_opConfDim

template<typename ScalarType >
int mBodyOperatorSpace< ScalarType >::m_opConfDim = 0
private

◆ m_opConfig

template<typename ScalarType >
BaseConverter<int> mBodyOperatorSpace< ScalarType >::m_opConfig
private

◆ ManyBodySpaceBase< mBodyOperatorSpace >

◆ OperatorSpaceBase< mBodyOperatorSpace >


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