mps-0.0.0
MatrixProductStatesinC++
 All Data Structures Namespaces Functions Variables Enumerations Enumerator Groups Pages
mps_canonical_z.cc
1 // -*- mode: c++; fill-column: 80; c-basic-offset: 2; indent-tabs-mode: nil -*-
2 /*
3  Copyright (c) 2010 Juan Jose Garcia Ripoll
4 
5  Tensor is free software; you can redistribute it and/or modify it
6  under the terms of the GNU Library General Public License as published
7  by the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Library General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #include <algorithm>
21 #include <mps/mps.h>
22 #include "mps_canonical.cc"
23 
24 namespace mps {
25 
26  void set_canonical(CMPS &psi, index site, const CTensor &t,
27  int sense, bool truncate)
28  {
29  set_canonical_inner(psi, site, t, sense, truncate);
30  }
31 
32  const CMPS canonical_form(const CMPS &psi, int sense)
33  {
34  return canonical_form_at(psi, (sense < 0)? 0 : (psi.size()-1));
35  }
36 
37  const CMPS normal_form(const CMPS &psi, int sense)
38  {
39  return normal_form_at(psi, (sense < 0)? 0 : (psi.size()-1));
40  }
41 
42  const CMPS canonical_form_at(const CMPS &psi, index site)
43  {
44  return either_form_inner(psi, site, false);
45  }
46 
47  const CMPS normal_form_at(const CMPS &psi, index site)
48  {
49  return either_form_inner(psi, site, true);
50  }
51 
52 }
const RMPS canonical_form_at(const RMPS &psi, index site)
Rewrite a RMPS in canonical form on both sides of 'site'.
Real matrix product structure.
Definition: cmps.h:31
const RMPS canonical_form(const RMPS &psi, int sense=-1)
Rewrite a RMPS in canonical form.
bool truncate(RMPS *P, const RMPS &Q, index Dmax, bool periodicbc, bool increase=false)
Given an MPS, produce another with bond dimension <= Dmax, by truncating it.
void set_canonical(RMPS &psi, index site, const RTensor &A, int sense, bool truncate=true)
Store a tensor in a matrix product state in the canonical form.
const RMPS normal_form(const RMPS &psi, int sense=-1)
Rewrite a RMPS in canonical form, normalizing.
const RMPS normal_form_at(const RMPS &psi, index site)
Rewrite a RMPS in canonical form, normalizing.