157 [[nodiscard]]
bool empty() const noexcept {
return size() == 0; }
256 using ConstTensor3View::operator();
273#define GETFUN(p, r, c) \
274 *(mdata + mpr.mstart + p * mpr.mstride + mrr.mstart + r * mrr.mstride + \
275 mcr.mstart + c * mcr.mstride)
373 if (
const auto s = matpack::shape<Index, 3>(init);
shape().data not_eq s)
374 resize(s[0], s[1], s[2]);
376 auto [I, J, K] =
shape().data;
377 for (
Index i = 0; i < I; i++)
378 for (
Index j = 0; j < J; j++)
379 for (
Index k = 0; k < K; k++)
380 operator()(i, j, k) = init(i, j, k);
397 ARTS_ASSERT(not(r0.get_extent() < 0),
"Must have size");
398 ARTS_ASSERT(not(r1.get_extent() < 0),
"Must have size");
399 ARTS_ASSERT(not(r2.get_extent() < 0),
"Must have size");
417 template <std::
size_t dim0>
419 static_assert(dim0 < 3,
"Bad Dimension, Out-of-Bounds");
425 "Can only reduce size on same size input");
431 template <std::
size_t dim0, std::
size_t dim1>
433 static_assert(dim1 < 3,
"Bad Dimension, Out-of-Bounds");
434 static_assert(dim0 < dim1,
"Bad Dimensions, dim1 must be larger than dim0");
441 "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 Iterator3D.
ConstMatrixView msv
Current position.
ConstIterator3D & operator++()
Prefix increment operator.
const ConstMatrixView * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
const ConstMatrixView & operator*() const
Dereferencing.
ConstIterator3D(ConstMatrixView x, Index stride)
Explicit constructor.
bool operator!=(const ConstIterator3D &other) const
Not equal operator, needed for algorithms like copy.
ConstIterator3D()=default
Default constructor.
Const version of Iterator4D.
A constant view of a Matrix.
Range mrr
The row range of mdata that is actually used.
Index size() const noexcept
Numeric * mdata
Pointer to the plain C array that holds the data.
Range mcr
The column range of mdata that is actually used.
A constant view of a Tensor3.
ConstTensor3View operator()(const Range &p, const Range &r, const Range &c) const
Const index operator for subrange.
Numeric get(Index p, Index r, Index c) const
Get element implementation without assertions.
static constexpr bool matpack_type
bool empty() const noexcept
virtual ~ConstTensor3View()=default
Destructor.
Index npages() const
Returns the number of pages.
ConstIterator3D begin() const
Return const iterator to first page.
Numeric * mdata
Pointer to the plain C array that holds the data.
ConstTensor3View & operator=(const ConstTensor3View &)=default
ConstIterator3D end() const
Return const iterator behind last page.
ConstTensor3View()=default
Numeric operator()(Index p, Index r, Index c) const
Plain const index operator.
Range mrr
The row range of mdata that is actually used.
constexpr ConstTensor3View(ConstTensor3View &&)=default
Range mcr
The column range of mdata that is actually used.
Index size() const noexcept
friend std::ostream & operator<<(std::ostream &os, const ConstTensor3View &v)
Output operator.
Index nrows() const
Returns the number of rows.
Range mpr
The page range of mdata that is actually used.
Index ncols() const
Returns the number of columns.
ConstTensor3View & operator=(ConstTensor3View &&)=default
constexpr ConstTensor3View(const ConstTensor3View &)=default
A constant view of a Tensor4.
A constant view of a Tensor5.
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 3.
Iterator3D & operator++()
Prefix increment operator.
Iterator3D(const MatrixView &x, Index stride)
Explicit constructor.
bool operator!=(const Iterator3D &other) const
Not equal operator, needed for algorithms like copy.
MatrixView & operator*()
Dereferencing.
MatrixView msv
Current position.
Iterator3D()=default
Default constructor.
MatrixView * operator->()
The -> operator is needed, so that we can write i->begin() to get the 1D iterators.
Implementation of Tensors of Rank 4.
Index mstart
The start index.
constexpr Index get_extent() const noexcept
Returns the extent of the range.
Index mextent
The number of elements.
Iterator3D begin()
Return iterator to first page.
constexpr Tensor3View(const Tensor3View &)=default
Tensor3View & operator=(const ConstTensor3View &v)
Assignment operator.
Numeric & operator()(Index p, Index r, Index c)
Plain non-const index operator.
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Tensor3View operator()(const Range &p, const Range &r, const Range &c)
Index operator for subrange.
Numeric & get(Index p, Index r, Index c)
Get element implementation without assertions.
Iterator3D end()
Return iterator behind last page.
Matrix reduce_rank() &&ARTS_NOEXCEPT
Tensor3(Tensor3 &&v) noexcept
Tensor3(const matpack::tensor3_like_not_tensor3 auto &init)
Initialization from a tensor type.
Tensor3 & operator=(const matpack::tensor3_like_not_tensor3 auto &init)
Set from a tensor type.
Tensor3(Numeric *d, const Range &r0, const Range &r1, const Range &r2) ARTS_NOEXCEPT
void transform_elementwise(F &&func)
A concept precluding Arts types but allowing the tensor-like object.
#define ARTS_ASSERT(condition,...)
void mult(Tensor3View A, const ConstVectorView B, const ConstMatrixView C)
mult Tensor3
Numeric debug_tensor3view_get_elem(Tensor3View &tv, Index p, Index r, Index c)
Helper function to access tensor elements.
void transform(Tensor3View y, double(&my_func)(double), ConstTensor3View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
void copy(ConstIterator3D origin, const ConstIterator3D &end, Iterator3D target)
Copy data between begin and end to target.
Implementation of Matrix, Vector, and such stuff.
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.