1#ifndef STRAWBERRY_QARRAY
2#define STRAWBERRY_QARRAY
12#include "NestedLoopIterator.h"
28 constexpr qarray() {
for (
size_t q=0; q<Nq; ++q) {
data[q] = 0;}};
31 constexpr qarray(
const std::array<int,Nq> &in) :
data(in) {};
34 qarray (std::initializer_list<int> a) {copy(a.begin(), a.end(),
data.data());}
46 for(
size_t i=0; i<Nq; i++) { dists[i] = abs(this->data[i] - other[i]); }
47 return *std::max_element(std::begin(dists), std::end(dists));
51template<
size_t Nq>
using qarray2 = std::array<qarray<Nq>,2>;
52template<
size_t Nq>
using qarray3 = std::array<qarray<Nq>,3>;
53template<
size_t Nq>
using qarray4 = std::array<qarray<Nq>,4>;
68 transform(a1.
data.begin(),a1.
data.end(), a2.
data.begin(), aout.
data.begin(), std::plus<int>());
77 transform(a1.
data.begin(),a1.
data.end(), a2.
data.begin(), aout.
data.begin(), std::minus<int>());
86 for (
size_t q=0; q<Nq; ++q)
94template<std::
size_t Nq1, std::
size_t Nq2>
97 auto new_array = thirdparty::join(rhs.
data, lhs.
data);
103template<std::
size_t Nq1, std::
size_t Nq2, std::
size_t Nql>
107 std::copy(large_arr.
data.begin(),large_arr.
data.begin()+Nq1,lhs.
data.begin());
109 std::copy(large_arr.
data.begin()+Nq1,large_arr.
data.end(),rhs.
data.begin());
110 return make_pair(lhs,rhs);
117 for (
size_t q=0; q<Nq; ++q)
120 if (q!=Nq-1) {os <<
",";}
139 for (
size_t q=0; q<Nq; ++q) {aout[q] = numeric_limits<int>::max();}
147 for (
size_t q=0; q<Nq; ++q) {aout[q] = -numeric_limits<int>::max();}
std::array< qarray< Nq >, 2 > qarray2
bool operator>(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
bool operator<(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
qarray< Nq > operator+(const qarray< Nq > &a1, const qarray< Nq > &a2)
std::array< qarray< Nq >, 3 > qarray3
bool operator<=(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
bool operator>=(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
bool operator!=(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
constexpr qarray< Nq1+Nq2 > join(qarray< Nq1 > rhs, qarray< Nq2 > lhs)
std::array< qarray< Nq >, 4 > qarray4
std::pair< qarray< Nq1 >, qarray< Nq2 > > disjoin(const qarray< Nql > &large_arr)
qarray< Nq > qplusinf()
**Constructs the vacuum (all quantum numbers equal to zero).*/
qarray< Nq > operator-(const qarray< Nq > &a1, const qarray< Nq > &a2)
bool operator==(const qarray< Nq > &lhs, const qarray< Nq > &rhs)
std::ostream & operator<<(std::ostream &os, const qarray< Nq > &a)
qarray< Nq > operator*(const size_t &alpha, const qarray< Nq > &a)
std::array< int, Nq > data
constexpr qarray(const std::array< int, Nq > &in)
int distance(const qarray< Nq > &other)
int & operator()(size_t i)
int & operator[](size_t i)
qarray(std::initializer_list< int > a)