Go to the documentation of this file.
2 #ifndef __array2D_hpp__
3 #define __array2D_hpp__
10 template<
typename T,
size_t nRow,
size_t nCol>
28 constexpr
size_t size()const noexcept
34 constexpr
size_t nCols()const noexcept
39 constexpr
size_t nRows()const noexcept
46 template<
typename T,
size_t nRow,
size_t nCol>
53 for(
size_t i=0; i<nRow; i++)
54 for(
size_t j=0; j<nCol; j++)
55 res(i,j)= arr1(i,j)+arr2(i,j);
59 template<
typename T,
size_t nRow,
size_t nCol>
66 for(
size_t i=0; i<nRow; i++)
67 for(
size_t j=0; j<nCol; j++)
68 res(i,j)= arr1(i,j)-arr2(i,j);
72 template<
typename T,
size_t nRow,
size_t nCol>
79 for(
size_t i=0; i<nRow; i++)
80 for(
size_t j=0; j<nCol; j++)
81 res(i,j)= arr1(i,j)*arr2(i,j);
85 template<
typename T,
size_t nRow,
size_t nCol>
92 for(
size_t i=0; i<nRow; i++)
93 for(
size_t j=0; j<nCol; j++)
94 res(i,j)= s*arr2(i,j);
98 template<
typename T,
size_t nRow,
size_t nCol>
105 for(
size_t i=0; i<nRow; i++)
106 for(
size_t j=0; j<nCol; j++)
107 res(i,j)= arr1(i,j)/arr2(i,j);
111 template<
typename T,
size_t nRow,
size_t nCol>
118 for(
size_t i=0; i<nRow; i++)
119 for(
size_t j=0; j<nCol; j++)
120 res(i,j)= val/arr2(i,j);
124 template <
typename T,
size_t nRow,
size_t nInner,
size_t nCol >
125 array2D<T, nRow, nCol>
132 for (
size_t row = 0; row < nRow; row++)
134 for (
size_t col = 0; col < nCol; col++)
137 for (
size_t inner = 0; inner < nInner; inner++)
139 sum += A(row,inner) * B(inner,col);
148 template<
typename T,
size_t nRow,
size_t nCol>
149 array2D<T, nCol, nRow>
154 for(
size_t i=0; i<nRow; i++)
156 for(
size_t j=0; j<nCol; j++)
158 tArr(j,i) = arr(i,j);
164 template<
typename T,
size_t nRow,
size_t nCol>
168 for(
size_t i=0; i<nRow; i++)
171 for(
size_t j=0; j<nCol-1; j++)
177 os<<arr(i,nCol-1)<<
"]\n";
179 os<<arr(i,nCol-1)<<
"]";
188 #endif //__array2D_hpp__
constexpr size_t nCols() const noexcept
constexpr size_t nRows() const noexcept
constexpr size_t size() const noexcept
array2D< T, nCol, nRow > transpose(const array2D< T, nRow, nCol > &arr)
fileSystem operator/(const fileSystem &fs1, const fileSystem &fs2)
array2D< T, nRow, nCol > operator-(const array2D< T, nRow, nCol > &arr1, const array2D< T, nRow, nCol > &arr2)
const T & operator()(size_t i, size_t j) const noexcept
array2D< T, nRow, nCol > MatMul(const array2D< T, nRow, nInner > &A, const array2D< T, nInner, nCol > &B)
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
T sum(const Vector< T, Allocator > &v)
array2D< T, nRow, nCol > operator*(const array2D< T, nRow, nCol > &arr1, const array2D< T, nRow, nCol > &arr2)
T & operator()(size_t i, size_t j) noexcept
Interface class for any output stream.
message operator+(message::EVENT evnt1, message::EVENT evnt2)