ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
twositetensor.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * ALPS MPS DMRG Project
4  *
5  * Copyright (C) 2013 Institute for Theoretical Physics, ETH Zurich
6  * 2011-2011 by Sebastian Keller <sebkelle@phys.ethz.ch>
7  * Michele Dolfi <dolfim@phys.ethz.ch>
8  *
9  * This software is part of the ALPS Applications, published under the ALPS
10  * Application License; you can use, redistribute it and/or modify it under
11  * the terms of the license, either version 1 or (at your option) any later
12  * version.
13  *
14  * You should have received a copy of the ALPS Application License along with
15  * the ALPS Applications; see the file LICENSE.txt. If not, the license is also
16  * available from http://alps.comp-phys.org/.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
21  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
22  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  *
26  *****************************************************************************/
27 
28 #ifndef TWOSITETENSOR_H
29 #define TWOSITETENSOR_H
30 
37 
38 #include <iostream>
39 #include <algorithm>
40 
42 
43 template<class Matrix, class SymmGroup>
44 class TwoSiteTensor
45 {
46 public:
47  typedef std::size_t size_type;
50 
52  MPSTensor<Matrix, SymmGroup> const & mps2);
53 
55 
56  Index<SymmGroup> const & site_dim() const;
57  Index<SymmGroup> const & row_dim() const;
58  Index<SymmGroup> const & col_dim() const;
59 
61  block_matrix<Matrix, SymmGroup> const & data() const;
62 
63  template<class Matrix_, class SymmGroup_>
64  friend std::ostream& operator<<(std::ostream&, TwoSiteTensor<Matrix_, SymmGroup_> const &);
65 
66  TwoSiteTensor<Matrix, SymmGroup> & operator << ( MPSTensor<Matrix, SymmGroup> const & rhs);
67 
68  void make_left_paired() const;
69  void make_both_paired() const;
70  void make_right_paired() const;
71 
73 
74  boost::tuple<MPSTensor<Matrix, SymmGroup>, MPSTensor<Matrix, SymmGroup>, truncation_results>
75  split_mps_l2r(std::size_t Mmax, double cutoff) const;
76 
77  boost::tuple<MPSTensor<Matrix, SymmGroup>, MPSTensor<Matrix, SymmGroup>, truncation_results>
78  split_mps_r2l(std::size_t Mmax, double cutoff) const;
79 
80  void swap_with(TwoSiteTensor & b);
81 
82  friend void swap(TwoSiteTensor & a, TwoSiteTensor & b)
83  {
84  a.swap_with(b);
85  }
86 
87  template<class Archive> void load(Archive & ar);
88  template<class Archive> void save(Archive & ar) const;
89 
90 private:
92  set_id left_paired;
93  set_id right_paired;
94  set_id both_paired;
95 
96  Index<SymmGroup> phys_i, phys_i_left, phys_i_right, left_i, right_i;
97  mutable block_matrix<Matrix, SymmGroup> data_;
98  mutable TwoSiteStorageLayout cur_storage;
99  Indicator cur_normalization;
100 };
101 
102 #include "twositetensor.hpp"
103 
104 #include "ts_ops.h"
105 
106 #endif
Index< SymmGroup > const & site_dim() const
definition of the TwoSiteTensor class
void swap_with(TwoSiteTensor &b)
Index< SymmGroup > const & row_dim() const
std::size_t set_id
Definition: multi_index.h:150
MPSTensor< Matrix, SymmGroup > make_mps() const
void save(Archive &ar) const
declaration of block_matrix class
void make_right_paired() const
std::size_t size_type
Definition: twositetensor.h:47
TwoSiteStorageLayout
Definition: twositetensor.h:41
block_matrix< Matrix, SymmGroup > & data()
MultiIndex< SymmGroup >::set_id set_id
Definition: twositetensor.h:49
TwoSiteTensor(MPSTensor< Matrix, SymmGroup > const &mps1, MPSTensor< Matrix, SymmGroup > const &mps2)
include one of the Index class definitions
void make_left_paired() const
Index< SymmGroup > const & col_dim() const
MultiIndex< SymmGroup >::index_id index_id
Definition: twositetensor.h:48
declaration of the MPSTensor class
functions to operate on TwoSiteTensor
boost::tuple< MPSTensor< Matrix, SymmGroup >, MPSTensor< Matrix, SymmGroup >, truncation_results > split_mps_l2r(std::size_t Mmax, double cutoff) const
declaration of MPOTensor object
algorithms for block_matrix (gemm, svd, etc.)
friend void swap(TwoSiteTensor &a, TwoSiteTensor &b)
Definition: twositetensor.h:82
std::size_t index_id
Definition: multi_index.h:143
void load(Archive &ar)
boost::tuple< MPSTensor< Matrix, SymmGroup >, MPSTensor< Matrix, SymmGroup >, truncation_results > split_mps_r2l(std::size_t Mmax, double cutoff) const
Indicator
Definition: mpstensor.h:40
void make_both_paired() const