164 [[nodiscard]]
bool empty() const noexcept {
return size() == 0; }
274 return get(s,
b, p, r,
c);
353 using ConstTensor5View::operator();
425#define GETFUN(s, b, p, r, c) \
426 *(mdata + msr.mstart + s * msr.mstride + mbr.mstart + b * mbr.mstride + \
427 mpr.mstart + p * mpr.mstride + mrr.mstart + r * mrr.mstride + mcr.mstart + \
546 if (
const auto s = matpack::shape<Index, 5>(init);
shape().data not_eq s)
547 resize(s[0], s[1], s[2], s[3], s[4]);
549 auto [I, J, K, L,
M] =
shape().data;
550 for (
Index i = 0; i < I; i++)
551 for (
Index j = 0; j < J; j++)
552 for (
Index k = 0; k < K; k++)
553 for (
Index x = 0; x < L; x++)
554 for (
Index m = 0; m <
M; m++)
555 operator()(i, j, k, x, m) = init(i, j, k, x, m);
578 ARTS_ASSERT(not(r0.get_extent() < 0),
"Must have size");
579 ARTS_ASSERT(not(r1.get_extent() < 0),
"Must have size");
580 ARTS_ASSERT(not(r2.get_extent() < 0),
"Must have size");
581 ARTS_ASSERT(not(r3.get_extent() < 0),
"Must have size");
582 ARTS_ASSERT(not(r4.get_extent() < 0),
"Must have size");
600 template <std::
size_t dim0>
602 static_assert(dim0 < 5,
"Bad Dimension, Out-of-Bounds");
608 : dim0 == 3 ?
nrows()
613 "Can only reduce size on same size input");
619 template <std::
size_t dim0, std::
size_t dim1>
621 static_assert(dim1 < 5,
"Bad Dimension, Out-of-Bounds");
622 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
627 : dim1 == 3 ?
nrows()
638 "Can only reduce size on same size input");
644 template <std::
size_t dim0, std::
size_t dim1, std::
size_t dim2>
646 static_assert(dim2 < 5,
"Bad Dimension, Out-of-Bounds");
647 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
648 static_assert(dim1 < dim2,
"Bad Dimensions, dim2 must be larger than dim1");
664 "Can only reduce size on same size input");
670 template <std::size_t dim0,
675 static_assert(dim3 < 5,
"Bad Dimension, Out-of-Bounds");
676 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
677 static_assert(dim1 < dim2,
"Bad Dimensions, dim2 must be larger than dim1");
678 static_assert(dim2 < dim3,
"Bad Dimensions, dim3 must be larger than dim2");
690 "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 Iterator5D.
bool operator!=(const ConstIterator5D &other) const
Not equal operator, needed for algorithms like copy.
ConstIterator5D & operator++()
Prefix increment operator.
const ConstTensor4View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 4D iterators.
const ConstTensor4View & operator*() const
Dereferencing.
ConstTensor4View msv
Current position.
ConstIterator5D(ConstTensor4View x, Index stride)
Explicit constructor.
ConstIterator5D()=default
Default constructor.
Const version of Iterator6D.
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.
Range mrr
The row range of mdata that is actually used.
Range mbr
The book range of mdata that is actually used.
Index size() const noexcept
Range mcr
The column range of mdata that is actually used.
Numeric * mdata
Pointer to the plain C array that holds the data.
Range mpr
The page range of mdata that is actually used.
A constant view of a Tensor5.
virtual ~ConstTensor5View()=default
Destructor.
constexpr ConstTensor5View(ConstTensor5View &&)=default
Numeric get(Index s, Index b, Index p, Index r, Index c) const
Get element implementation without assertions.
Index nrows() const noexcept
ConstTensor5View operator()(const Range &s, const Range &b, const Range &p, const Range &r, const Range &c) const
Const index operator for subrange.
Index ncols() const noexcept
Range mpr
The page range of mdata that is actually used.
Range mcr
The column range of mdata that is actually used.
constexpr ConstTensor5View(const ConstTensor5View &)=default
ConstTensor5View()=default
static constexpr bool matpack_type
Numeric * mdata
Pointer to the plain C array that holds the data.
Index npages() const noexcept
ConstTensor5View & operator=(ConstTensor5View &&)=default
ConstIterator5D end() const
Return const iterator behind last shelf.
ConstTensor5View & operator=(const ConstTensor5View &)=default
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.
Numeric operator()(Index s, Index b, Index p, Index r, Index c) const
Plain const index operator.
Range mrr
The row range of mdata that is actually used.
Index nbooks() const noexcept
Index nshelves() const noexcept
friend std::ostream & operator<<(std::ostream &os, const ConstTensor5View &v)
Output operator.
bool empty() const noexcept
ConstIterator5D begin() const
Return const iterator to first shelf.
A constant view of a Tensor6.
A constant view of a Tensor7.
A constant view of a Vector.
Index size() const noexcept
Implementation of Tensors of Rank 5.
Tensor4View & operator*()
Dereferencing.
Iterator5D()=default
Default constructor.
bool operator!=(const Iterator5D &other) const
Not equal operator, needed for algorithms like copy.
Tensor4View msv
Current position.
Tensor4View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 4D iterators.
Iterator5D & operator++()
Prefix increment operator.
Iterator5D(const Tensor4View &x, Index stride)
Explicit constructor.
The outermost iterator class for rank 6 tensors.
Index mstart
The start index.
constexpr Index get_extent() const noexcept
Returns the extent of the range.
Index mextent
The number of elements.
Numeric & get(Index s, Index b, Index p, Index r, Index c)
Get element implementation without assertions.
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Iterator5D end()
Return iterator behind last shelf.
Numeric & operator()(Index s, Index b, Index p, Index r, Index c)
Plain const index operator.
Tensor5View operator()(const Range &s, const Range &b, const Range &p, const Range &r, const Range &c)
Index operator for subrange.
Iterator5D begin()
Return iterator to first shelf.
Tensor5View & operator=(const ConstTensor5View &v)
Assignment operator.
constexpr Tensor5View(const Tensor5View &)=default
Matrix reduce_rank() &&ARTS_NOEXCEPT
Tensor5(const matpack::tensor5_like_not_tensor5 auto &init)
Initialization from a tensor type.
Tensor5(Numeric *d, const Range &r0, const Range &r1, const Range &r2, const Range &r3, const Range &r4) ARTS_NOEXCEPT
Tensor5(Tensor5 &&v) noexcept
Tensor4 reduce_rank() &&ARTS_NOEXCEPT
void transform_elementwise(F &&func)
Tensor3 reduce_rank() &&ARTS_NOEXCEPT
Tensor5 & operator=(const matpack::tensor5_like_not_tensor5 auto &init)
Set from a tensor type.
A concept precluding Arts types but allowing the tensor-like object.
#define ARTS_ASSERT(condition,...)
void copy(ConstIterator5D origin, const ConstIterator5D &end, Iterator5D target)
Copy data between begin and end to target.
void transform(Tensor5View y, double(&my_func)(double), ConstTensor5View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
Numeric debug_tensor5view_get_elem(Tensor5View &tv, Index s, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
#define GETFUN(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.