63 for (std::size_t p = 0; p < positions.size(); ++p)
65 assert( positions[p].size() == ops.size() );
66 for (std::size_t i=1; i<ops.size(); ++i)
67 if (positions[p][i-1] >= positions[p][i])
68 throw std::runtime_error(
"measure_local_at requires i1<i2<...<in.");
73 bool with_sign =
false;
74 for (std::size_t i=0; i<ops.size(); ++i) {
75 std::size_t pos = positions[p][i];
82 if (!with_sign && ops[i].second)
gemm(fill, op, tmp);
84 hterm.
operators.push_back( std::make_pair(pos, tmp) );
87 with_sign = (ops[i].second) ? !with_sign : with_sign;
88 if (i != ops.size()-1)
89 for (; pos<positions[p][i+1]; ++pos) {
92 hterm.
operators.push_back( std::make_pair(pos, (with_sign) ? fill : ident) );
double expval(MPS< Matrix, SymmGroup > const &mps, MPO< Matrix, SymmGroup > const &mpo, int d)
std::vector< typename MPS< Matrix, SymmGroup >::scalar_type > vector_results
MPS< Matrix, SymmGroup >::scalar_type overlap(MPS< Matrix, SymmGroup > const &mps1, MPS< Matrix, SymmGroup > const &mps2)
T get_prop(std::string property, pos_t site) const
MPSTensor< Matrix, SymmGroup >::scalar_type scalar_type
std::vector< op_pair_t > operators
MPS< Matrix, SymmGroup > mpo_to_smps(MPO< Matrix, SymmGroup > const &mpo, Index< SymmGroup > const &phys_i)
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
Index< SymmGroup > phys_psi
MPS< Matrix, SymmGroup >::scalar_type dm_trace(MPS< Matrix, SymmGroup > const &mps, Index< SymmGroup > const &phys_psi)