StatMech
Loading...
Searching...
No Matches
Ensemble::internal::ScalableOperator< MatrixType > Class Template Reference

#include <Ensemble.hpp>

Collaboration diagram for Ensemble::internal::ScalableOperator< MatrixType >:
Collaboration graph

Public Member Functions

 ScalableOperator (RandomMatrixGenerators &GRME, std::vector< bool > &isConstructed)
 
MatrixType construct_globalOp (size_t L)
 
 ScalableOperator (RandomMatrixGenerators &GRME, std::vector< bool > &isConstructed)
 
MatrixType construct_globalOp (size_t L)
 
 ScalableOperator (MatrixType &&locOp)
 
MatrixType construct_globalOp (size_t L)
 
 ScalableOperator (MatrixType &&locOp, size_t dimLoc)
 
MatrixType construct_globalOp (size_t L)
 
 ScalableOperator (MatrixType const &locOp, size_t dimLoc)
 
MatrixType construct_globalOp (size_t L)
 

Private Types

using Scalar = typename MatrixType::Scalar
 
using RandomMatrixGenerators = std::vector< GaussianRandomMatrixGenerator< OperatorSpace< Scalar > > >
 
using Scalar = typename MatrixType::Scalar
 
using RandomMatrixGenerators = std::vector< GaussianRandomMatrixGenerator< OperatorSpace< Scalar > > >
 
using Scalar = typename MatrixType::Scalar
 
using Scalar = typename MatrixType::Scalar
 
using Scalar = typename MatrixType::Scalar
 

Private Attributes

RandomMatrixGeneratorsm_GRME
 
std::vector< bool > & m_isConstructed
 
MatrixType m_locOp
 
size_t m_dimLoc
 
size_t m_Locality
 

Member Typedef Documentation

◆ RandomMatrixGenerators [1/2]

template<class MatrixType >
using Ensemble::internal::ScalableOperator< MatrixType >::RandomMatrixGenerators = std::vector< GaussianRandomMatrixGenerator<OperatorSpace<Scalar> > >
private

◆ RandomMatrixGenerators [2/2]

template<class MatrixType >
using Ensemble::internal::ScalableOperator< MatrixType >::RandomMatrixGenerators = std::vector< GaussianRandomMatrixGenerator<OperatorSpace<Scalar> > >
private

◆ Scalar [1/5]

template<class MatrixType >
using Ensemble::internal::ScalableOperator< MatrixType >::Scalar = typename MatrixType::Scalar
private

◆ Scalar [2/5]

template<class MatrixType >
using Ensemble::internal::ScalableOperator< MatrixType >::Scalar = typename MatrixType::Scalar
private

◆ Scalar [3/5]

template<class MatrixType >
using Ensemble::internal::ScalableOperator< MatrixType >::Scalar = typename MatrixType::Scalar
private

◆ Scalar [4/5]

template<class MatrixType >
using Ensemble::internal::ScalableOperator< MatrixType >::Scalar = typename MatrixType::Scalar
private

◆ Scalar [5/5]

template<class MatrixType >
using Ensemble::internal::ScalableOperator< MatrixType >::Scalar = typename MatrixType::Scalar
private

Constructor & Destructor Documentation

◆ ScalableOperator() [1/5]

template<class MatrixType >
Ensemble::internal::ScalableOperator< MatrixType >::ScalableOperator ( RandomMatrixGenerators GRME,
std::vector< bool > &  isConstructed 
)
inline
65 : m_GRME{GRME}, m_isConstructed{isConstructed} {}
std::vector< bool > & m_isConstructed
Definition Ensemble.cuh:61
RandomMatrixGenerators & m_GRME
Definition Ensemble.cuh:60

◆ ScalableOperator() [2/5]

template<class MatrixType >
Ensemble::internal::ScalableOperator< MatrixType >::ScalableOperator ( RandomMatrixGenerators GRME,
std::vector< bool > &  isConstructed 
)
inline
66 : m_GRME{GRME}, m_isConstructed{isConstructed} {}

◆ ScalableOperator() [3/5]

template<class MatrixType >
Ensemble::internal::ScalableOperator< MatrixType >::ScalableOperator ( MatrixType &&  locOp)
inline
42 : m_locOp{locOp} {
43 // Write codes here
44 }
MatrixType m_locOp
Definition Ensemble.template.hpp:39

◆ ScalableOperator() [4/5]

template<class MatrixType >
Ensemble::internal::ScalableOperator< MatrixType >::ScalableOperator ( MatrixType &&  locOp,
size_t  dimLoc 
)
inline
65 : m_locOp{locOp}, m_dimLoc{dimLoc} {
66 if(m_locOp.rows() != m_locOp.cols()) {
67 std::cerr << "Error at [" << __FILE__ << ":" << __LINE__ << "]\n\t"
68 << __PRETTY_FUNCTION__ << "\nMessage:\t locOp.rows()("
69 << m_locOp.rows() << ") != locOp.cols()(" << locOp.cols() << "): "
70 << "local operator must be a square matrix" << std::endl;
71 std::exit(EXIT_FAILURE);
72 }
73 size_t dim = m_locOp.rows();
74 for(m_Locality = 0; dim != 1; ++m_Locality) {
75 if(dim % dimLoc != 0) {
76 std::cerr << "Error at [" << __FILE__ << ":" << __LINE__ << "]\n\t"
77 << __PRETTY_FUNCTION__ << "\nMessage:\t locOp.rows()("
78 << m_locOp.rows() << ") must be a power of dimLoc(" << dimLoc
79 << ")" << std::endl;
80 std::exit(EXIT_FAILURE);
81 }
82 dim /= dimLoc;
83 }
84 }
size_t m_Locality
Definition Ensemble.hpp:62
size_t m_dimLoc
Definition Ensemble.hpp:61

◆ ScalableOperator() [5/5]

template<class MatrixType >
Ensemble::internal::ScalableOperator< MatrixType >::ScalableOperator ( MatrixType const &  locOp,
size_t  dimLoc 
)
inline
66 : m_locOp{locOp}, m_dimLoc{dimLoc} {
67 if(m_locOp.rows() != m_locOp.cols()) {
68 std::cerr << "Error at [" << __FILE__ << ":" << __LINE__ << "]\n\t"
69 << __PRETTY_FUNCTION__ << "\nMessage:\t locOp.rows()("
70 << m_locOp.rows() << ") != locOp.cols()(" << locOp.cols() << "): "
71 << "local operator must be a square matrix" << std::endl;
72 std::exit(EXIT_FAILURE);
73 }
74 size_t dim = m_locOp.rows();
75 for(m_Locality = 0; dim != 1; ++m_Locality) {
76 if(dim % dimLoc != 0) {
77 std::cerr << "Error at [" << __FILE__ << ":" << __LINE__ << "]\n\t"
78 << __PRETTY_FUNCTION__ << "\nMessage:\t locOp.rows()("
79 << m_locOp.rows() << ") must be a power of dimLoc(" << dimLoc
80 << ")" << std::endl;
81 std::exit(EXIT_FAILURE);
82 }
83 dim /= dimLoc;
84 }
85 }

Member Function Documentation

◆ construct_globalOp() [1/5]

template<class MatrixType >
MatrixType Ensemble::internal::ScalableOperator< MatrixType >::construct_globalOp ( size_t  L)
inline
67 {
68 auto currentSize = m_GRME.size();
69 if(m_isConstructed.size() < L || !m_isConstructed[L]) {
70 m_GRME.resize(L + 1);
71 m_isConstructed.resize(L + 1, false);
73 auto dim = subSpaces[L].dim();
74 auto HSpace = HilbertSpace<int>(dim);
75 auto OpSpace = OperatorSpace<Scalar>(HSpace);
77 m_isConstructed[L] = true;
78 }
79 return MatrixType(m_GRME[L]());
80 };
Definition RandomMatrix.hpp:9
Definition HilbertSpace.hpp:32
Definition OperatorSpace.hpp:132
Definition Ensemble.cuh:17
static SubSpaceManager & get_instance()
Definition Ensemble.cuh:32

◆ construct_globalOp() [2/5]

template<class MatrixType >
MatrixType Ensemble::internal::ScalableOperator< MatrixType >::construct_globalOp ( size_t  L)
inline
68 {
69 auto currentSize = m_GRME.size();
70 if(m_isConstructed.size() < L || !m_isConstructed[L]) {
71 m_GRME.resize(L + 1);
72 m_isConstructed.resize(L + 1, false);
74 auto dim = subSpaces[L].dim();
75 auto HSpace = HilbertSpace<int>(dim);
76 auto OpSpace = OperatorSpace<Scalar>(HSpace);
78 m_isConstructed[L] = true;
79 }
80 return m_GRME[L]();
81 };

◆ construct_globalOp() [3/5]

template<class MatrixType >
MatrixType Ensemble::internal::ScalableOperator< MatrixType >::construct_globalOp ( size_t  L)
inline
46 {
47 MatrixType res;
48 // Write codes here
49 return res;
50 };

◆ construct_globalOp() [4/5]

template<class MatrixType >
MatrixType Ensemble::internal::ScalableOperator< MatrixType >::construct_globalOp ( size_t  L)
inline
86 {
87 if(L < m_Locality) {
88 std::cerr << "Error at [" << __FILE__ << ":" << __LINE__ << "]\n\t"
89 << __PRETTY_FUNCTION__ << "\n\t L(" << L
90 << ") must not be smaller than m_Locality(" << m_Locality << ")."
91 << std::endl;
92 std::exit(EXIT_FAILURE);
93 }
94
95 size_t dimCompl = 1;
96 for(int j = 0; j < L - m_Locality; ++j) { dimCompl *= g_dimLoc; }
97
98 auto Identity = MatrixType::Identity(dimCompl, dimCompl);
100 auto& subSpaceBase = subSpaces[L].basis();
101 MatrixType res = subSpaceBase.adjoint() * Eigen::kroneckerProduct(Identity, m_locOp)
102 * subSpaceBase;
103 return res;
104 };
int g_dimLoc
Definition Ensemble.cuh:11

◆ construct_globalOp() [5/5]

template<class MatrixType >
MatrixType Ensemble::internal::ScalableOperator< MatrixType >::construct_globalOp ( size_t  L)
inline
87 {
88 if(L < m_Locality) {
89 std::cerr << "Error at [" << __FILE__ << ":" << __LINE__ << "]\n\t"
90 << __PRETTY_FUNCTION__ << "\n\t L(" << L
91 << ") must not be smaller than m_Locality(" << m_Locality << ")."
92 << std::endl;
93 std::exit(EXIT_FAILURE);
94 }
95
96 size_t dimCompl = 1;
97 for(int j = 0; j < L - m_Locality; ++j) { dimCompl *= g_dimLoc; }
98
99 auto Identity = MatrixType::Identity(dimCompl, dimCompl);
101 auto& subSpaceBase = subSpaces[L].basis();
102 MatrixType res = subSpaceBase.adjoint() * Eigen::kroneckerProduct(Identity, m_locOp)
103 * subSpaceBase;
104 return res;
105 };

Member Data Documentation

◆ m_dimLoc

template<class MatrixType >
size_t ScalableOperator< MatrixType >::m_dimLoc
private

◆ m_GRME

template<class MatrixType >
RandomMatrixGenerators & ScalableOperator< MatrixType >::m_GRME
private

◆ m_isConstructed

template<class MatrixType >
std::vector< bool > & ScalableOperator< MatrixType >::m_isConstructed
private

◆ m_Locality

template<class MatrixType >
size_t ScalableOperator< MatrixType >::m_Locality
private

◆ m_locOp

template<class MatrixType >
MatrixType ScalableOperator< MatrixType >::m_locOp
private

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