35 #include <alps/numeric/real.hpp>
42 template<
class Matrix,
class SymmGroup>
45 : phys_i( mps1.site_dim()*mps2.site_dim() )
46 , phys_i_left( mps1.site_dim() )
47 , phys_i_right( mps2.site_dim() )
48 , left_i( mps1.row_dim() )
49 , right_i( mps2.col_dim() )
51 , cur_normalization(
Unorm)
60 template<
class Matrix,
class SymmGroup>
66 template<
class Matrix,
class SymmGroup>
72 template<
class Matrix,
class SymmGroup>
78 template<
class Matrix,
class SymmGroup>
86 ts_reshape::reshape_both_to_left<Matrix, SymmGroup>(phys_i_left, phys_i_right, left_i, right_i, data_, tmp);
90 ts_reshape::reshape_both_to_left<Matrix, SymmGroup>(phys_i_left, phys_i_right, left_i, right_i, data_, tmp);
99 template<
class Matrix,
class SymmGroup>
107 ts_reshape::reshape_right_to_both<Matrix, SymmGroup>(phys_i_left, phys_i_right, left_i, right_i, data_, tmp);
110 ts_reshape::reshape_left_to_both<Matrix, SymmGroup>(phys_i_left, phys_i_right, left_i, right_i, data_, tmp);
117 template<
class Matrix,
class SymmGroup>
125 ts_reshape::reshape_both_to_right<Matrix, SymmGroup>(phys_i_left, phys_i_right, left_i, right_i, data_, tmp);
129 ts_reshape::reshape_both_to_right<Matrix, SymmGroup>(phys_i_left, phys_i_right, left_i, right_i, data_, tmp);
138 template<
class Matrix,
class SymmGroup>
145 template<
class Matrix,
class SymmGroup>
151 typedef typename alps::numeric::associated_real_diagonal_matrix<Matrix>::type dmt;
158 assert( mps_tensor1.reasonable() );
161 assert( mps_tensor2.reasonable() );
163 return boost::make_tuple(mps_tensor1, mps_tensor2, trunc);
166 template<
class Matrix,
class SymmGroup>
172 typedef typename alps::numeric::associated_real_diagonal_matrix<Matrix>::type dmt;
183 return boost::make_tuple(mps_tensor1, mps_tensor2, trunc);
186 template<
class Matrix,
class SymmGroup>
187 std::ostream& operator<<(std::ostream& os, TwoSiteTensor<Matrix, SymmGroup>
const & mps)
189 os <<
"Physical space: " << mps.phys_i << std::endl;
190 os <<
"Left space: " << mps.left_i << std::endl;
191 os <<
"Right space: " << mps.right_i << std::endl;
196 template<
class Matrix,
class SymmGroup>
203 template<
class Matrix,
class SymmGroup>
210 template<
class Matrix,
class SymmGroup>
213 swap(this->phys_i, b.phys_i);
214 swap(this->phys_i_left, b.phys_i_left);
215 swap(this->phys_i_right, b.phys_i_right);
216 swap(this->left_i, b.left_i);
217 swap(this->right_i, b.right_i);
218 swap(this->data_, b.data_);
219 swap(this->cur_storage, b.cur_storage);
220 swap(this->cur_normalization, b.cur_normalization);
223 template<
class Matrix,
class SymmGroup>
226 this->make_left_paired();
functions to reshape the representation of data in TwoSiteTensor
Index< SymmGroup > const & site_dim() const
void make_left_paired() const
Index< SymmGroup > const & col_dim() const
void swap_with(TwoSiteTensor &b)
Index< SymmGroup > const & row_dim() const
void make_right_paired() const
MPSTensor< Matrix, SymmGroup > make_mps() const
void swap(MPSTensor< Matrix, SymmGroup > &x, MPSTensor< Matrix, SymmGroup > &y)
void make_right_paired() const
Index< SymmGroup > const & row_dim() const
friend std::ostream & operator<<(std::ostream &, TwoSiteTensor< Matrix_, SymmGroup_ > const &)
block_matrix< Matrix, SymmGroup > & data()
TwoSiteTensor(MPSTensor< Matrix, SymmGroup > const &mps1, MPSTensor< Matrix, SymmGroup > const &mps2)
truncation_results svd_truncate(block_matrix< Matrix, SymmGroup > const &M, block_matrix< Matrix, SymmGroup > &U, block_matrix< Matrix, SymmGroup > &V, block_matrix< DiagMatrix, SymmGroup > &S, double rel_tol, std::size_t Mmax, bool verbose=true)
void make_left_paired() const
Index< SymmGroup > const & col_dim() const
declaration of the TwoSiteTensor class
declaration of the MPSTensor class
boost::tuple< MPSTensor< Matrix, SymmGroup >, MPSTensor< Matrix, SymmGroup >, truncation_results > split_mps_l2r(std::size_t Mmax, double cutoff) const
Index< SymmGroup > const & right_basis() const
algorithms for block_matrix (gemm, svd, etc.)
functions to reshape the representation of data in MPSTensor
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
boost::tuple< MPSTensor< Matrix, SymmGroup >, MPSTensor< Matrix, SymmGroup >, truncation_results > split_mps_r2l(std::size_t Mmax, double cutoff) const
void make_both_paired() const
Index< SymmGroup > const & left_basis() const
block_matrix< Matrix, SymmGroup > & data()