4#include <unordered_map>
6#include "yas/serialize.hpp"
7#include "yas/std_types.hpp"
16constexpr std::size_t
inter_dim(std::size_t Rank) {
return (Rank == 1 or Rank == 0) ? 0 : Rank - 2; }
17constexpr std::size_t
mult_dim(std::size_t Rank) {
return (Rank == 0) ? 0 : Rank - 1; }
18constexpr std::size_t
numberOfVertices(std::size_t Rank) {
return (Rank == 0) ? 0 : Rank - 1; }
19constexpr std::size_t
numberOfInnerlines(std::size_t Rank) {
return (Rank == 1 or Rank == 0) ? 0 : Rank - 2; }
22template <std::
size_t Rank,
typename Symmetry>
25 typedef typename Symmetry::qType
qType;
26 typedef typename Symmetry::Scalar
Scalar;
31 std::array<size_t, Rank>
dims{};
34 std::array<size_t, util::mult_dim(Rank)>();
37 template <
typename Ar>
40 ar& YAS_OBJECT_NVP(
"FusionTree",
50 inline void computeDim() {
dim = std::accumulate(
dims.begin(),
dims.end(), 1ul, std::multiplies<std::size_t>()); }
65 boost::hash_combine(seed, tree.
q_coupled);
67 boost::hash_combine(seed, tree.
IS_DUAL);
69 boost::hash_combine(seed, tree.
dims);
73 std::string
printTree(
const std::array<std::string, Rank>& s_uncoupled,
75 const std::string& s_coupled,
76 const std::array<std::string,
util::mult_dim(Rank)>& s_multiplicities)
const;
78 std::string
draw()
const;
80 std::string
print()
const;
82 template <
typename PlainLib>
89 std::unordered_map<FusionTree<Rank, Symmetry>,
typename Symmetry::Scalar>
swap(
const std::size_t& pos)
const;
92template <std::
size_t depth,
typename Symmetry>
101#ifndef XPED_COMPILED_LIB
XpedWorld & getUniverse()
Definition: Mpi.hpp:49
constexpr std::size_t inter_dim(std::size_t Rank)
Definition: FusionTree.hpp:16
constexpr std::size_t mult_dim(std::size_t Rank)
Definition: FusionTree.hpp:17
constexpr std::size_t numberOfVertices(std::size_t Rank)
Definition: FusionTree.hpp:18
constexpr std::size_t numberOfInnerlines(std::size_t Rank)
Definition: FusionTree.hpp:19
CTF::Tensor< Scalar > TType
Definition: PlainInterface_Cyclops_impl.cpp:13
std::ostream & operator<<(std::ostream &os, const FusionTree< depth, Symmetry > &tree)
Definition: FusionTree.hpp:93
Definition: FusionTree.hpp:24
FusionTree< Rank+1, Symmetry > enlarge(const FusionTree< 1, Symmetry > &other) const
Definition: FusionTree.cpp:305
void computeIntermediates()
Definition: FusionTree.cpp:132
Symmetry::Scalar Scalar
Definition: FusionTree.hpp:26
std::string printTree(const std::array< std::string, Rank > &s_uncoupled, const std::array< std::string, util::inter_dim(Rank)> &s_intermediates, const std::string &s_coupled, const std::array< std::string, util::mult_dim(Rank)> &s_multiplicities) const
Definition: FusionTree.cpp:410
std::unordered_map< FusionTree< Rank, Symmetry >, typename Symmetry::Scalar > swap(const std::size_t &pos) const
Definition: FusionTree.cpp:350
friend std::size_t hash_value(const FusionTree< Rank, Symmetry > &tree)
Definition: FusionTree.hpp:61
std::array< bool, Rank > IS_DUAL
Definition: FusionTree.hpp:35
std::string draw() const
Definition: FusionTree.cpp:83
bool operator==(const FusionTree< Rank, Symmetry > &other) const
Definition: FusionTree.cpp:62
std::array< qType, Rank > q_uncoupled
Definition: FusionTree.hpp:28
std::size_t dim
Definition: FusionTree.hpp:30
std::unordered_map< FusionTree< Rank, Symmetry >, typename Symmetry::Scalar > permute(const util::Permutation &p) const
Definition: FusionTree.cpp:322
void computeDim()
Definition: FusionTree.hpp:50
void serialize(Ar &ar)
Definition: FusionTree.hpp:38
std::array< size_t, Rank > dims
Definition: FusionTree.hpp:31
std::array< qType, util::inter_dim(Rank)> q_intermediates
Definition: FusionTree.hpp:32
std::array< size_t, util::mult_dim(Rank)> multiplicities
Definition: FusionTree.hpp:33
PlainLib::template TType< Scalar, Rank+1 > asTensor(const mpi::XpedWorld &world=mpi::getUniverse()) const
std::string print() const
Definition: FusionTree.cpp:117
bool operator>(const FusionTree< Rank, Symmetry > &other) const
Definition: FusionTree.cpp:22
qType q_coupled
Definition: FusionTree.hpp:29
Symmetry::qType qType
Definition: FusionTree.hpp:25
bool operator!=(const FusionTree< Rank, Symmetry > &other) const
Definition: FusionTree.hpp:59
bool operator<(const FusionTree< Rank, Symmetry > &other) const
Definition: FusionTree.cpp:28
Definition: Permutations.hpp:40