30 template<
class Matrix,
class SymmGroup>
33 prempo_t
const & tags,
38 , operator_table(tbl_)
40 using namespace boost::tuples;
41 typedef boost::tuple<index_type, index_type, tag_type, value_type> prempo_descriptor;
42 typedef std::vector<prempo_descriptor> converted_prempo_t;
46 if (tags.size() > 0 && operator_table.get() != NULL) {
47 converted_prempo_t tmp_tags;
50 for (
typename prempo_t::const_iterator it = tags.begin(); it != tags.end(); ++it) {
53 tmp_tags.push_back( prempo_descriptor(row_i, col_i, get<2>(*it), get<3>(*it)) );
59 for (
typename converted_prempo_t::const_iterator it = tmp_tags.begin(); it != tmp_tags.end(); ++it) {
60 col_tags(get<0>(*it), get<1>(*it)) = std::make_pair(get<2>(*it), get<3>(*it));
61 row_index[get<0>(*it)].insert(get<1>(*it));
94 template<
class Matrix,
class SymmGroup>
98 assert(left_index < left_i && right_index < right_i);
99 return col_tags.find_element(left_index, right_index) != NULL;
105 template<
class Matrix,
class SymmGroup>
107 if (this->
has(li, ri)) {
108 col_tags.find_element(li, ri)->second = scale_;
109 (*operator_table)[col_tags.find_element(li, ri)->first] = op;
112 tag_type new_tag = operator_table->register_op(op);
113 col_tags(li, ri) = internal_value_type(new_tag, scale_);
114 row_index[li].insert(ri);
118 template<
class Matrix,
class SymmGroup>
121 assert(this->
has(left_index, right_index));
122 typename CSCMatrix::value_type
const & p = col_tags(left_index, right_index);
129 template<
class Matrix,
class SymmGroup>
132 if (!this->
has(left_index, right_index))
133 this->
set(left_index, right_index,
op_t(), 1.);
134 typename CSCMatrix::value_type & p = col_tags(left_index, right_index).ref();
138 template<
class Matrix,
class SymmGroup>
141 return row_proxy(row_index[row_i].begin(), row_index[row_i].end());
144 template<
class Matrix,
class SymmGroup>
150 template<
class Matrix,
class SymmGroup>
153 return col_tags(left_index, right_index).first;
156 template<
class Matrix,
class SymmGroup>
159 for (
typename CSCMatrix::iterator2 it2 = col_tags.begin2(); it2 != col_tags.end2(); ++it2)
160 for (
typename CSCMatrix::iterator1 it1 = it2.begin(); it1 != it2.end(); ++it1)
164 template<
class Matrix,
class SymmGroup>
167 for (
typename CSCMatrix::iterator2 it2 = col_tags.begin2(); it2 != col_tags.end2(); ++it2)
168 for (
typename CSCMatrix::iterator1 it1 = it2.begin(); it1 != it2.end(); ++it1)
172 template<
class Matrix,
class SymmGroup>
175 return operator_table;
178 template<
class Matrix,
class SymmGroup>
184 template<
class Matrix,
class SymmGroup>
maquis::traits::scalar_type< Matrix >::type scalar_type
void set(index_type li, index_type ri, op_t const &op, value_type scale_=1.0)
void divide_by_scalar(const scalar_type &)
index_type row_dim() const
op_table_ptr get_operator_table() const
OPTable< Matrix, SymmGroup >::tag_type tag_type
tag_type tag_number(index_type left_index, index_type right_index) const
row_proxy row(index_type row_i) const
MPOTensor_detail::row_proxy< typename RowIndex::value_type::const_iterator > row_proxy
const_term_descriptor< Matrix, SymmGroup > make_const_term_descriptor(block_matrix< Matrix, SymmGroup > const &op_, Scale s_)
MPOTensor_detail::const_term_descriptor< Matrix, SymmGroup > at(index_type left_index, index_type right_index) const
bool has(index_type left_index, index_type right_index) const
MPOTensor(index_type=1, index_type=1, prempo_t const &=prempo_t(), op_table_ptr=op_table_ptr())
col_proxy column(index_type col_i) const
boost::shared_ptr< OPTable< Matrix, SymmGroup > > op_table_ptr
functions to reshape the representation of data in MPSTensor
boost::numeric::ublas::matrix_column< const CSCMatrix > col_proxy
void multiply_by_scalar(const scalar_type &)
index_type col_dim() const
OPTable< Matrix, SymmGroup >::op_t op_t
Matrix::value_type value_type