Xped
Loading...
Searching...
No Matches
hash.hpp
Go to the documentation of this file.
1#ifndef HASH_H_
2#define HASH_H_
3
4#include <boost/functional/hash.hpp>
5
7
8// forward declaration
9namespace Xped {
10template <std::size_t Rank, typename Symmetry>
11struct FusionTree;
12
13namespace util {
14struct Permutation;
15}
16} // namespace Xped
17
18template <std::size_t Nq>
19struct std::hash<Xped::qarray<Nq>>
20{
21 inline std::size_t operator()(const Xped::qarray<Nq>& ix) const
22 {
23 std::size_t seed = 0;
24 boost::hash_combine(seed, ix);
25 return seed;
26 }
27};
28
30template <std::size_t Nq, std::size_t Nlegs>
31struct std::hash<std::array<Xped::qarray<Nq>, Nlegs>>
32{
33 inline std::size_t operator()(const std::array<Xped::qarray<Nq>, Nlegs>& ix) const
34 {
35 std::size_t seed = 0;
36 boost::hash_combine(seed, ix);
37 return seed;
38 }
39};
40
41template <std::size_t Rank, typename Symmetry>
42struct std::hash<Xped::FusionTree<Rank, Symmetry>>
43{
44 inline std::size_t operator()(const Xped::FusionTree<Rank, Symmetry>& ix) const
45 {
46 std::size_t seed = 0;
47 boost::hash_combine(seed, ix);
48 return seed;
49 }
50};
51
52template <std::size_t Rank, std::size_t CoRank, typename Symmetry>
53struct std::hash<std::pair<Xped::FusionTree<Rank, Symmetry>, Xped::FusionTree<CoRank, Symmetry>>>
54{
55 inline std::size_t operator()(const std::pair<Xped::FusionTree<Rank, Symmetry>, Xped::FusionTree<CoRank, Symmetry>>& ix) const
56 {
57 std::size_t seed = 0;
58 boost::hash_combine(seed, ix.first);
59 boost::hash_combine(seed, ix.second);
60 return seed;
61 }
62};
63
64template <std::size_t Rank, std::size_t CoRank, typename Symmetry>
65struct std::hash<std::tuple<Xped::FusionTree<Rank, Symmetry>, Xped::FusionTree<CoRank, Symmetry>, Xped::util::Permutation>>
66{
67 inline std::size_t
69 {
70 std::size_t seed = 0;
71 boost::hash_combine(seed, std::get<0>(ix));
72 boost::hash_combine(seed, std::get<1>(ix));
73 boost::hash_combine(seed, std::get<2>(ix));
74 return seed;
75 }
76};
77
78#endif
Definition: bench.cpp:62
Definition: FusionTree.hpp:24
Definition: qarray.hpp:30
Definition: Permutations.hpp:40