ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
u1.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  *
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 SYMMETRY_U1_H
28 #define SYMMETRY_U1_H
29 
30 #include <iostream>
31 #include <vector>
32 
33 #include <boost/functional/hash.hpp>
34 
35 #include <boost/serialization/serialization.hpp>
36 #include <boost/serialization/array.hpp>
37 
38 
39 class U1
40 {
41 public:
42  typedef int charge;
43  typedef int subcharge;
44 
45  static const charge IdentityCharge = 0;
46  static const bool finite = false;
47 
48  static charge fuse(charge a, charge b) { return a + b; }
49 
50  template<int R> static charge fuse(const boost::array<charge, R> &v)
51  {
52  charge ret = 0;
53  for (int i = 0; i < R; i++)
54  ret += v[i];
55  return ret;
56  }
57 };
58 
59 template <class Archive>
60 inline void serialize(Archive & ar, U1::charge & c, const unsigned int version)
61 {
62  ar & c;
63 }
64 
65 #endif
static charge fuse(charge a, charge b)
Definition: u1.h:48
Definition: u1.h:39
static const charge IdentityCharge
Definition: u1.h:45
int charge
Definition: u1.h:42
int subcharge
Definition: u1.h:43
static const bool finite
Definition: u1.h:46
void serialize(Archive &ar, U1::charge &c, const unsigned int version)
Definition: u1.h:60
static charge fuse(const boost::array< charge, R > &v)
Definition: u1.h:50