Go to the documentation of this file.
28 using std::runtime_error;
47 const Range& c)
const {
67 const Range& c)
const {
79 const Range& c)
const {
91 const Range& c)
const {
154 : mpr(0, 1, a.mrr.mextent * a.mcr.mextent),
169 : mpr(pr), mrr(rr), mcr(cr), mdata(
data) {
187 : mpr(pp, np), mrr(pr, nr), mcr(pc, nc), mdata(
data) {
199 if (ip != end_page) {
204 for (; ip != end_page; ++ip) {
309 throw std::runtime_error(
310 "A Tensor3View can only be converted to a plain C-array if it's pointing to a continuous block of data");
325 throw std::runtime_error(
326 "A Tensor3View can only be converted to a plain C-array if it's pointing to a continuous block of data");
435 assert(
npages() ==
x.npages());
436 assert(
nrows() ==
x.nrows());
437 assert(
ncols() ==
x.ncols());
441 for (; p != ep; ++p, ++xp) {
449 assert(
npages() ==
x.npages());
450 assert(
nrows() ==
x.nrows());
451 assert(
ncols() ==
x.ncols());
455 for (; p != ep; ++p, ++xp) {
463 assert(
npages() ==
x.npages());
464 assert(
nrows() ==
x.nrows());
465 assert(
ncols() ==
x.ncols());
469 for (; p != ep; ++p, ++xp) {
477 assert(
npages() ==
x.npages());
478 assert(
nrows() ==
x.nrows());
479 assert(
ncols() ==
x.ncols());
483 for (; p != ep; ++p, ++xp) {
492 a.mdata,
Range(0, 1, a.mrr.mextent * a.mcr.mextent), a.mrr, a.mcr) {
541 for (; origin !=
end; ++origin, ++target) {
550 for (; target !=
end; ++target) {
578 std::fill_n(
mdata, p * r * c, fill);
632 resize(
x.npages(),
x.nrows(),
x.ncols());
720 assert(
y.npages() ==
x.npages());
721 assert(
y.nrows() ==
x.nrows());
722 assert(
y.ncols() ==
x.ncols());
727 for (; xi != xe; ++xi, ++yi) {
743 for (; xi != xe; ++xi) {
747 if (maxi > themax) themax = maxi;
762 for (; xi != xe; ++xi) {
766 if (mini < themin) themin = mini;
The declarations of all the exception classes.
ConstTensor3View operator()(const Range &p, const Range &r, const Range &c) const
Const index operator for subrange.
Const version of Iterator3D.
Vector y(Workspace &ws) noexcept
Tensor3View operator()(const Range &p, const Range &r, const Range &c)
Index operator for subrange.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
Index nrows() const
Returns the number of rows.
virtual ~Tensor3()
Destructor for Tensor3.
Index mstart
The start index.
void swap(Tensor3 &t1, Tensor3 &t2)
Swaps two objects.
Numeric add(Numeric x, Numeric y)
Iterator3D end()
Return iterator behind last page.
void resize(Index p, Index r, Index c)
Resize function.
Tensor3View & operator-=(Numeric x)
Subtraction of scalar.
Index npages() const
Returns the number of pages.
Implementation of Tensors of Rank 3.
ConstIterator2D end() const
Return const iterator behind last row.
ConstIterator3D begin() const
Return const iterator to first page.
Iterator3D begin()
Return iterator to first page.
Index ncols() const
Returns the number of columns.
Range mrr
The row range of mdata that is actually used.
Range mcr
The column range of mdata that is actually used.
Index nelem() const
Returns the number of elements.
void mult(Tensor3View A, const ConstVectorView B, const ConstMatrixView C)
mult Tensor3
ConstTensor3View()=default
Iterator2D begin()
** Return const iterator to first row. Has to be redefined here, since it is
Range mpr
The page range of mdata that is actually used.
NUMERIC Numeric
The type to use for all floating point numbers.
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...
Numeric * mdata
Pointer to the plain C array that holds the data.
Numeric debug_tensor3view_get_elem(Tensor3View &tv, Index p, Index r, Index c)
Helper function to access tensor elements.
Index npages(Workspace &ws) noexcept
Tensor3View & operator/=(Numeric x)
Division by scalar.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Index nrows() const
Returns the number of rows.
A constant view of a Matrix.
Tensor3View & operator*=(Numeric x)
Multiplication by scalar.
Index nrows(Workspace &ws) noexcept
ConstIterator3D end() const
Return const iterator behind last page.
Numeric max(const ConstTensor3View &x)
Max function, tensor version.
Index mextent
The number of elements.
Index ncols() const
Returns the number of columns.
A constant view of a Tensor3.
Tensor3 & operator=(const Tensor3 &x)
Assignment operator from another tensor.
ConstIterator2D begin() const
Return const iterator to first row.
Tensor3View & operator+=(Numeric x)
Addition of scalar.
Iterator2D end()
Return iterator behind last row.
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
Tensor3View & operator=(const ConstTensor3View &v)
Assignment operator.
bool empty() const
Check if variable is empty.
Index ncols(Workspace &ws) noexcept
const Numeric * get_c_array() const
Conversion to plain C-array.
Numeric min(const ConstTensor3View &x)
Min function, tensor version.
std::ostream & operator<<(std::ostream &os, const ConstTensor3View &v)
Output operator.
A constant view of a Vector.
void copy(ConstIterator3D origin, const ConstIterator3D &end, Iterator3D target)
Copy data between begin and end to target.