8#include "numeric_limits.h"
11template<
typename Symmetry,
typename MatrixType_>
class SiteOperatorQ;
12template<
typename Symmetry>
class Qbasis;
13template<
typename Symmetry,
typename MatrixType_>
struct Biped;
30template<
typename Symmetry,
typename Scalar_>
36 SiteOperator (
const Eigen::SparseMatrix<Scalar_> &data_input,
const typename Symmetry::qType& Q_input, std::string label_input=
"")
37 :
data(data_input),
Q(Q_input),
label(label_input)
40 typename Symmetry::qType
Q = Symmetry::qvacuum();
41 Eigen::SparseMatrix<Scalar_>
data;
46 Q = Symmetry::qvacuum();
49 template<
typename OtherScalar>
54 Oout.
data =
data.template cast<OtherScalar>();
74template<
typename Symmetry,
typename Scalar_>
84template<
typename Symmetry,
typename Scalar_>
91template<
typename Symmetry,
typename Scalar_>
98template<
typename Symmetry,
typename Scalar_>
105 std::stringstream labelstream;
106 labelstream <<
"(" << O1.
label <<
"*" << O2.
label <<
")";
107 Oout.
label = labelstream.str();
112template<
typename Symmetry,
typename Scalar_>
115 assert(O1.
Q == O2.
Q and
"For addition of SiteOperators the operator quantum number needs to be the same.");
120 std::stringstream labelstream;
121 labelstream <<
"(" << O1.
label <<
"+" << O2.
label <<
")";
122 Oout.
label = labelstream.str();
127template<
typename Symmetry,
typename Scalar_>
130 assert(O1.
Q == O2.
Q and
"For addition of SiteOperators the operator quantum number needs to be the same.");
135 std::stringstream labelstream;
136 labelstream <<
"(" << O1.
label <<
"-" << O2.
label <<
")";
137 Oout.
label = labelstream.str();
142template<
typename Symmetry,
typename Scalar_,
typename OtherScalar>
149 std::stringstream labelstream;
150 if(std::abs(x-1.) > ::mynumeric_limits<double>::epsilon())
152 labelstream <<
"(" << x <<
"*" << O.
label <<
")";
156 labelstream << O.
label;
158 Oout.
label = labelstream.str();
163template<
typename Symmetry,
typename Scalar_>
172template<
typename Symmetry,
typename Scalar_>
177 return ((O1.
data - O2.
data).norm() < ::mynumeric_limits<double>::epsilon());
182template<
typename Symmetry,
typename Scalar_>
188template<
typename Symmetry,
typename Scalar_>
192 Q = Symmetry::qvacuum();
SiteOperator< Symmetry, Scalar_ > operator-(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
SiteOperator< Symmetry, Scalar_ > operator+(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
bool operator==(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
SiteOperator< Symmetry, Scalar_ > operator*(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
SiteOperator< Symmetry, Scalar_ > kroneckerProduct(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
void push_back(const std::tuple< qType, Eigen::Index, std::vector< std::string > > &state)
void push_back(qType qin, qType qout, const MatrixType_ &M)
SiteOperator< Symmetry, Scalar_ > & operator-=(const SiteOperator< Symmetry, Scalar_ > &Op)
SiteOperator(const Eigen::SparseMatrix< Scalar_ > &data_input, const typename Symmetry::qType &Q_input, std::string label_input="")
SiteOperatorQ< Symmetry, Eigen::Matrix< Scalar_, Eigen::Dynamic, Eigen::Dynamic > > structured()
Eigen::SparseMatrix< Scalar_ > data
SiteOperator< Symmetry, OtherScalar > cast() const
SiteOperator< Symmetry, Scalar_ > & operator+=(const SiteOperator< Symmetry, Scalar_ > &Op)