StatMech
Loading...
Searching...
No Matches
OperatorSpace.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#define _USE_MATH_DEFINES
5#include "Headers/mytypes.hpp"
6#include "Headers/mydebug.hpp"
9#include <cmath>
10
11template<class Derived>
13 private:
17
18 public:
19 typedef typename Eigen::NumTraits<ScalarType>::Real Real;
20
27 debug_constructor_printf(1(Custom Copy));
28 }
34 __host__ __device__ OperatorSpaceBase(BaseSpace&& baseSpace)
35 : m_baseSpace{std::move(baseSpace)} {
36 debug_constructor_printf(2(Custom Move));
37 }
42 __host__ __device__ OperatorSpaceBase() = default;
47 __host__ __device__ OperatorSpaceBase(OperatorSpaceBase const& other) = default;
52 __host__ __device__ OperatorSpaceBase(OperatorSpaceBase&& other) = default;
57 __host__ __device__ ~OperatorSpaceBase() = default;
58
60 /* @{ */
66 __host__ __device__ OperatorSpaceBase& operator=(OperatorSpaceBase const& other) = default;
72 __host__ __device__ OperatorSpaceBase& operator=(OperatorSpaceBase&& other) = default;
73 /* @} */
74
75 __host__ __device__ int dim() const {
76 return static_cast<Derived const*>(this)->dim_impl();
77 }
78
79 __host__ __device__ BaseSpace const& baseSpace() const { return m_baseSpace; }
80 __host__ __device__ int baseDim() const { return m_baseSpace.dim(); }
81
82 template<typename RealType>
83 __host__ __device__ void action(int& resBasisNum, Complex_t<RealType>& coeff, int opNum,
84 int basisNum) const {
85 static_cast<Derived const*>(this)->action_impl(resBasisNum, coeff, opNum, basisNum);
86 };
87
88 template<typename RealType, class EigenDerived>
89 __host__ __device__ void action(int& resBasisNum, Complex_t<RealType>& coeff, int opNum,
90 int basisNum,
91 Eigen::DenseBase<EigenDerived>& config) const {
92 static_cast<Derived const*>(this)->action_impl(resBasisNum, coeff, opNum, basisNum,
93 config);
94 };
95
96 __host__ __device__ std::pair<int, Complex_t<Real>> action(int opNum, int basisNum) const {
97 // debug_print(__PRETTY_FUNCTION__);
98 int resBasisNum;
99 Complex_t<Real> coeff;
100 this->action(resBasisNum, coeff, opNum, basisNum);
101 return std::make_pair(resBasisNum, coeff);
102 }
103
104 __host__ void basisOp(Eigen::SparseMatrix<ScalarType>& res, int opNum) const {
105 res.resize(this->baseDim(), this->baseDim());
106#pragma omp parallel for
107 for(int basisNum = 0; basisNum < this->baseDim(); basisNum++) {
108 auto [resBasisNum, coeff] = this->action(opNum, basisNum);
109 res.coeffRef(resBasisNum, basisNum) = coeff;
110 };
111 }
112
113 __host__ Eigen::SparseMatrix<ScalarType> basisOp(int opNum) const {
114 Eigen::SparseMatrix<ScalarType> res(this->baseDim(), this->baseDim());
115 for(int basisNum = 0; basisNum < this->baseDim(); basisNum++) {
116 // debug_print("\t basisNum=" << basisNum);
117 auto [resBasisNum, coeff] = this->action(opNum, basisNum);
118 res.insert(resBasisNum, basisNum) = coeff;
119 }
120 return res;
121 }
122};
123
124template<typename ScalarType>
125class OperatorSpace;
126template<typename ScalarType>
127struct HilbertSpaceTraits< OperatorSpace<ScalarType> > {
129 using Scalar = ScalarType;
130};
131template<typename ScalarType = Complex_t<Real_t>>
132class OperatorSpace : public OperatorSpaceBase< OperatorSpace<ScalarType> > {
133 public:
137
138 private:
140 __host__ __device__ int dim_impl() const {
141 return this->baseSpace().dim() * this->baseSpace().dim();
142 }
143
145 template<typename RealType>
146 __host__ __device__ void action_impl(int& resBasisNum, Complex_t<RealType>& coeff,
147 int opNum, int basisNum) const {
148 // debug_printf("%s\n", __PRETTY_FUNCTION__);
149 resBasisNum = basisNum;
150 coeff = {0.0, 0.0};
151 int Digit1, Digit2;
152
153 if(opNum < this->baseSpace().dim()) {
155 resBasisNum = basisNum;
156 if(opNum == 0) { coeff = 1.0 / RealType(sqrt(RealType(this->baseSpace().dim()))); }
157 else if(opNum == 1 && this->baseSpace().dim() % 2 == 0) {
158 coeff = (basisNum % 2 == 0 ? 1.0 : -1.0)
159 / RealType(sqrt(RealType(this->baseSpace().dim())));
160 }
161 else {
162 coeff = sin(M_PI
163 * (2 * (opNum / 2) * basisNum / RealType(this->baseSpace().dim())
164 + (opNum % 2) / 2.0))
165 / RealType(sqrt(RealType(this->baseSpace().dim()) / 2.0));
166 ;
167 }
168 }
169 else if(opNum < this->baseSpace().dim() * (this->baseSpace().dim() + 1) / 2) {
171 opNum -= this->baseSpace().dim();
172 Digit1 = int(sqrt(RealType(2 * opNum) + 0.25) + 0.5);
173 Digit2 = opNum - Digit1 * (Digit1 - 1) / 2;
174 if(Digit1 == basisNum) {
175 resBasisNum = Digit2;
176 coeff = Complex_t<RealType>(1.0 / sqrt(RealType(2)), 0.0);
177 }
178 else if(Digit2 == basisNum) {
179 resBasisNum = Digit1;
180 coeff = Complex_t<RealType>(1.0 / sqrt(RealType(2)), 0.0);
181 }
182 }
183 else if(opNum < this->baseSpace().dim() * this->baseSpace().dim()) {
185 opNum -= this->baseSpace().dim() * (this->baseSpace().dim() + 1) / 2;
186 Digit1 = int(sqrt(RealType(2 * opNum) + 0.25) + 0.5);
187 Digit2 = opNum - Digit1 * (Digit1 - 1) / 2;
188 if(Digit1 == basisNum) {
189 resBasisNum = Digit2;
190 coeff = Complex_t<RealType>(0.0, -1.0 / sqrt(RealType(2)));
191 }
192 else if(Digit2 == basisNum) {
193 resBasisNum = Digit1;
194 coeff = Complex_t<RealType>(0.0, +1.0 / sqrt(RealType(2)));
195 }
196 }
197 else {
198 // clang-format off
199 #ifndef __CUDA_ARCH__
200 std::cerr << "Error: " << __PRETTY_FUNCTION__ << "\n\t"
201 << " opNum(" << opNum << ") must be less than "
202 << this->baseSpace().dim() * this->baseSpace().dim() << std::endl;
203 std::exit(EXIT_FAILURE);
204 #endif
205 // clang-format on
206 }
207 return;
208 };
209};
210
211template<class Derived>
213 public ManyBodySpaceBase<Derived> {
214 public:
215 using ManyBodySpaceBase<Derived>::dim;
218
224 __host__ __device__ ManyBodyOperatorSpaceBase(BaseSpace const& baseSpace, int systemSize,
225 LocalSpace const& locSpace)
226 : OperatorSpaceBase<Derived>(baseSpace),
227 ManyBodySpaceBase<Derived>(systemSize, locSpace) {
228 debug_constructor_printf(1(Custom Copy));
229 }
235 __host__ __device__ ManyBodyOperatorSpaceBase(BaseSpace&& baseSpace, int systemSize,
237 : OperatorSpaceBase<Derived>(std::move(baseSpace)),
238 ManyBodySpaceBase<Derived>(systemSize, std::move(locSpace)) {
239 debug_constructor_printf(2(Custom Move));
240 }
241
246 __host__ __device__ ManyBodyOperatorSpaceBase() = default;
251 __host__ __device__ ManyBodyOperatorSpaceBase(ManyBodyOperatorSpaceBase const& other) = default;
256 __host__ __device__ ManyBodyOperatorSpaceBase(ManyBodyOperatorSpaceBase&& other) = default;
261 __host__ __device__ ~ManyBodyOperatorSpaceBase() = default;
262
264 /* @{ */
270 __host__ __device__ ManyBodyOperatorSpaceBase& operator=(ManyBodyOperatorSpaceBase const& other) = default;
276 __host__ __device__ ManyBodyOperatorSpaceBase& operator=(ManyBodyOperatorSpaceBase&& other) = default;
277 /* @} */
278};
279
280template<typename ScalarType = Complex_t<Real_t>>
282template<typename ScalarType>
286 using Scalar = ScalarType;
287};
288template<typename ScalarType>
290 : public ManyBodyOperatorSpaceBase< ManyBodyOperatorSpace<ScalarType> > {
291 private:
293
294 public:
297 using BaseSpace =
301
307 __host__ __device__ ManyBodyOperatorSpace(BaseSpace const& baseSpace)
310 debug_constructor_printf(1(Custom Copy));
311 }
318 : Base(std::move(baseSpace), baseSpace.sysSize(),
321 debug_constructor_printf(2(Custom Move));
322 }
327 __host__ __device__ ManyBodyOperatorSpace() = default;
332 __host__ __device__ ManyBodyOperatorSpace(ManyBodyOperatorSpace const& other) = default;
337 __host__ __device__ ManyBodyOperatorSpace(ManyBodyOperatorSpace&& other) = default;
342 __host__ __device__ ~ManyBodyOperatorSpace() = default;
343
345 /* @{ */
351 __host__ __device__ ManyBodyOperatorSpace& operator=(ManyBodyOperatorSpace const& other) = default;
357 __host__ __device__ ManyBodyOperatorSpace& operator=(ManyBodyOperatorSpace&& other) = default;
358 /* @} */
359
360 private:
362 __host__ __device__ int dim_impl() const {
363 return this->baseSpace().dim() * this->baseSpace().dim();
364 }
365
367 /* @{ */
369 template<typename RealType>
370 __host__ __device__ void action_impl(int& resBasisNum, Complex_t<RealType>& coeff,
371 int opNum, int basisNum) const {
372 // debug_print(__func__ << " at Class:ManyBodyOperatorSpace");
373 resBasisNum = basisNum;
374 coeff = {1, 0};
375 int locOpNum, locBasisNum;
376 int base = 1;
377 for(int pos = 0; pos != this->sysSize(); ++pos, base *= this->baseSpace().dimLoc()) {
378 locOpNum = this->locState(opNum, pos);
379 locBasisNum = this->baseSpace().locState(basisNum, pos);
380 auto [resLocBasisNum, resLocCoeff] = this->locSpace().action(locOpNum, locBasisNum);
381 if(abs(resLocCoeff) == 0) {
382 coeff = 0;
383 resBasisNum = basisNum;
384 break;
385 }
386 coeff *= resLocCoeff;
387 resBasisNum += (resLocBasisNum - locBasisNum) * base;
388 }
389 }
390 /* @} */
391
393 /* @{ */
395 __host__ __device__ int locState_impl(int state, int pos) const {
396 return this->m_bConv.digit(state, pos);
397 }
398
399 __host__ __device__ Eigen::RowVectorXi ordinalToConfig_impl(int basisNum) const {
400 Eigen::RowVectorXi res;
401 m_bConv.printInDigits(res, basisNum);
402 return res;
403 }
404 template<class EigenDerived>
405 __host__ __device__ int configToOrdinal_impl(Eigen::DenseBase<EigenDerived>& config) const {
406 return m_bConv.digitsToNumber(config);
407 }
408
409 template<class EigenDerived>
410 __host__ __device__ int translate_impl(int state, int trans) const {
411 return this->m_bConv.shiftDigits(state, trans);
412 }
413 template<class EigenDerived>
414 __host__ __device__ int translate_impl(int state, int trans,
415 Eigen::DenseBase<EigenDerived>&) const {
416 return this->translate_impl(state, trans);
417 }
418 /* @} */
419};
420
421template<typename ScalarType = Complex_t<Real_t>>
423template<typename ScalarType>
427 using Scalar = ScalarType;
428};
429template<typename ScalarType>
430class mBodyOperatorSpace : public ManyBodyOperatorSpaceBase< mBodyOperatorSpace<ScalarType> > {
431 private:
432 template<class T>
433 using Vector_t = Eigen::VectorX<T>;
434 template<class T>
435 using Array_t = Eigen::ArrayX<T>;
436
437 int m_mBody = 0;
438 int m_opConfDim = 0;
441#ifndef __CUDA_ARCH__
443#endif
444
445 public:
452
457 __host__ __device__ mBodyOperatorSpace(int m, BaseSpace const& baseSpace)
459 m_mBody{m},
460 m_opConfDim(powi(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 };
479 __host__ __device__ mBodyOperatorSpace(int m, int sysSize, int dimLoc)
481 debug_constructor_printf(2);
482 };
487 __host__ __device__ mBodyOperatorSpace() = default;
492 __host__ __device__ mBodyOperatorSpace(mBodyOperatorSpace const& other) = default;
497 __host__ __device__ mBodyOperatorSpace(mBodyOperatorSpace&& other) = default;
502 __host__ __device__ ~mBodyOperatorSpace() = default;
503
505 /* @{ */
511 __host__ __device__ mBodyOperatorSpace& operator=(mBodyOperatorSpace const& other) = default;
517 __host__ __device__ mBodyOperatorSpace& operator=(mBodyOperatorSpace&& other) = default;
518 /* @} */
519
520
521
522 __host__ __device__ int m() const { return m_mBody; }
523
524 private:
526 __host__ __device__ int dim_impl() const { return m_ActingSites.dim() * m_opConfDim; }
527
529 template<typename RealType>
530 __host__ __device__ void action_impl(int& resBasisNum, Complex_t<RealType>& coeff,
531 int opOrdinal, int basisNum) const {
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 };
539
540 template<typename RealType, class Derived>
541 __host__ __device__ void action_impl(int& resBasisNum, Complex_t<RealType>& coeff,
542 int opOrdinal, int basisNum,
543 Eigen::DenseBase<Derived>& config) const;
544
546 __host__ __device__ int locState_impl(int opOrdinal, int pos) const {
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 }
559
560 __host__ __device__ int translate_impl(int opOrdinal, int trans) const {
561 Eigen::ArrayXi work(this->sysSize());
562 return this->translate(opOrdinal, trans, work);
563 };
564 template<class EigenDerived>
565 __host__ __device__ int translate_impl(int opOrdinal, int trans,
566 Eigen::DenseBase<EigenDerived>& workSpace) const;
567
568 __host__ __device__ Eigen::RowVectorXi ordinalToConfig_impl(int basisNum) const;
569 template<class EigenDerived>
570 __host__ __device__ int configToOrdinal_impl(Eigen::DenseBase<EigenDerived>& config) const;
571};
572
573template<typename ScalarType>
574template<typename RealType, class Derived>
576 int& resBasisNum, Complex_t<RealType>& coeff, int opOrdinal, int basisNum,
577 Eigen::DenseBase<Derived>& workSpace) const {
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}
626
627template<typename ScalarType>
628template<class EigenDerived>
630 int opOrdinal, int trans, Eigen::DenseBase<EigenDerived>& workSpace) const {
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}
650
651template<typename ScalarType>
652__host__ __device__ Eigen::RowVectorXi mBodyOperatorSpace<ScalarType>::ordinalToConfig_impl(
653 int basisNum) const {
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}
667
668#ifdef GPU
670#endif
Provides utilities for converting an integer to the corresponding expression in the positional notati...
Definition BaseNnumber.hpp:19
__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__ __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__ Integer digitsToNumber(Input const &digits, Integer const base, Integer const length) const
Converts an array of integers to the corresponding integer in terms of the positional notation with g...
Definition BaseNnumber.hpp:166
__host__ __device__ auto printInDigits(Output &output, Integer const num, Integer const base, Integer const length) const -> typename std::enable_if< std::is_integral< Output >::value==false, BaseConverter const & >::type
Expresses an integer (num) in the positional notation with given (base) and (length)
Definition BaseNnumber.hpp:191
Definition mytypes.hpp:147
Definition HilbertSpace.hpp:47
Definition HilbertSpace.hpp:32
Lists a weak composition of an integer N up to length L with a constraint that each summand does not ...
Definition IntegerComposition.hpp:57
__host__ __device__ int locNumber(Index_ const num, Index_ const pos) const
Definition IntegerComposition.hpp:253
__host__ __device__ Index_t dim() const
Definition IntegerComposition.hpp:90
Definition OperatorSpace.hpp:213
__host__ __device__ ManyBodyOperatorSpaceBase(ManyBodyOperatorSpaceBase const &other)=default
Copy constructor.
__host__ __device__ ManyBodyOperatorSpaceBase(ManyBodyOperatorSpaceBase &&other)=default
Move constructor.
__host__ __device__ ManyBodyOperatorSpaceBase()=default
Default constructor.
__host__ __device__ ManyBodyOperatorSpaceBase & operator=(ManyBodyOperatorSpaceBase &&other)=default
Move assignment operator.
__host__ __device__ ManyBodyOperatorSpaceBase(BaseSpace const &baseSpace, int systemSize, LocalSpace const &locSpace)
Construct a ManyBodyOperatorSpaceBase object by copying.
Definition OperatorSpace.hpp:224
__host__ __device__ ManyBodyOperatorSpaceBase(BaseSpace &&baseSpace, int systemSize, LocalSpace &&locSpace)
Construct a ManyBodyOperatorSpaceBase object by moving.
Definition OperatorSpace.hpp:235
__host__ __device__ ManyBodyOperatorSpaceBase & operator=(ManyBodyOperatorSpaceBase const &other)=default
Copy assignment operator.
typename HilbertSpaceTraits< Derived >::LocalSpace LocalSpace
Definition OperatorSpace.hpp:217
typename HilbertSpaceTraits< Derived >::BaseSpace BaseSpace
Definition OperatorSpace.hpp:216
__host__ __device__ ~ManyBodyOperatorSpaceBase()=default
Destructor.
Definition OperatorSpace.hpp:290
__host__ __device__ ManyBodyOperatorSpace()=default
Default constructor.
__host__ __device__ ManyBodyOperatorSpace(BaseSpace const &baseSpace)
Construct a ManyBodyOperatorSpace object by copying a BaseSpace object.
Definition OperatorSpace.hpp:307
__host__ __device__ void action_impl(int &resBasisNum, Complex_t< RealType > &coeff, int opNum, int basisNum) const
Definition OperatorSpace.hpp:370
__host__ __device__ int translate_impl(int state, int trans, Eigen::DenseBase< EigenDerived > &) const
Definition OperatorSpace.hpp:414
__host__ __device__ int locState_impl(int state, int pos) const
Definition OperatorSpace.hpp:395
typename HilbertSpaceTraits< ManyBodyOperatorSpace< ScalarType > >::BaseSpace BaseSpace
Definition OperatorSpace.hpp:298
__host__ __device__ int dim_impl() const
Definition OperatorSpace.hpp:362
__host__ __device__ ManyBodyOperatorSpace(ManyBodyOperatorSpace const &other)=default
Copy constructor.
__host__ __device__ ManyBodyOperatorSpace & operator=(ManyBodyOperatorSpace &&other)=default
Move assignment operator.
__host__ __device__ ManyBodyOperatorSpace & operator=(ManyBodyOperatorSpace const &other)=default
Copy assignment operator.
__host__ __device__ ManyBodyOperatorSpace(ManyBodyOperatorSpace &&other)=default
Move constructor.
__host__ __device__ ~ManyBodyOperatorSpace()=default
Destructor.
ScalarType Scalar
Definition OperatorSpace.hpp:295
__host__ __device__ int configToOrdinal_impl(Eigen::DenseBase< EigenDerived > &config) const
Definition OperatorSpace.hpp:405
BaseConverter< int > m_bConv
Definition OperatorSpace.hpp:292
__host__ __device__ ManyBodyOperatorSpace(BaseSpace &&baseSpace)
Construct a ManyBodyOperatorSpace object by moving a BaseSpace object.
Definition OperatorSpace.hpp:317
__host__ __device__ int translate_impl(int state, int trans) const
Definition OperatorSpace.hpp:410
typename HilbertSpaceTraits< ManyBodyOperatorSpace< ScalarType > >::LocalSpace LocalSpace
Definition OperatorSpace.hpp:300
__host__ __device__ Eigen::RowVectorXi ordinalToConfig_impl(int basisNum) const
Definition OperatorSpace.hpp:399
ManyBodySpinSpace defined by , where.
Definition HilbertSpace.hpp:130
__host__ __device__ LocSpace_t const & locSpace() const
Definition HilbertSpace.hpp:264
int m_systemSize
Definition HilbertSpace.hpp:141
__host__ __device__ int translate(int state, int trans) const
Translate the input state to the left by one.
Definition HilbertSpace.hpp:300
__host__ __device__ int dimLoc() const
Definition HilbertSpace.hpp:266
__host__ __device__ int locState(int state, int pos) const
Definition HilbertSpace.hpp:267
__host__ __device__ int sysSize() const
Definition HilbertSpace.hpp:265
Definition HilbertSpace.hpp:423
Definition OperatorSpace.hpp:12
__host__ __device__ void action(int &resBasisNum, Complex_t< RealType > &coeff, int opNum, int basisNum, Eigen::DenseBase< EigenDerived > &config) const
Definition OperatorSpace.hpp:89
__host__ __device__ OperatorSpaceBase & operator=(OperatorSpaceBase &&other)=default
Move assignment operator.
__host__ __device__ OperatorSpaceBase(BaseSpace &&baseSpace)
Construct a OperatorSpaceBase object by moving a BaseSpace object.
Definition OperatorSpace.hpp:34
Eigen::NumTraits< ScalarType >::Real Real
Definition OperatorSpace.hpp:19
__host__ __device__ int dim() const
Definition OperatorSpace.hpp:75
__host__ __device__ std::pair< int, Complex_t< Real > > action(int opNum, int basisNum) const
Definition OperatorSpace.hpp:96
__host__ __device__ OperatorSpaceBase()=default
Default constructor.
__host__ __device__ void action(int &resBasisNum, Complex_t< RealType > &coeff, int opNum, int basisNum) const
Definition OperatorSpace.hpp:83
__host__ __device__ OperatorSpaceBase & operator=(OperatorSpaceBase const &other)=default
Copy assignment operator.
__host__ __device__ OperatorSpaceBase(BaseSpace const &baseSpace)
Construct a OperatorSpaceBase object by copying a BaseSpace object.
Definition OperatorSpace.hpp:26
__host__ __device__ int baseDim() const
Definition OperatorSpace.hpp:80
typename HilbertSpaceTraits< Derived >::BaseSpace BaseSpace
Definition OperatorSpace.hpp:14
BaseSpace m_baseSpace
Definition OperatorSpace.hpp:16
__host__ Eigen::SparseMatrix< ScalarType > basisOp(int opNum) const
Definition OperatorSpace.hpp:113
__host__ void basisOp(Eigen::SparseMatrix< ScalarType > &res, int opNum) const
Definition OperatorSpace.hpp:104
__host__ __device__ ~OperatorSpaceBase()=default
Destructor.
__host__ __device__ OperatorSpaceBase(OperatorSpaceBase const &other)=default
Copy constructor.
__host__ __device__ BaseSpace const & baseSpace() const
Definition OperatorSpace.hpp:79
__host__ __device__ OperatorSpaceBase(OperatorSpaceBase &&other)=default
Move constructor.
typename HilbertSpaceTraits< Derived >::Scalar ScalarType
Definition OperatorSpace.hpp:15
Definition OperatorSpace.hpp:132
typename HilbertSpaceTraits< OperatorSpace >::BaseSpace BaseSpace
Definition OperatorSpace.hpp:135
ScalarType Scalar
Definition OperatorSpace.hpp:136
__host__ __device__ int dim_impl() const
Definition OperatorSpace.hpp:140
__host__ __device__ void action_impl(int &resBasisNum, Complex_t< RealType > &coeff, int opNum, int basisNum) const
Definition OperatorSpace.hpp:146
Definition OperatorSpace.hpp:430
__host__ __device__ int locState_impl(int opOrdinal, int pos) const
Definition OperatorSpace.hpp:546
__host__ __device__ int dim_impl() const
Definition OperatorSpace.hpp:526
__host__ __device__ mBodyOperatorSpace(mBodyOperatorSpace const &other)=default
Copy constructor.
__host__ __device__ mBodyOperatorSpace & operator=(mBodyOperatorSpace &&other)=default
Move assignment operator.
int m_opConfDim
Definition OperatorSpace.hpp:438
BaseConverter< int > m_opConfig
Definition OperatorSpace.hpp:440
__host__ __device__ mBodyOperatorSpace(int m, BaseSpace const &baseSpace)
Construct an mBodyOperatorSpace object by copying a BaseSpace object.
Definition OperatorSpace.hpp:457
__host__ __device__ mBodyOperatorSpace(int m, int sysSize, int dimLoc)
Construct an mBodyOperatorSpace object by copying a BaseSpace object.
Definition OperatorSpace.hpp:479
__host__ __device__ int m() const
Definition OperatorSpace.hpp:522
__host__ __device__ int translate_impl(int opOrdinal, int trans) const
Definition OperatorSpace.hpp:560
__host__ __device__ void action_impl(int &resBasisNum, Complex_t< RealType > &coeff, int opOrdinal, int basisNum) const
Definition OperatorSpace.hpp:530
__host__ __device__ mBodyOperatorSpace(mBodyOperatorSpace &&other)=default
Move constructor.
__host__ __device__ mBodyOperatorSpace & operator=(mBodyOperatorSpace const &other)=default
Copy assignment operator.
Array_t< Array_t< int > > m_config
Definition OperatorSpace.hpp:442
__host__ __device__ int configToOrdinal_impl(Eigen::DenseBase< EigenDerived > &config) const
ScalarType Scalar
Definition OperatorSpace.hpp:446
__host__ __device__ void action_impl(int &resBasisNum, Complex_t< RealType > &coeff, int opOrdinal, int basisNum, Eigen::DenseBase< Derived > &config) const
Definition OperatorSpace.hpp:575
Eigen::ArrayX< T > Array_t
Definition OperatorSpace.hpp:435
__host__ __device__ ~mBodyOperatorSpace()=default
Destructor.
typename HilbertSpaceTraits< mBodyOperatorSpace< ScalarType > >::LocalSpace LocalSpace
Definition OperatorSpace.hpp:450
typename HilbertSpaceTraits< mBodyOperatorSpace< ScalarType > >::BaseSpace BaseSpace
Definition OperatorSpace.hpp:448
__host__ __device__ int translate_impl(int opOrdinal, int trans, Eigen::DenseBase< EigenDerived > &workSpace) const
Definition OperatorSpace.hpp:629
IntegerComposition m_ActingSites
Definition OperatorSpace.hpp:439
__host__ __device__ mBodyOperatorSpace()=default
Default constructor.
__host__ __device__ Eigen::RowVectorXi ordinalToConfig_impl(int basisNum) const
Definition OperatorSpace.hpp:652
Eigen::VectorX< T > Vector_t
Definition OperatorSpace.hpp:433
int m_mBody
Definition OperatorSpace.hpp:437
ScalarType Scalar
Definition OperatorSpace.hpp:286
ScalarType Scalar
Definition OperatorSpace.hpp:129
ScalarType Scalar
Definition OperatorSpace.hpp:427
Definition HilbertSpace.hpp:23