ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
reduced_mps.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 Bela Bauer <bauerb@phys.ethz.ch>
7  * 2011-2013 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 REDUCED_MPS_H
29 #define REDUCED_MPS_H
30 
31 #include "dmrg/mp_tensors/mps.h"
34 
35 template <class Matrix, class SymmGroup>
37 {
38  typedef typename SymmGroup::subcharge subcharge;
39 public:
41  : mps(mps_)
42  , L(mps.length())
43  , left_(L)
44  , right_(L)
45  , initialized(false)
46  { }
47 
48  void init() const
49  {
50  // init right_ & left_
51  Boundary<Matrix, SymmGroup> right = mps.right_boundary(), left = mps.left_boundary();
52  right_[L-1] = right;
53  left_[0] = left;
54  for (int i = 1; i < L; ++i) {
55  {
57  ident.set(0, 0, identity_matrix<Matrix>(mps[L-i].site_dim()));
58  right = contraction::overlap_mpo_right_step(mps[L-i], mps[L-i], right, ident);
59  right_[L-1-i] = right;
60  }
61  {
63  ident.set(0, 0, identity_matrix<Matrix>(mps[i-1].site_dim()));
64  left = contraction::overlap_mpo_left_step(mps[i-1], mps[i-1], left, ident);
65  left_[i] = left;
66  }
67  }
68  initialized = true;
69  }
70 
71  const Boundary<Matrix, SymmGroup> & left(int i) const
72  {
73  if (!initialized) init();
74  return left_[i];
75  }
76 
77  const Boundary<Matrix, SymmGroup> & right(int i) const
78  {
79  if (!initialized) init();
80  return right_[i];
81  }
82 
83 private:
84  const MPS<Matrix, SymmGroup> & mps;
85  int L;
86  mutable std::vector<Boundary<Matrix, SymmGroup> > left_, right_;
87  mutable bool initialized;
88 };
89 
90 #endif
void set(index_type li, index_type ri, op_t const &op, value_type scale_=1.0)
Definition: mpotensor.hpp:106
declaration of the MPS class (vector of MPSTensor)
const Boundary< Matrix, SymmGroup > & right(int i) const
Definition: reduced_mps.h:77
static Boundary< OtherMatrix, SymmGroup > overlap_mpo_right_step(MPSTensor< Matrix, SymmGroup > const &bra_tensor, MPSTensor< Matrix, SymmGroup > const &ket_tensor, Boundary< OtherMatrix, SymmGroup > const &right, MPOTensor< Matrix, SymmGroup > const &mpo)
Definition: contractions.h:386
void init() const
Definition: reduced_mps.h:48
const Boundary< Matrix, SymmGroup > & left(int i) const
Definition: reduced_mps.h:71
reduced_mps(const MPS< Matrix, SymmGroup > &mps_)
Definition: reduced_mps.h:40
Definition: mps.h:40
declaration of MPOTensor object
static Boundary< OtherMatrix, SymmGroup > overlap_mpo_left_step(MPSTensor< Matrix, SymmGroup > const &bra_tensor, MPSTensor< Matrix, SymmGroup > const &ket_tensor, Boundary< OtherMatrix, SymmGroup > const &left, MPOTensor< Matrix, SymmGroup > const &mpo)
Definition: contractions.h:340
functions to contract tensor network states