1#ifndef STRAWBERRY_QARRAY
2#define STRAWBERRY_QARRAY
12#include <boost/functional/hash.hpp>
14#include "yas/serialize.hpp"
15#include "yas/std_types.hpp"
34 for(
size_t q = 0; q < Nq; ++q) {
data[q] = 0; }
38 constexpr qarray(
const std::array<int, Nq>& in)
43 assert(in.size() == Nq);
44 std::copy(in.begin(), in.end(),
data.begin());
48 qarray(std::initializer_list<int> a) { std::copy(a.begin(), a.end(),
data.data()); }
59 std::array<int, Nq> dists;
60 for(
size_t i = 0; i < Nq; i++) { dists[i] = abs(this->data[i] - other[i]); }
61 return *std::max_element(std::begin(dists), std::end(dists));
67 for(
size_t q = 0; q < Nq; ++q) { boost::hash_combine(seed, qin.
data[q]); }
72 template <
typename Ar>
75 ar& YAS_OBJECT_NVP(
"qarray", (
"data",
data));
123 transform(a1.
data.begin(), a1.
data.end(), a2.
data.begin(), aout.
data.begin(), std::plus<int>());
132 transform(a1.
data.begin(), a1.
data.end(), a2.
data.begin(), aout.
data.begin(), std::minus<int>());
141 for(
size_t q = 0; q < Nq; ++q) { aout[q] = alpha * a[q]; }
146template <std::
size_t Nq1, std::
size_t Nq2>
151 out.
data = new_array;
155template <std::
size_t Nq1, std::
size_t Nq2, std::
size_t Nql>
159 memcpy(lhs.
data.data(), large_arr.
data.data(), Nq1 *
sizeof(
int));
162 memcpy(rhs.
data.data(), large_arr.
data.data() + Nq1, Nq2 *
sizeof(
int));
164 return std::make_pair(lhs, rhs);
171 for(
size_t q = 0; q < Nq; ++q) {
173 if(q != Nq - 1) { os <<
","; }
192 for(
size_t q = 0; q < Nq; ++q) { aout[q] = std::numeric_limits<int>::max(); }
200 for(
size_t q = 0; q < Nq; ++q) { aout[q] = -std::numeric_limits<int>::max(); }
constexpr std::array< T, LL+RL > join(const std::array< T, LL > rhs, const std::array< T, RL > lhs, detail::num_tuple< LLs... >, detail::num_tuple< RLs... >)
Definition: JoinArray.hpp:41
constexpr qarray< Nq1+Nq2 > join(qarray< Nq1 > rhs, qarray< Nq2 > lhs)
Definition: qarray.hpp:147
qarray< Nq > qminusinf()
Definition: qarray.hpp:197
bool operator>(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
Definition: qarray.hpp:113
std::array< qarray< Nq >, 4 > qarray4
Definition: qarray.hpp:84
bool operator<=(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
Definition: qarray.hpp:98
bool operator!=(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
Definition: qarray.hpp:93
XTensor< TRACK, Scalar, Rank, CoRank, Symmetry > operator-(const Tensor< Scalar, Rank, CoRank, Symmetry, true > &t, Scalar s)
Definition: ADTensor.hpp:428
XTensor< TRACK, Scalar, Rank, CoRank, Symmetry > operator+(const Tensor< Scalar, Rank, CoRank, Symmetry, true > &t, Scalar s)
Definition: ADTensor.hpp:440
XTensor< TRACK, Scalar, Rank, CoRank, Symmetry > operator*(const Tensor< Scalar, Rank, CoRank, Symmetry, true > &t, Scalar s)
Definition: ADTensor.hpp:452
qarray< Nq > qplusinf()
**Constructs the vacuum (all quantum numbers equal to zero).*/
Definition: qarray.hpp:189
bool operator>=(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
Definition: qarray.hpp:103
std::ostream & operator<<(std::ostream &os, const FusionTree< depth, Symmetry > &tree)
Definition: FusionTree.hpp:93
std::array< qarray< Nq >, 2 > qarray2
Definition: qarray.hpp:80
std::array< qarray< Nq >, 3 > qarray3
Definition: qarray.hpp:82
bool operator<(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
Definition: qarray.hpp:108
std::pair< qarray< Nq1 >, qarray< Nq2 > > disjoin(const qarray< Nql > &large_arr)
Definition: qarray.hpp:156
bool operator==(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
Definition: qarray.hpp:88
Definition: qarray.hpp:30
qarray(std::initializer_list< int > a)
Definition: qarray.hpp:48
std::array< int, Nq > data
Definition: qarray.hpp:50
qarray(const std::vector< int > &in)
Definition: qarray.hpp:41
friend std::size_t hash_value(const qarray< Nq > &qin)
Definition: qarray.hpp:64
constexpr qarray()
Definition: qarray.hpp:32
int & operator()(size_t i)
Definition: qarray.hpp:53
constexpr qarray(const std::array< int, Nq > &in)
Definition: qarray.hpp:38
int & operator[](size_t i)
Definition: qarray.hpp:52
const int & operator()(size_t i) const
Definition: qarray.hpp:55
int distance(const qarray< Nq > &other)
Definition: qarray.hpp:57
const int & operator[](size_t i) const
Definition: qarray.hpp:54
void serialize(Ar &ar)
Definition: qarray.hpp:73