37 ARTS_ASSERT(0 <= x); \
38 ARTS_ASSERT(x < m##x##r.mextent)
39#define OFFSET(x) m##x##r.mstart + x* m##x##r.mstride
169 [[nodiscard]]
bool empty() const noexcept {
return size() == 0; }
557 return get(
v, s,
b, p, r,
c);
640 using ConstTensor6View::operator();
1016#define GETFUN(v, s, b, p, r, c) \
1017 *(mdata + OFFSET(v) + OFFSET(s) + OFFSET(b) + OFFSET(p) + OFFSET(r) + \
1107 static constexpr bool matpack_type{
true};
1129 if (
const auto s = matpack::shape<Index, 6>(init);
shape().data not_eq s)
1130 resize(s[0], s[1], s[2], s[3], s[4], s[5]);
1132 auto [I, J, K, L,
M,
N] =
shape().data;
1133 for (
Index i = 0; i < I; i++)
1134 for (
Index j = 0; j < J; j++)
1135 for (
Index k = 0; k < K; k++)
1136 for (
Index x = 0; x < L; x++)
1137 for (
Index m = 0; m <
M; m++)
1138 for (
Index n = 0; n <
N; n++)
1139 operator()(i, j, k, x, m, n) = init(i, j, k, x, m, n);
1165 ARTS_ASSERT(not(r0.get_extent() < 0),
"Must have size");
1166 ARTS_ASSERT(not(r1.get_extent() < 0),
"Must have size");
1167 ARTS_ASSERT(not(r2.get_extent() < 0),
"Must have size");
1168 ARTS_ASSERT(not(r3.get_extent() < 0),
"Must have size");
1169 ARTS_ASSERT(not(r4.get_extent() < 0),
"Must have size");
1170 ARTS_ASSERT(not(r5.get_extent() < 0),
"Must have size");
1188 template <std::
size_t dim0>
1190 static_assert(dim0 < 6,
"Bad Dimension, Out-of-Bounds");
1197 : dim0 == 4 ?
nrows()
1202 "Can only reduce size on same size input");
1208 template <std::
size_t dim0, std::
size_t dim1>
1210 static_assert(dim1 < 6,
"Bad Dimension, Out-of-Bounds");
1211 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
1217 : dim1 == 4 ?
nrows()
1229 "Can only reduce size on same size input");
1235 template <std::
size_t dim0, std::
size_t dim1, std::
size_t dim2>
1237 static_assert(dim2 < 6,
"Bad Dimension, Out-of-Bounds");
1238 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
1239 static_assert(dim1 < dim2,
"Bad Dimensions, dim2 must be larger than dim1");
1244 : dim2 == 4 ?
nrows()
1261 "Can only reduce size on same size input");
1267 template <std::size_t dim0,
1272 static_assert(dim3 < 6,
"Bad Dimension, Out-of-Bounds");
1273 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
1274 static_assert(dim1 < dim2,
"Bad Dimensions, dim2 must be larger than dim1");
1275 static_assert(dim2 < dim3,
"Bad Dimensions, dim3 must be larger than dim2");
1296 "Can only reduce size on same size input");
1302 template <std::size_t dim0,
1308 static_assert(dim4 < 6,
"Bad Dimension, Out-of-Bounds");
1309 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
1310 static_assert(dim1 < dim2,
"Bad Dimensions, dim2 must be larger than dim1");
1311 static_assert(dim2 < dim3,
"Bad Dimensions, dim3 must be larger than dim2");
1312 static_assert(dim3 < dim4,
"Bad Dimensions, dim4 must be larger than dim3");
1328 "Can only reduce size on same size input");
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
This can be used to make arrays out of anything.
Const version of Iterator6D.
ConstTensor5View msv
Current position.
const ConstTensor5View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
ConstIterator6D()=default
Default constructor.
ConstIterator6D(ConstTensor5View x, Index stride)
Explicit constructor.
ConstIterator6D & operator++()
Prefix increment operator.
const ConstTensor5View & operator*() const
Dereferencing.
bool operator!=(const ConstIterator6D &other) const
Not equal operator, needed for algorithms like copy.
Const version of Iterator7D.
A constant view of a Matrix.
Index size() const noexcept
A constant view of a Tensor3.
Index size() const noexcept
A constant view of a Tensor4.
Index size() const noexcept
A constant view of a Tensor5.
Range mpr
The page range of mdata that is actually used.
Range mcr
The column range of mdata that is actually used.
Numeric * mdata
Pointer to the plain C array that holds the data.
Index size() const noexcept
Range mbr
The book range of mdata that is actually used.
Range msr
The shelf range of mdata that is actually used.
Range mrr
The row range of mdata that is actually used.
A constant view of a Tensor6.
constexpr ConstTensor6View(ConstTensor6View &&)=default
ConstIterator6D begin() const
Return const iterator to first sub-tensor.
ConstTensor6View & operator=(ConstTensor6View &&)=default
ConstIterator6D end() const
Return const iterator behind last sub-tensor.
virtual ~ConstTensor6View()=default
Range mvr
The vitrine range of mdata that is actually used.
Range mcr
The column range of mdata that is actually used.
Range mbr
The book range of mdata that is actually used.
Numeric * mdata
Pointer to the plain C array that holds the data.
Range mrr
The row range of mdata that is actually used.
Index size() const noexcept
Index nbooks() const noexcept
Index nvitrines() const noexcept
Numeric get(Index v, Index s, Index b, Index p, Index r, Index c) const
Get element implementation without assertions.
bool empty() const noexcept
ConstTensor6View operator()(const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c) const
Index ncols() const noexcept
constexpr ConstTensor6View(const ConstTensor6View &)=default
friend std::ostream & operator<<(std::ostream &os, const ConstTensor6View &v)
Output operator.
Numeric operator()(Index v, Index s, Index b, Index p, Index r, Index c) const
Index npages() const noexcept
Index nshelves() const noexcept
ConstTensor6View & operator=(const ConstTensor6View &)=default
Range mpr
The page range of mdata that is actually used.
Index nrows() const noexcept
Range msr
The shelf range of mdata that is actually used.
ConstTensor6View()=default
A constant view of a Tensor7.
A constant view of a Vector.
Index size() const noexcept
The outermost iterator class for rank 6 tensors.
Iterator6D & operator++()
Prefix increment operator.
Iterator6D(const Tensor5View &x, Index stride)
Explicit constructor.
bool operator!=(const Iterator6D &other) const
Not equal operator, needed for algorithms like copy.
Tensor5View & operator*()
Dereferencing.
Tensor5View msv
Current position.
Tensor5View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Iterator6D()=default
Default constructor.
Implementation of Tensors of Rank 7.
Index mstart
The start index.
constexpr Index get_extent() const noexcept
Returns the extent of the range.
Index mextent
The number of elements.
Iterator6D end()
Return iterator behind last sub-tensor.
Numeric & operator()(Index v, Index s, Index b, Index p, Index r, Index c)
Iterator6D begin()
Return iterator to first sub-tensor.
Numeric & get(Index v, Index s, Index b, Index p, Index r, Index c)
Get element implementation without assertions.
Tensor6View & operator=(const ConstTensor6View &v)
Assignment operator.
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
constexpr Tensor6View(const Tensor6View &)=default
Tensor6View operator()(const Range &v, const Range &s, const Range &b, const Range &p, const Range &r, const Range &c)
Tensor5 reduce_rank() &&ARTS_NOEXCEPT
Tensor6(Numeric *d, const Range &r0, const Range &r1, const Range &r2, const Range &r3, const Range &r4, const Range &r5) ARTS_NOEXCEPT
Tensor6 & operator=(const matpack::tensor6_like_not_tensor6 auto &init)
Set from a tensor type.
void transform_elementwise(F &&func)
Tensor6(const matpack::tensor6_like_not_tensor6 auto &init)
Initialization from a tensor type.
Tensor3 reduce_rank() &&ARTS_NOEXCEPT
Tensor4 reduce_rank() &&ARTS_NOEXCEPT
Tensor6(Tensor6 &&v) noexcept
Matrix reduce_rank() &&ARTS_NOEXCEPT
A concept precluding Arts types but allowing the tensor-like object.
#define ARTS_ASSERT(condition,...)
void copy(ConstIterator6D origin, const ConstIterator6D &end, Iterator6D target)
Copy data between begin and end to target.
#define CHECK(x)
Implementation of Tensors of Rank 6.
void transform(Tensor6View y, double(&my_func)(double), ConstTensor6View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
Numeric debug_tensor6view_get_elem(Tensor6View &tv, Index v, Index s, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
#define GETFUN(v, s, b, p, r, c)
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
void swap(ComplexVector &v1, ComplexVector &v2) noexcept
Swaps two objects.