Go to the documentation of this file.
28 using std::runtime_error;
65 const Range& c)
const {
66 return ConstTensor5View(
mdata,
msr,
mbr,
mpr,
mrr,
mcr, s, b, p, r, c);
90 const Range& c)
const {
105 const Range& c)
const {
120 const Range& c)
const {
135 const Range& c)
const {
663 throw std::runtime_error(
664 "A Tensor5View can only be converted to a plain C-array if it's pointing to a continuous block of data");
683 throw std::runtime_error(
684 "A Tensor5View can only be converted to a plain C-array if it's pointing to a continuous block of data");
705 : msr(0, 1, a.mbr.mextent * a.mpr.mextent * a.mrr.mextent * a.mcr.mextent),
724 : msr(sr), mbr(br), mpr(pr), mrr(rr), mcr(cr), mdata(
data) {
763 if (is != end_shelf) {
768 for (; is != end_shelf; ++is) {
787 return Tensor5View(
mdata,
msr,
mbr,
mpr,
mrr,
mcr, s, b, p, r, c);
1466 assert(
nbooks() ==
x.nbooks());
1467 assert(
npages() ==
x.npages());
1468 assert(
nrows() ==
x.nrows());
1469 assert(
ncols() ==
x.ncols());
1473 for (; s != es; ++s, ++xs) {
1482 assert(
nbooks() ==
x.nbooks());
1483 assert(
npages() ==
x.npages());
1484 assert(
nrows() ==
x.nrows());
1485 assert(
ncols() ==
x.ncols());
1489 for (; s != es; ++s, ++xs) {
1498 assert(
nbooks() ==
x.nbooks());
1499 assert(
npages() ==
x.npages());
1500 assert(
nrows() ==
x.nrows());
1501 assert(
ncols() ==
x.ncols());
1505 for (; s != es; ++s, ++xs) {
1514 assert(
nbooks() ==
x.nbooks());
1515 assert(
npages() ==
x.npages());
1516 assert(
nrows() ==
x.nrows());
1517 assert(
ncols() ==
x.ncols());
1521 for (; s != es; ++s, ++xs) {
1533 a.mbr.mextent * a.mpr.mextent * a.mrr.mextent * a.mcr.mextent),
1585 :
ConstTensor5View(
data, ps, pb, pp, pr, pc,
ns, nb, np, nr, nc) {
1596 for (; origin !=
end; ++origin, ++target) {
1605 for (; target !=
end; ++target) {
1619 Range(0, s, b * p * r * c),
1620 Range(0, b, p * r * c),
1630 Range(0, s, b * p * r * c),
1631 Range(0, b, p * r * c),
1637 std::fill_n(
mdata, s * b * p * r * c, fill);
1704 resize(
x.nshelves(),
x.nbooks(),
x.npages(),
x.nrows(),
x.ncols());
1812 assert(
y.nshelves() ==
x.nshelves());
1813 assert(
y.nbooks() ==
x.nbooks());
1814 assert(
y.npages() ==
x.npages());
1815 assert(
y.nrows() ==
x.nrows());
1816 assert(
y.ncols() ==
x.ncols());
1821 for (; xi != xe; ++xi, ++yi) {
1837 for (; xi != xe; ++xi) {
1841 if (maxi > themax) themax = maxi;
1856 for (; xi != xe; ++xi) {
1860 if (mini < themin) themin = mini;
1888 return tv(s, b, p, r, c);
Index nbooks() const
Returns the number of books.
The declarations of all the exception classes.
ConstIterator4D end() const
Return const iterator behind last book.
Tensor5View & operator+=(Numeric x)
Addition of scalar.
Tensor5View & operator-=(Numeric x)
Subtraction of scalar.
Index ncols() const
Returns the number of columns.
void swap(Tensor5 &t1, Tensor5 &t2)
Swaps two objects.
Range mbr
The book range of mdata that is actually used.
ConstTensor5View operator()(const Range &s, const Range &b, const Range &p, const Range &r, const Range &c) const
Const index operator for subrange.
Tensor5 & operator=(const Tensor5 &x)
Assignment operator from another tensor.
Vector y(Workspace &ws) noexcept
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
Index nshelves(Workspace &ws) noexcept
Index mstart
The start index.
Range msr
The shelf range of mdata that is actually used.
Implementation of Tensors of Rank 5.
Index npages() const
Returns the number of pages.
Iterator4D begin()
Return iterator to first book.
ConstIterator5D begin() const
Return const iterator to first shelf.
A constant view of a Tensor4.
Tensor5View & operator/=(Numeric x)
Division by scalar.
bool empty() const
Check if variable is empty.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize function.
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...
Iterator5D end()
Return iterator behind last shelf.
const Numeric * get_c_array() const
Conversion to plain C-array.
virtual ~Tensor5()
Destructor for Tensor5.
Range mrr
The row range of mdata that is actually used.
ConstIterator4D begin() const
Return const iterator to first book.
NUMERIC Numeric
The type to use for all floating point numbers.
Index npages(Workspace &ws) noexcept
Iterator4D end()
Return iterator behind last book.
void copy(ConstIterator5D origin, const ConstIterator5D &end, Iterator5D target)
Copy data between begin and end to target.
std::ostream & operator<<(std::ostream &os, const ConstTensor5View &v)
Output operator.
Range mcr
The column range of mdata that is actually used.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Numeric max(const ConstTensor5View &x)
Max function, tensor version.
A constant view of a Matrix.
Index nrows(Workspace &ws) noexcept
Numeric debug_tensor5view_get_elem(Tensor5View &tv, Index s, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
Tensor5View operator()(const Range &s, const Range &b, const Range &p, const Range &r, const Range &c)
Index operator for subrange.
Index mextent
The number of elements.
Index nrows() const
Returns the number of rows.
Tensor5View & operator=(const ConstTensor5View &v)
Assignment operator.
Range mpr
The page range of mdata that is actually used.
Index nshelves() const
Returns the number of shelves.
A constant view of a Tensor3.
Iterator5D begin()
Return iterator to first shelf.
Numeric * mdata
Pointer to the plain C array that holds the data.
Numeric min(const ConstTensor5View &x)
Min function, tensor version.
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
Index ncols(Workspace &ws) noexcept
Const version of Iterator5D.
A constant view of a Vector.
ConstIterator5D end() const
Return const iterator behind last shelf.
Tensor5View & operator*=(Numeric x)
Multiplication by scalar.
Index nbooks(Workspace &ws) noexcept
ConstTensor5View()=default
A constant view of a Tensor5.