29using std::runtime_error;
42 return ConstTensor5View(
mdata,
msr,
mbr,
mpr,
mrr,
mcr, s,
b, p, r,
c);
703 : msr(0, 1,
a.mbr.mextent *
a.mpr.mextent *
a.mrr.mextent *
a.mcr.mextent),
722 : msr(sr), mbr(br), mpr(pr), mrr(rr), mcr(cr), mdata(data) {
761 if (is != end_shelf) {
766 for (; is != end_shelf; ++is) {
785 return Tensor5View(
mdata,
msr,
mbr,
mpr,
mrr,
mcr, s,
b, p, r,
c);
1471 for (; s != es; ++s, ++xs) {
1487 for (; s != es; ++s, ++xs) {
1503 for (; s != es; ++s, ++xs) {
1519 for (; s != es; ++s, ++xs) {
1531 a.mbr.mextent *
a.mpr.mextent *
a.mrr.mextent *
a.mcr.mextent),
1583 :
ConstTensor5View(data, ps, pb, pp, pr, pc, ns, nb, np, nr, nc) {
1594 for (; origin != end; ++origin, ++target) {
1603 for (; target != end; ++target) {
1635 std::fill_n(
mdata, s *
b * p * r *
c, fill);
1642 new
Numeric[m.nshelves() * m.nbooks() * m.npages() * m.nrows() *
1645 0, m.nshelves(), m.nbooks() * m.npages() * m.nrows() * m.ncols()),
1646 Range(0, m.nbooks(), m.npages() * m.nrows() * m.ncols()),
1647 Range(0, m.npages(), m.nrows() * m.ncols()),
1648 Range(0, m.nrows(), m.ncols()),
1649 Range(0, m.ncols())) {
1657 new
Numeric[m.nshelves() * m.nbooks() * m.npages() * m.nrows() *
1660 0, m.nshelves(), m.nbooks() * m.npages() * m.nrows() * m.ncols()),
1661 Range(0, m.nbooks(), m.npages() * m.nrows() * m.ncols()),
1662 Range(0, m.npages(), m.nrows() * m.ncols()),
1663 Range(0, m.nrows(), m.ncols()),
1664 Range(0, m.ncols())) {
1721 x.msr =
Range(0, 0);
1722 x.mbr =
Range(0, 0);
1723 x.mpr =
Range(0, 0);
1724 x.mrr =
Range(0, 0);
1725 x.mcr =
Range(0, 0);
1778 swap(t1.msr, t2.msr);
1779 swap(t1.mbr, t2.mbr);
1780 swap(t1.mpr, t2.mpr);
1781 swap(t1.mrr, t2.mrr);
1782 swap(t1.mcr, t2.mcr);
1783 swap(t1.mdata, t2.mdata);
1820 for (; xi != xe; ++xi, ++yi) {
1836 for (; xi != xe; ++xi) {
1840 if (maxi > themax) themax = maxi;
1855 for (; xi != xe; ++xi) {
1859 if (mini < themin) themin = mini;
1887 return tv(s,
b, p, r,
c);
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
Const version of Iterator5D.
A constant view of a Matrix.
A constant view of a Tensor3.
A constant view of a Tensor4.
ConstIterator4D end() const
Return const iterator behind last book.
ConstIterator4D begin() const
Return const iterator to first book.
A constant view of a Tensor5.
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.
ConstTensor5View()=default
Numeric * mdata
Pointer to the plain C array that holds the data.
Index npages() const noexcept
ConstIterator5D end() const
Return const iterator behind last shelf.
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.
Index nbooks() const noexcept
Index nshelves() const noexcept
ConstIterator5D begin() const
Return const iterator to first shelf.
A constant view of a Vector.
Implementation of Tensors of Rank 5.
Index mstart
The start index.
Index mextent
The number of elements.
Iterator4D begin()
Return iterator to first book.
Iterator4D end()
Return iterator behind last book.
Tensor5View & operator*=(Numeric x)
Multiplication by scalar.
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
Iterator5D end()
Return iterator behind last shelf.
Tensor5View & operator-=(Numeric x)
Subtraction of scalar.
Tensor5View & operator/=(Numeric x)
Division by scalar.
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+=(Numeric x)
Addition of scalar.
Tensor5View & operator=(const ConstTensor5View &v)
Assignment operator.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize function.
~Tensor5() noexcept override
Destructor for Tensor5.
Tensor5 & operator=(const matpack::tensor5_like_not_tensor5 auto &init)
Set from a tensor type.
#define ARTS_ASSERT(condition,...)
The declarations of all the exception classes.
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.
std::ostream & operator<<(std::ostream &os, const ConstTensor5View &v)
Output operator.
void swap(Tensor5 &t1, Tensor5 &t2) noexcept
Swaps two objects.
void copy(ConstIterator5D origin, const ConstIterator5D &end, Iterator5D target)
Copy data between begin and end to target.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.