6#ifndef __QDP_ARRAYS_H__
7#define __QDP_ARRAYS_H__
30 for(
int i=0; i < s.
size(); ++i)
38 int size()
const {
return d.size();}
52 const std::vector<T>&
ref()
const {
return d;}
55 std::vector<T>&
ref() {
return d;}
69 explicit Array2dO(
int n2,
int n1) {d.resize(n2,n1);}
75 void resize(
int n2,
int n1) {d.resize(n2,n1);}
77 int size()
const {
return d.size1();}
78 int size1()
const {
return d.size1();}
79 int size2()
const {
return d.size2();}
82 int nrows()
const {
return d.size2();}
83 int ncols()
const {
return d.size1();}
95 const T&
operator()(
int i,
int j)
const {
return d(i-1,j-1);}
115 explicit Array3dO(
int n3,
int n2,
int n1) {d.resize(n3,n2,n1);}
121 void resize(
int n3,
int n2,
int n1) {d.resize(n3,n2,n1);}
123 int size()
const {
return d.size1();}
124 int size1()
const {
return d.size1();}
125 int size2()
const {
return d.size2();}
126 int size3()
const {
return d.size3();}
136 template<
typename T1>
143 const T&
operator()(
int i,
int j,
int k)
const {
return d(i-1,j-1,k-1);}
164 explicit Array4dO(
int n4,
int n3,
int n2,
int n1) {d.resize(n4,n3,n2,n1);}
170 void resize(
int n4,
int n3,
int n2,
int n1) {d.resize(n4,n3,n2,n1);}
172 int size()
const {
return d.size1();}
173 int size1()
const {
return d.size1();}
174 int size2()
const {
return d.size2();}
175 int size3()
const {
return d.size3();}
176 int size4()
const {
return d.size4();}
181 template<
typename T1>
185 T&
operator()(
int i,
int j,
int k,
int l) {
return d(i-1,j-1,k-1,l-1);}
188 const T&
operator()(
int i,
int j,
int k,
int l)
const {
return d(i-1,j-1,k-1,l-1);}
209 explicit Array5dO(
int n5,
int n4,
int n3,
int n2,
int n1) {d.resize(n5,n4,n3,n2,n1);}
215 void resize(
int n5,
int n4,
int n3,
int n2,
int n1) {d.resize(n5,n4,n3,n2,n1);}
216 void resize(
int n) {d.resize(n,n,n,n,n);}
217 int size()
const {
return d.size1();}
218 int size1()
const {
return d.size1();}
219 int size2()
const {
return d.size2();}
220 int size3()
const {
return d.size3();}
221 int size4()
const {
return d.size4();}
222 int size5()
const {
return d.size5();}
227 template<
typename T1>
231 T&
operator()(
int i,
int j,
int k,
int l,
int m) {
return d(i-1,j-1,k-1,l-1,m-1);}
234 const T&
operator()(
int i,
int j,
int k,
int l,
int m)
const {
return d(i-1,j-1,k-1,l-1,m-1);}
252 template<
typename T>
257 for(
int i=0; i < d.
size(); ++i)
263 template<
typename T>
268 for(
int i=0; i < c.
size(); ++i)
269 c.
ref()[i] = s * a.
ref()[i];
274 template<
typename T>
279 for(
int i=0; i < c.
size(); ++i)
280 c.
ref()[i] = a.
ref()[i] / s;
288 template<
typename T>
290 Array3dO<T>
operator-(
const Array3dO<T>& a)
298 template<
typename T>
308 template<
typename T>
1d array, with 1-based indices
const std::vector< T > & ref() const
Return ref to underlying array.
Array1dO & operator=(const Array1dO &s)
T & operator[](int i)
Return ref to an element.
Array1dO(const Array1dO &s)
Copy constructor.
Array1dO(const multi1d< T > &s)
Copy constructor from a zero-based array.
Array1dO(const std::vector< T > &s)
Copy constructor from a zero-based array.
void push_back(const T &s1)
Append to a vector - it will grow.
const T & operator[](int i) const
Return const ref to an element.
std::vector< T > & ref()
Return ref to underlying array.
Array2dO< T > & operator=(const T1 &s1)
Equal operator uses underlying = of T.
const multi2d< T > & ref() const
Return ref to underlying array.
multi2d< T > & ref()
Return ref to underlying array.
void resize(int n2, int n1)
const T & operator()(int i, int j) const
Return const ref to an element.
int nrows() const
Another variant on the size of the 2d array.
Array2dO & operator=(const Array2dO &s)
T & operator()(int i, int j)
Return ref to an element.
Array2dO(const Array2dO &s)
Copy constructor.
3d array, with 1-based indices
int leftSize() const
Another variant on the size of the 3d array.
const multi3d< T > & ref() const
Return ref to underlying array.
void resize(int n3, int n2, int n1)
Array3dO(const Array3dO &s)
Copy constructor.
Array3dO(int n3, int n2, int n1)
const T & operator()(int i, int j, int k) const
Return const ref to an element.
T & operator()(int i, int j, int k)
Return ref to an element.
Array3dO< T > & operator=(const T1 &s1)
Equal operator uses underlying = of T.
multi3d< T > & ref()
Return ref to underlying array.
Array3dO & operator=(const Array3dO &s)
Array4dO & operator=(const Array4dO &s)
multi4d< T > & ref()
Return ref to underlying array.
const T & operator()(int i, int j, int k, int l) const
Return const ref to an element.
void resize(int n4, int n3, int n2, int n1)
Array4dO(int n4, int n3, int n2, int n1)
Array4dO(const Array4dO &s)
Copy constructor.
T & operator()(int i, int j, int k, int l)
Return ref to an element.
Array4dO< T > & operator=(const T1 &s1)
Equal operator uses underlying = of T.
const multi4d< T > & ref() const
Return ref to underlying array.
const multi5d< T > & ref() const
Return ref to underlying array.
Array5dO & operator=(const Array5dO &s)
Array5dO(int n5, int n4, int n3, int n2, int n1)
const T & operator()(int i, int j, int k, int l, int m) const
Return const ref to an element.
multi5d< T > & ref()
Return ref to underlying array.
void resize(int n5, int n4, int n3, int n2, int n1)
T & operator()(int i, int j, int k, int l, int m)
Return ref to an element.
Array5dO(const Array5dO &s)
Copy constructor.
Array5dO< T > & operator=(const T1 &s1)
Equal operator uses underlying = of T.
Container for a multi-dimensional 1D array.
int size() const
Size of array.
Container for a multi-dimensional 2D array.
Container for a multi-dimensional 3D array.
Container for a multi-dimensional 4D array.
Container for a multi-dimensional 5D array.
Yet another random number generator.
MakeReturn< BinaryNode< OpMultiply, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpMultiply >::Type_t >::Expression_t operator*(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
MakeReturn< BinaryNode< OpSubtract, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpSubtract >::Type_t >::Expression_t operator-(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
MakeReturn< BinaryNode< OpDivide, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpDivide >::Type_t >::Expression_t operator/(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)