ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
grouped_symmetry.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  * 2013-2013 by Michele Dolfi <dolfim@phys.ethz.ch>
7  *
8  * This software is part of the ALPS Applications, published under the ALPS
9  * Application License; you can use, redistribute it and/or modify it under
10  * the terms of the license, either version 1 or (at your option) any later
11  * version.
12  *
13  * You should have received a copy of the ALPS Application License along with
14  * the ALPS Applications; see the file LICENSE.txt. If not, the license is also
15  * available from http://alps.comp-phys.org/.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  *
25  *****************************************************************************/
26 
27 #ifndef MAQUIS_DMRG_BLOCK_MATRIX_GROUPED_SYMMETRY_H
28 #define MAQUIS_DMRG_BLOCK_MATRIX_GROUPED_SYMMETRY_H
29 
32 
33 //// TRAITS
34 
35 template <class SymmGroup>
37 
38 template <>
40  typedef TrivialGroup type;
41 };
42 
43 template <>
45  typedef TwoU1 type;
46 };
47 
48 //// GROUPPING FUNCTIONS
49 
51 {
53 }
54 
56 {
57  TwoU1::charge R;
58  R[0] = c1; R[1] = c2;
59  return R;
60 }
61 
62 template<class SymmGroup>
64  Index<SymmGroup> const & i2)
65 {
66  typedef typename grouped_symmetry<SymmGroup>::type OutSymm;
67 
68  Index<OutSymm> ret;
69  for (typename Index<SymmGroup>::const_iterator it1 = i1.begin(); it1 != i1.end(); ++it1)
70  for (typename Index<SymmGroup>::const_iterator it2 = i2.begin(); it2 != i2.end(); ++it2)
71  {
72  ret.insert(std::make_pair(group(it1->first, it2->first), it1->second*it2->second));
73  }
74  return ret;
75 }
76 
77 
78 #endif
TrivialGroup::charge group(TrivialGroup::charge c1, TrivialGroup::charge c2)
include all symmetry definitions
base_t::const_iterator const_iterator
iterator begin()
Definition: u1.h:39
int charge
Definition: u1.h:42
include one of the Index class definitions
iterator end()
static const charge IdentityCharge
Definition: none.h:44
std::size_t insert(std::pair< charge, std::size_t > const &x)