VMPS++
Loading...
Searching...
No Matches
SiteOperatorQ.h
Go to the documentation of this file.
1#ifndef SITEOPERATORQ_H_
2#define SITEOPERATORQ_H_
3
5#include <unsupported/Eigen/KroneckerProduct>
7
8#include "tensors/Qbasis.h"
9#include "tensors/Biped.h"
10#include "numeric_limits.h"
11
12//Forward declaration
13template<typename Symmetry, typename Scalar> struct SiteOperator;
14
15template<typename Operator>
17{
18 typedef typename Operator::qType qType;
19 typedef typename Operator::MatrixType MatrixType;
20public:
22 EDSolver(const Operator &Op_in, const std::vector<qType> &blocks_in={}, Eigen::DecompositionOptions opt_in=Eigen::DecompositionOptions::EigenvaluesOnly)
23 {compute(Op_in,blocks_in,opt_in);}
24
25 void compute(const Operator &Op, const std::vector<qType> &blocks={}, Eigen::DecompositionOptions opt=Eigen::DecompositionOptions::EigenvaluesOnly);
26
27 const Operator& eigenvalues() const {return eigvals_;}
28 const Operator& eigenvectors() const {return eigvecs_;}
29
30 Operator groundstate( qType Q ) const;
31
32private:
33 Operator eigvals_;
34 Operator eigvecs_;
35 bool COMPUTED=false;
36};
37
38template<typename Operator>
40compute(const Operator &Op, const std::vector<qType> &blocks, Eigen::DecompositionOptions opt)
41{
42 eigvals_.data().clear(); eigvecs_.data().clear();
43 eigvals_.Q() = Op.Q(); eigvecs_.Q() = Op.Q();
44 eigvals_.basis() = Op.basis(); eigvecs_.basis() = Op.basis();
45 MatrixType Mtmp,eigva,eigve;
46 for(std::size_t nu=0; nu<Op.data().size(); nu++)
47 {
48 if(blocks.size()>0) { if(auto it = std::find(blocks.begin(),blocks.end(),Op.data().in[nu]); it == blocks.end()) {continue;} }
49 Mtmp = Op.data().block[nu];
50 Eigen::SelfAdjointEigenSolver<MatrixType> John(Mtmp,opt);
51 eigva = John.eigenvalues();//.asDiagonal();
52 eigvals_.data().push_back(Op.data().in[nu],Op.data().out[nu],eigva);
53 if(opt == Eigen::DecompositionOptions::ComputeEigenvectors)
54 {
55 eigve = John.eigenvectors();
56 eigvecs_.data().push_back(Op.data().in[nu],Op.data().out[nu],eigve);
57 }
58 }
59 COMPUTED = true;
60 return;
61}
62
63template<typename Operator>
65groundstate( qType Q ) const
66{
67 assert(COMPUTED and "First diagonalize the operator before accessing the groundstate!");
68 auto all_gs = eigenvectors();
69 Operator out(all_gs.Q(),all_gs.basis());
70 auto it = all_gs.data().dict.find({Q,Q});
71 assert(it != all_gs.data().dict.end() and "The groundstate to the given Q is not present.");
72 out.data().push_back(all_gs.data().in[it->second],all_gs.data().out[it->second],all_gs.data().block[it->second]);
73 return out;
74}
75
76
88template<typename Symmetry, typename MatrixType_>
89class SiteOperatorQ // : public Biped<Symmetry,MatrixType_>
90{
91private:
92 typedef Eigen::Index Index;
94
95public:
96 typedef typename Symmetry::qType qType;
97 typedef MatrixType_ MatrixType;
98 typedef typename MatrixType::Scalar Scalar;
99
102
103 SiteOperatorQ( const qType& Q_in, const Qbasis<Symmetry>& basis_in, std::string label_in="" )
104 :Q_(Q_in), basis_(basis_in), label_(label_in)
105 {};
106
107 SiteOperatorQ( const qType& Q_in, const Qbasis<Symmetry>& basis_in, const base& data_in )
108 :Q_(Q_in), basis_(basis_in), data_(data_in)
109 {};
110
111 base& data() {return data_;}
112 const base& data() const {return data_;}
113
114 qType& Q() {return Q_;}
115 const qType& Q() const {return Q_;}
116
118 const Qbasis<Symmetry>& basis() const {return basis_;}
119
120 std::string& label() {return label_;}
121 const std::string& label() const {return label_;}
122
123 MatrixType operator() ( const qType& bra, const qType& ket ) const;
124 MatrixType& operator() ( const qType& bra, const qType& ket );
125
126 Scalar operator() ( const std::string& bra, const std::string& ket ) const;
127 Scalar& operator() ( const std::string& bra, const std::string& ket );
128
131
133
135
136 void setZero();
138 void setRandom();
139
143 {
144 auto target = Symmetry::reduceSilent(O1.Q(),O2.Q());
145 assert(target.size() == 1 and "Use other outerprod!");
147 }
148
149 SiteOperatorQ<Symmetry,MatrixType_> diagonalize(const std::vector<qType> &blocks={}, Eigen::DecompositionOptions opt=Eigen::DecompositionOptions::EigenvaluesOnly) const;
150
151 typename MatrixType_::Scalar norm() const;
152
153 template<typename Scalar>
155
156 // template<typename Scalar>
157 // SiteOperator<Symmetry,Scalar> fullPlain(int m) const;
158
160 std::string print (bool PRINT_BASIS=false) const;
161
162 template<typename OtherScalar>
163 SiteOperatorQ<Symmetry,Eigen::Matrix<OtherScalar, -1, -1 > > cast() const
164 {
165 SiteOperatorQ<Symmetry,Eigen::Matrix<OtherScalar, -1, -1 > > Oout;
166 Oout.Q() = Q();
167 Oout.basis() = basis();
168 Oout.data() = data().template cast<Eigen::Matrix<OtherScalar, -1, -1> >();
169 Oout.label() = label();
170 return Oout;
171 }
172
173private:
174
178
179 std::string label_="";
180};
181
182template<typename Symmetry, typename MatrixType_>
184operator() ( const qType& bra, const qType& ket )
185{
186 std::array<qType,2> index = {bra,ket};
187 auto it = data_.dict.find(index);
188 if ( it != data_.dict.end() ) { return data_.block[it->second]; }
189 else
190 {
191 Eigen::Index dim1 = basis_.inner_dim(bra);
192 Eigen::Index dim2 = basis_.inner_dim(ket);
193 MatrixType A(dim1,dim2); A.setZero();
194 data_.push_back(index,A);
195 return data_.block[data_.size()-1];
196 }
197}
198
199template<typename Symmetry, typename MatrixType_>
201operator() ( const qType& bra, const qType& ket ) const
202{
203 std::array<qType,2> index = {bra,ket};
204 auto it = data_.dict.find(index);
205 assert( it != data_.dict.end() and "The element does not exist in the SiteOperatorQ." );
206 return data_.block[it->second];
207}
208
209template<typename Symmetry, typename MatrixType_>
210typename MatrixType_::Scalar& SiteOperatorQ<Symmetry,MatrixType_>::
211operator() ( const std::string& bra, const std::string& ket )
212{
213 qType bra_ = basis_.find(bra);
214 qType ket_ = basis_.find(ket);
215 std::array<qType,2> index = {bra_,ket_};
216 auto it = data_.dict.find(index);
217 if ( it != data_.dict.end() )
218 {
219 Eigen::Index i = basis_.location(bra);
220 Eigen::Index j = basis_.location(ket);
221 if constexpr ( std::is_same<MatrixType_,Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> >::value )
222 {
223 return data_.block[it->second](i,j);
224 }
225 else if constexpr ( std::is_same<MatrixType_,Eigen::SparseMatrix<Scalar> >::value )
226 {
227 return data_.block[it->second].coeffRef(i,j);
228 }
229 }
230 else
231 {
232 Eigen::Index dim1 = basis_.inner_dim(bra_);
233 Eigen::Index dim2 = basis_.inner_dim(ket_);
234 MatrixType A(dim1,dim2); A.setZero();
235 Eigen::Index i = basis_.location(bra);
236 Eigen::Index j = basis_.location(ket);
237 data_.push_back(index,A);
238 if constexpr ( std::is_same<MatrixType_,Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> >::value )
239 {
240 return data_.block[data_.size()-1](i,j);
241 }
242 else if constexpr ( std::is_same<MatrixType_,Eigen::SparseMatrix<Scalar> >::value )
243 {
244 return data_.block[data_.size()-1].coeffRef(i,j);
245 }
246 }
247}
248
249template<typename Symmetry, typename MatrixType_>
250typename MatrixType_::Scalar SiteOperatorQ<Symmetry,MatrixType_>::
251operator() ( const std::string& bra, const std::string& ket ) const
252{
253 qType bra_ = basis_.find(bra);
254 qType ket_ = basis_.find(ket);
255 std::array<qType,2> index = {bra_,ket_};
256 auto it = data_.dict.find(index);
257 assert( it != data_.dict.end() and "The element does not exist in the SiteOperatorQ." );
258 Eigen::Index i = basis_.location(bra);
259 Eigen::Index j = basis_.location(ket);
260 return data_.block[it->second](i,j);
261}
262
263template<typename Symmetry, typename MatrixType_>
265diagonalize (const std::vector<qType> &blocks, Eigen::DecompositionOptions opt) const
266{
267 assert(this->Q() == Symmetry::qvacuum() and "Only a singlet operator can get diagonalized.");
268 SiteOperatorQ<Symmetry,MatrixType_> out( this->Q(), this->basis() );
269
270 MatrixType Mtmp,res;
271 for( std::size_t nu=0; nu<this->data().size(); nu++ )
272 {
273 if(blocks.size()>0) { if(auto it = std::find(blocks.begin(),blocks.end(),this->data().in[nu]); it == blocks.end()) {continue;} }
274 Mtmp = this->data().block[nu];
275 Eigen::SelfAdjointEigenSolver<MatrixType> John(Mtmp);
276 res = John.eigenvalues().asDiagonal();
277 out.data().push_back(this->data().in[nu],this->data().out[nu],res);
278 }
279 return out;
280}
281
282template<typename Symmetry, typename MatrixType_>
283typename MatrixType_::Scalar SiteOperatorQ<Symmetry,MatrixType_>::
284norm () const
285{
286 auto tmp = SiteOperatorQ<Symmetry,MatrixType_>::prod(*this, this->adjoint(), Symmetry::qvacuum());
287 return tmp.data().trace();
288}
289
290template<typename Symmetry, typename MatrixType_>
292adjoint () const
293{
294 SiteOperatorQ<Symmetry,MatrixType_> out( Symmetry::flip(this->Q()), this->basis() );
295
296 for( std::size_t nu=0; nu<this->data().size(); nu++ )
297 {
298 std::array<qType,2> index = {this->data().out[nu],this->data().in[nu]};
299 MatrixType A = this->data().block[nu].adjoint();
300 A *= Symmetry::coeff_adjoint(this->data().in[nu],this->data().out[nu],this->Q());
301 out.data().push_back(index,A);
302 }
303 out.label() = this->label() + "†";
304 return out;
305}
306
307template<typename Symmetry, typename MatrixType_>
309hermitian_conj () const
310{
311 SiteOperatorQ<Symmetry,MatrixType_> out( Symmetry::flip(this->Q()), this->basis() );
312
313 for( std::size_t nu=0; nu<this->data().size(); nu++ )
314 {
315 std::array<qType,2> index = {this->data().out[nu],this->data().in[nu]};
316 MatrixType A = this->data().block[nu].adjoint();
317 // A *= Symmetry::coeff_adjoint(this->data().in[nu],this->data().out[nu],this->Q());
318 out.data().push_back(index,A);
319 }
320 return out;
321}
322
323template<typename Symmetry, typename MatrixType_>
324template<typename Scalar>
326plain() const
327{
329 MatrixType_ Mtmp(basis().size(), basis().size()); Mtmp.setZero();
330 for( auto itQ = basis().cbegin(); itQ != basis().cend(); itQ++ )
331 {
332 auto [qVal,qNum,qPlain] = *itQ;
333 for( auto itP = basis().cbegin(); itP != basis().cend(); itP++ )
334 {
335 auto [pVal,pNum,pPlain] = *itP;
336 if( auto it = data().dict.find({{qVal,pVal}}); it != data().dict.end() )
337 {
338 Mtmp.block(qNum,pNum,qPlain.size(),pPlain.size()) = data().block[it->second];
339 }
340 }
341 }
342// if constexpr ( std::is_same<OtherMatrixType,Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> >::value )
343// {
344// out.data = Mtmp;
345// }
346// else if constexpr ( std::is_same<OtherMatrixType,Eigen::SparseMatrix<Scalar> >::value )
347// {
348// out.data = Mtmp.sparseView();
349// }
350 out.data = Mtmp.sparseView();
351 out.Q = this->Q();
352 out.label = this->label();
353 return out;
354}
355
356// template<typename Symmetry, typename MatrixType_>
357// template<typename Scalar>
358// SiteOperator<Symmetry,Scalar> SiteOperatorQ<Symmetry,MatrixType_>::
359// fullPlain(int m) const
360// {
361// SiteOperator<Symmetry,Scalar> out;
362// MatrixType_ Mtmp(basis().fullM(), basis().fullM()); Mtmp.setZero();
363// for( auto itQ = basis().cbegin(); itQ != basis().cend(); itQ++ )
364// {
365// auto [qVal,qNum,qPlain] = *itQ;
366// for( auto itP = basis().cbegin(); itP != basis().cend(); itP++ )
367// {
368// auto [pVal,pNum,pPlain] = *itP;
369// if( auto it = data().dict.find({{qVal,pVal}}); it != data().dict.end() )
370// {
371// for (int qm=0; qm<Symmetry::degeneracy(qVal); qm++)
372// for (int pm=0; pm<Symmetry::degeneracy(pVal); pm++)
373// Mtmp.block(qNum,pNum,qPlain.size(),pPlain.size()) = data().block[it->second];
374// }
375// }
376// }
377// if constexpr ( std::is_same<OtherMatrixType,Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> >::value )
378// {
379// out.data = Mtmp;
380// }
381// else if constexpr ( std::is_same<OtherMatrixType,Eigen::SparseMatrix<Scalar> >::value )
382// {
383// out.data = Mtmp.sparseView();
384// }
385// out.data = Mtmp.sparseView();
386// out.Q = this->Q();
387// out.label = this->label();
388// return out;
389// }
390
391template<typename Symmetry, typename MatrixType_>
393setZero()
394{
395 for(const auto& q : basis().qloc())
396 {
397 (*this)(q,q).setZero();
398 }
399}
400
401template<typename Symmetry, typename MatrixType_>
404{
405 for(const auto& q : basis().qloc())
406 {
407 (*this)(q,q).setIdentity();
408 }
409}
410
411template<typename Symmetry, typename MatrixType_>
413setRandom()
414{
415 for(const auto& q : basis().qloc())
416 {
417 (*this)(q,q).setRandom();
418 }
419}
420
421template<typename Symmetry, typename MatrixType_>
424{
425 std::array<qType,3> checkIndex = {O1.Q(),O2.Q(),target};
426 assert( Symmetry::validate(checkIndex) and "Operators O1 and O2 cannot get multplied to a quantum number target operator" );
427 assert( O1.basis() == O2.basis() and "For a prod() operation the two operators need to have the same basis" );
428
429 SiteOperatorQ out( target, O1.basis() );
430
431 std::array<qType,2> totIndex, index;
433 Scalar factor_cgc;
434 for ( std::size_t nu=0; nu<O1.data().size(); nu++ )
435 {
436 auto qvec = Symmetry::reduceSilent(O1.data().out[nu],Symmetry::flip(O2.Q()));
437 for (const auto& q : qvec)
438 {
439 index = {O1.data().out[nu],q};
440 auto it = O2.data().dict.find(index);
441 if (it == O2.data().dict.end()) {continue;}
442 std::size_t mu = it->second;
443 factor_cgc = Symmetry::coeff_prod( O1.data().in[nu], O1.Q(), O1.data().out[nu],
444 O2.Q(), O2.data().out[mu], target);
445 // factor_cgc = Symmetry::coeff_Apair( O2.data().out[mu], O2.Q(), O1.data().out[nu],
446 // O1.Q(), O1.data().in[nu], target);
447 if ( std::abs(factor_cgc) < std::abs(::mynumeric_limits<Scalar>::epsilon()) ) { continue; }
448 totIndex = { O1.data().in[nu], O2.data().out[mu] };
449 A = O1.data().block[nu] * O2.data().block[mu] * factor_cgc;
450 // A = O2.data().block[mu] * O1.data().block[nu] * factor_cgc;
451 auto check = out.data().dict.find(totIndex);
452 if ( check == out.data().dict.end() )
453 {
454 out.data().push_back(totIndex,A);
455 }
456 else { out.data().block[check->second] += A; }
457 }
458 }
459 // for ( std::size_t nu=0; nu<O1.data().size(); nu++ )
460 // {
461 // // auto qvec = Symmetry::reduceSilent(O1.data().in[nu],Symmetry::flip(O2.Q()));
462 // auto qvec = Symmetry::reduceSilent(O1.data().in[nu],O2.Q());
463
464 // for (const auto& q : qvec)
465 // {
466 // index = {q,O1.data().in[nu]};
467 // auto it = O2.data().dict.find(index);
468 // if (it == O2.data().dict.end()) {continue;}
469 // std::size_t mu = it->second;
470 // // factor_cgc = Symmetry::coeff_Apair( O1.data().out[nu], O1.Q(), O1.data().in[nu],
471 // // O2.Q(), O2.data().in[mu], target);
472 // factor_cgc = Symmetry::coeff_Apair( O2.data().in[mu], O2.Q(), O1.data().in[nu],
473 // O1.Q(), O1.data().out[nu], target);
474 // if ( std::abs(factor_cgc) < ::numeric_limits<Scalar>::epsilon() ) { continue; }
475 // totIndex = { O1.data().in[nu], O2.data().out[mu] };
476 // A = O1.data().block[nu] * O2.data().block[mu] * factor_cgc;
477 // // A = O2.data().block[mu] * O1.data().block[nu] * factor_cgc;
478 // auto check = out.data().dict.find(totIndex);
479 // if ( check == out.data().dict.end() )
480 // {
481 // out.data().push_back(totIndex,A);
482 // }
483 // else { out.data().block[check->second] += A; }
484 // }
485 // }
486 stringstream ss;
487 if (O1.label() == O2.label()) { ss << O1.label() << "²"; }
488 else {ss << O1.label() << "*" << O2.label();}
489
490 out.label() = ss.str();
491
492 return out;
493}
494
495template<typename Symmetry, typename MatrixType_>
498{
499 std::array<qType,3> checkIndex = {O1.Q(),O2.Q(),target};
500 assert(Symmetry::validate(checkIndex) and "Operators O1 and O2 cannot get multiplied to an operator with quantum number = target");
501
502 auto TensorBasis = O1.basis().combine(O2.basis());
503
504 SiteOperatorQ out(target,TensorBasis);
505
506 std::array<qType,2> totIndex;
507 MatrixType Atmp,A;
508 Index rows,cols;
509 Scalar factor_cgc;
510
511 for (std::size_t nu=0; nu<O1.data().size(); nu++)
512 for (std::size_t mu=0; mu<O2.data().size(); mu++)
513 {
514 auto reduce1 = Symmetry::reduceSilent(O1.data().in[nu], O2.data().in[mu]);
515 auto reduce2 = Symmetry::reduceSilent(O1.data().out[nu], O2.data().out[mu]);
516 for (const auto& q1:reduce1)
517 for (const auto& q2:reduce2)
518 {
519 factor_cgc = Symmetry::coeff_tensorProd(O1.data().out[nu], O2.data().out[mu], q2,
520 O1.Q(), O2.Q(), target,
521 O1.data().in[nu], O2.data().in[mu], q1);
522 if (std::abs(factor_cgc) < ::mynumeric_limits<Scalar>::epsilon()) {continue;}
523 totIndex = { q1, q2 };
524 rows = O1.data().block[nu].rows() * O2.data().block[mu].rows();
525 cols = O1.data().block[nu].cols() * O2.data().block[mu].cols();
526 Atmp.resize(rows,cols);
527
528 Atmp = kroneckerProduct(O1.data().block[nu], O2.data().block[mu]);
529 Index left1 = TensorBasis.leftAmount (q1,{O1.data().in[nu], O2.data().in[mu]});
530 Index right1 = TensorBasis.rightAmount(q1,{O1.data().in[nu], O2.data().in[mu]});
531 Index left2 = TensorBasis.leftAmount (q2,{O1.data().out[nu], O2.data().out[mu]});
532 Index right2 = TensorBasis.rightAmount(q2,{O1.data().out[nu], O2.data().out[mu]});
533 A.resize(rows+left1+right1,cols+left2+right2); A.setZero();
534 A.block(left1,left2,rows,cols) = Atmp;
535
536 auto it = out.data().dict.find(totIndex);
537 if (it == out.data().dict.end())
538 {
539 out.data().push_back(totIndex, factor_cgc*A);
540 }
541 else
542 {
543 out.data().block[it->second] += factor_cgc * A;
544 }
545 }
546 }
547 stringstream ss;
548 ss << O1.label() << "⊗" << O2.label();
549 out.label() = ss.str();
550 return out;
551}
552
553template<typename Symmetry,typename MatrixType_>
555{
556 *this = *this + Op;
557 return *this;
558}
559
560template<typename Symmetry,typename MatrixType_>
562{
563 *this = *this - Op;
564 return *this;
565}
566
567template<typename Symmetry, typename MatrixType_>
569print(bool PRINT_BASIS) const
570{
571 std::stringstream out;
572 out << "Operator " << label() << endl;
573 if (PRINT_BASIS) {out << basis() << endl;}
574 out << data().print(true) << endl;
575 return out.str();
576}
577
578template<typename Symmetry,typename MatrixType_>
580{
582 out.data() = s*op.data();
583 return out;
584}
585
586template<typename Symmetry,typename MatrixType_>
588{
589 auto Qtots = Symmetry::reduceSilent(O1.Q(), O2.Q());
590 assert(Qtots.size() == 1 and "The operator * for SiteOperatorQ can only be used uf the target quantumnumber is unique. Use SiteOperatorQ::prod() insteat.");
591 auto Oout = SiteOperatorQ<Symmetry,MatrixType_>::prod(O1, O2, Qtots[0]);
592 return Oout;
593}
594
595template<typename Symmetry,typename MatrixType_>
597{
598 assert(O1.basis() == O2.basis() and "For addition of SiteOperatorQs the basis needs to be the same.");
599 assert(O1.Q() == O2.Q() and "For addition of SiteOperatorQs the operator quantum number needs to be the same.");
601 out.data() = O1.data() + O2.data();
602 stringstream ss;
603 ss << "(" << O1.label() << "+" << O2.label() << ")";
604 out.label() = ss.str();
605
606 return out;
607}
608
609template<typename Symmetry,typename MatrixType_>
611{
612 assert(O1.basis() == O2.basis() and "For subtraction of SiteOperatorQs the basis needs to be the same.");
613 assert(O1.Q() == O2.Q() and "For subtraction of SiteOperatorQs the operator quantum number needs to be the same.");
615 out.data() = O1.data() - O2.data();
616 stringstream ss;
617 ss << "(" << O1.label() << "-" << O2.label() << ")";
618 out.label() = ss.str();
619 return out;
620}
621
622template<typename Symmetry,typename MatrixType_>
624{
626}
627
628template<typename Symmetry,typename MatrixType_>
629std::ostream& operator<<(std::ostream& os, const SiteOperatorQ<Symmetry,MatrixType_> &Op)
630{
631 os << Op.print(true);
632 return os;
633}
634
635#endif
void setZero(PivotVector< Symmetry, Scalar_ > &V)
@ A
Definition: DmrgTypedefs.h:130
SiteOperatorQ< Symmetry, MatrixType_ > operator*(const typename MatrixType_::Scalar &s, const SiteOperatorQ< Symmetry, MatrixType_ > &op)
std::ostream & operator<<(std::ostream &os, const SiteOperatorQ< Symmetry, MatrixType_ > &Op)
SiteOperatorQ< Symmetry, MatrixType_ > kroneckerProduct(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2)
SiteOperatorQ< Symmetry, MatrixType_ > operator+(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2)
SiteOperatorQ< Symmetry, MatrixType_ > operator-(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2)
void compute(const Operator &Op, const std::vector< qType > &blocks={}, Eigen::DecompositionOptions opt=Eigen::DecompositionOptions::EigenvaluesOnly)
Definition: SiteOperatorQ.h:40
const Operator & eigenvalues() const
Definition: SiteOperatorQ.h:27
Operator eigvals_
Definition: SiteOperatorQ.h:33
Operator::qType qType
Definition: SiteOperatorQ.h:18
bool COMPUTED
Definition: SiteOperatorQ.h:35
const Operator & eigenvectors() const
Definition: SiteOperatorQ.h:28
EDSolver(const Operator &Op_in, const std::vector< qType > &blocks_in={}, Eigen::DecompositionOptions opt_in=Eigen::DecompositionOptions::EigenvaluesOnly)
Definition: SiteOperatorQ.h:22
Operator::MatrixType MatrixType
Definition: SiteOperatorQ.h:19
Operator eigvecs_
Definition: SiteOperatorQ.h:34
Operator groundstate(qType Q) const
Definition: SiteOperatorQ.h:65
Definition: Qbasis.h:39
SiteOperatorQ< Symmetry, MatrixType_ > diagonalize(const std::vector< qType > &blocks={}, Eigen::DecompositionOptions opt=Eigen::DecompositionOptions::EigenvaluesOnly) const
SiteOperatorQ(const qType &Q_in, const Qbasis< Symmetry > &basis_in, const base &data_in)
MatrixType_::Scalar norm() const
static SiteOperatorQ< Symmetry, MatrixType_ > outerprod(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2)
Symmetry::qType qType
Definition: SiteOperatorQ.h:96
const qType & Q() const
std::string print(bool PRINT_BASIS=false) const
const Qbasis< Symmetry > & basis() const
SiteOperator< Symmetry, Scalar > plain() const
SiteOperatorQ< Symmetry, Eigen::Matrix< OtherScalar, -1, -1 > > cast() const
SiteOperatorQ< Symmetry, MatrixType_ > & operator+=(const SiteOperatorQ< Symmetry, MatrixType_ > &Op)
static SiteOperatorQ< Symmetry, MatrixType_ > prod(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2, const qType &target)
SiteOperatorQ< Symmetry, MatrixType_ > hermitian_conj() const
const std::string & label() const
Eigen::Index Index
Definition: SiteOperatorQ.h:92
SiteOperatorQ< Symmetry, MatrixType_ > adjoint() const
const base & data() const
std::string & label()
SiteOperatorQ(const qType &Q_in, const Qbasis< Symmetry > &basis_in, std::string label_in="")
Qbasis< Symmetry > basis_
SiteOperatorQ< Symmetry, MatrixType_ > & operator-=(const SiteOperatorQ< Symmetry, MatrixType_ > &Op)
static SiteOperatorQ< Symmetry, MatrixType_ > outerprod(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2, const qType &target)
Qbasis< Symmetry > & basis()
MatrixType::Scalar Scalar
Definition: SiteOperatorQ.h:98
std::string label_
void setIdentity()
MatrixType operator()(const qType &bra, const qType &ket) const
MatrixType_ MatrixType
Definition: SiteOperatorQ.h:97
Biped< Symmetry, MatrixType_ > base
Definition: SiteOperatorQ.h:93
Definition: Biped.h:64
std::unordered_map< std::array< qType, 2 >, std::size_t > dict
Definition: Biped.h:104
std::vector< MatrixType_ > block
Definition: Biped.h:96
std::vector< qType > in
Definition: Biped.h:87
void push_back(qType qin, qType qout, const MatrixType_ &M)
Definition: Biped.h:529
std::vector< qType > out
Definition: Biped.h:90
std::string label
Definition: SiteOperator.h:71
Eigen::SparseMatrix< Scalar_ > data
Definition: SiteOperator.h:41
Symmetry::qType Q
Definition: SiteOperator.h:40