Go to the documentation of this file.
28 using std::runtime_error;
74 const Range& c)
const {
97 const Range& c)
const {
111 const Range& c)
const {
125 const Range& c)
const {
179 const Range& c)
const {
199 const Range& c)
const {
239 const Range& c)
const {
319 const Range& c)
const {
346 throw std::runtime_error(
347 "A Tensor4View can only be converted to a plain C-array if it's pointing to a continuous block of data");
364 throw std::runtime_error(
365 "A Tensor4View can only be converted to a plain C-array if it's pointing to a continuous block of data");
386 : mbr(0, 1, a.mpr.mextent * a.mrr.mextent * a.mcr.mextent),
403 : mbr(br), mpr(pr), mrr(rr), mcr(cr), mdata(
data) {
423 : mbr(pb, nb), mpr(pp, np), mrr(pr, nr), mcr(pc, nc), mdata(
data) {
435 if (ib != end_book) {
440 for (; ib != end_book; ++ib) {
812 assert(
nbooks() ==
x.nbooks());
813 assert(
npages() ==
x.npages());
814 assert(
nrows() ==
x.nrows());
815 assert(
ncols() ==
x.ncols());
819 for (; b !=
eb; ++b, ++xb) {
827 assert(
nbooks() ==
x.nbooks());
828 assert(
npages() ==
x.npages());
829 assert(
nrows() ==
x.nrows());
830 assert(
ncols() ==
x.ncols());
834 for (; b !=
eb; ++b, ++xb) {
842 assert(
nbooks() ==
x.nbooks());
843 assert(
npages() ==
x.npages());
844 assert(
nrows() ==
x.nrows());
845 assert(
ncols() ==
x.ncols());
849 for (; b !=
eb; ++b, ++xb) {
857 assert(
nbooks() ==
x.nbooks());
858 assert(
npages() ==
x.npages());
859 assert(
nrows() ==
x.nrows());
860 assert(
ncols() ==
x.ncols());
864 for (; b !=
eb; ++b, ++xb) {
874 Range(0, 1, a.mpr.mextent * a.mrr.mextent * a.mcr.mextent),
931 for (; origin !=
end; ++origin, ++target) {
940 for (; target !=
end; ++target) {
954 Range(0, b, p * r * c),
964 Range(0, b, p * r * c),
970 std::fill_n(
mdata, b * p * r * c, fill);
1028 resize(
x.nbooks(),
x.npages(),
x.nrows(),
x.ncols());
1127 assert(
y.nbooks() ==
x.nbooks());
1128 assert(
y.npages() ==
x.npages());
1129 assert(
y.nrows() ==
x.nrows());
1130 assert(
y.ncols() ==
x.ncols());
1135 for (; xi != xe; ++xi, ++yi) {
1151 for (; xi != xe; ++xi) {
1155 if (maxi > themax) themax = maxi;
1170 for (; xi != xe; ++xi) {
1174 if (mini < themin) themin = mini;
1201 return tv(b, p, r, c);
void resize(Index b, Index p, Index r, Index c)
Resize function.
Range mpr
The page range of mdata that is actually used.
The declarations of all the exception classes.
ConstIterator4D end() const
Return const iterator behind last book.
void swap(Tensor4 &t1, Tensor4 &t2)
Swaps two objects.
Numeric min(const ConstTensor4View &x)
Min function, tensor version.
void transform(Tensor4View y, double(&my_func)(double), ConstTensor4View x)
A generic transform function for tensors, which can be used to implement mathematical functions opera...
ConstTensor4View()=default
Tensor4View & operator*=(Numeric x)
Multiplication by scalar.
Vector y(Workspace &ws) noexcept
Range mbr
The book range of mdata that is actually used.
ConstTensor4View operator()(const Range &b, const Range &p, const Range &r, const Range &c) const
Const index operator for subrange.
Range mcr
The column range of mdata that is actually used.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
virtual ~Tensor4()
Destructor for Tensor4.
Tensor4 & operator=(const Tensor4 &x)
Assignment operator from another tensor.
Index mstart
The start index.
Iterator3D end()
Return iterator behind last page.
Iterator4D begin()
Return iterator to first book.
Tensor3View * operator->()
The -> operator is needed, so that we can write i->begin() to get the 3D iterators.
Const version of Iterator4D.
A constant view of a Tensor4.
Tensor4View & operator+=(Numeric x)
Addition of scalar.
const ConstTensor3View * operator->() const
The -> operator is needed, so that we can write i->begin() to get the 3D iterators.
ConstIterator3D begin() const
Return const iterator to first page.
Iterator3D begin()
Return iterator to first page.
bool empty() const
Check if variable is empty.
Numeric debug_tensor4view_get_elem(Tensor4View &tv, Index b, Index p, Index r, Index c)
Helper function to access tensor elements.
std::ostream & operator<<(std::ostream &os, const ConstTensor4View &v)
Output operator.
Index ncols() const
Returns the number of columns.
ConstIterator4D begin() const
Return const iterator to first book.
NUMERIC Numeric
The type to use for all floating point numbers.
Index npages() const
Returns the number of pages.
Index nbooks() const
Returns the number of books.
Index npages(Workspace &ws) noexcept
Tensor4View & operator=(const ConstTensor4View &v)
Assignment operator.
Tensor3View msv
Current position.
Tensor4View & operator/=(Numeric x)
Division by scalar.
Iterator4D end()
Return iterator behind last book.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
A constant view of a Matrix.
Index nrows(Workspace &ws) noexcept
Index nrows() const
Returns the number of rows.
ConstIterator3D end() const
Return const iterator behind last page.
const ConstTensor3View & operator*() const
Dereferencing.
Index mextent
The number of elements.
Tensor3View & operator*()
Dereferencing.
Implementation of Tensors of Rank 4.
void copy(ConstIterator4D origin, const ConstIterator4D &end, Iterator4D target)
Copy data between begin and end to target.
Range mrr
The row range of mdata that is actually used.
A constant view of a Tensor3.
ConstTensor3View msv
Current position.
Tensor4View & operator-=(Numeric x)
Subtraction of scalar.
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
Tensor4View operator()(const Range &b, const Range &p, const Range &r, const Range &c)
Index operator for subrange.
Numeric max(const ConstTensor4View &x)
Max function, tensor version.
Index ncols(Workspace &ws) noexcept
A constant view of a Vector.
const Numeric * get_c_array() const
Conversion to plain C-array.
Numeric * mdata
Pointer to the plain C array that holds the data.
Index nbooks(Workspace &ws) noexcept