ARTS 2.5.4 (git: 4c0d3b4d)
|
The Tensor3View class. More...
#include <matpackIII.h>
Public Member Functions | |
constexpr | Tensor3View (const Tensor3View &)=default |
Tensor3View | operator() (const Range &p, const Range &r, const Range &c) |
Index operator for subrange. More... | |
MatrixView | operator() (const Range &p, const Range &r, Index c) |
Index operator returning an object of type MatrixView. More... | |
MatrixView | operator() (const Range &p, Index r, const Range &c) |
Index operator returning an object of type MatrixView. More... | |
MatrixView | operator() (Index p, const Range &r, const Range &c) |
Index operator returning an object of type MatrixView. More... | |
VectorView | operator() (Index p, Index r, const Range &c) |
Index operator returning an object of type VectorView. More... | |
VectorView | operator() (Index p, const Range &r, Index c) |
Index operator returning an object of type VectorView. More... | |
VectorView | operator() (const Range &p, Index r, Index c) |
Index operator returning an object of type VectorView. More... | |
Numeric & | operator() (Index p, Index r, Index c) |
Plain non-const index operator. More... | |
Numeric & | get (Index p, Index r, Index c) |
Get element implementation without assertions. More... | |
const Numeric * | get_c_array () const ARTS_NOEXCEPT |
Conversion to plain C-array. More... | |
Numeric * | get_c_array () ARTS_NOEXCEPT |
Conversion to plain C-array. More... | |
Iterator3D | begin () |
Return iterator to first page. More... | |
Iterator3D | end () |
Return iterator behind last page. More... | |
Tensor3View & | operator= (const ConstTensor3View &v) |
Assignment operator. More... | |
Tensor3View & | operator= (const Tensor3View &v) |
Assignment from Tensor3View to Tensor3View. More... | |
Tensor3View & | operator= (const Tensor3 &v) |
Assignment from a Tensor3. More... | |
Tensor3View & | operator= (Numeric x) |
Assigning a scalar to a Tensor3View will set all elements to this value. More... | |
Tensor3View & | operator*= (Numeric x) |
Multiplication by scalar. More... | |
Tensor3View & | operator/= (Numeric x) |
Division by scalar. More... | |
Tensor3View & | operator+= (Numeric x) |
Addition of scalar. More... | |
Tensor3View & | operator-= (Numeric x) |
Subtraction of scalar. More... | |
Tensor3View & | operator*= (const ConstTensor3View &x) |
Element-vise multiplication by another Tensor3. More... | |
Tensor3View & | operator/= (const ConstTensor3View &x) |
Element-vise division by another Tensor3. More... | |
Tensor3View & | operator+= (const ConstTensor3View &x) |
Element-vise addition of another Tensor3. More... | |
Tensor3View & | operator-= (const ConstTensor3View &x) |
Element-vise subtraction of another Tensor3. More... | |
virtual | ~Tensor3View ()=default |
Destructor. More... | |
Tensor3View (const MatrixView &a) | |
Special constructor to make a Tensor3 view of a matrix. More... | |
ConstIterator3D | begin () const |
Return const iterator to first page. More... | |
ConstIterator3D | end () const |
Return const iterator behind last page. More... | |
Numeric | get (Index p, Index r, Index c) const |
Get element implementation without assertions. More... | |
![]() | |
constexpr | ConstTensor3View (const ConstTensor3View &)=default |
constexpr | ConstTensor3View (ConstTensor3View &&)=default |
ConstTensor3View & | operator= (const ConstTensor3View &)=default |
ConstTensor3View & | operator= (ConstTensor3View &&)=default |
Index | npages () const |
Returns the number of pages. More... | |
Index | nrows () const |
Returns the number of rows. More... | |
Index | ncols () const |
Returns the number of columns. More... | |
Index | size () const noexcept |
bool | empty () const noexcept |
Shape< 3 > | shape () const |
ConstTensor3View | operator() (const Range &p, const Range &r, const Range &c) const |
Const index operator for subrange. More... | |
ConstMatrixView | operator() (const Range &p, const Range &r, Index c) const |
Const index operator returning an object of type ConstMatrixView. More... | |
ConstMatrixView | operator() (const Range &p, Index r, const Range &c) const |
Const index operator returning an object of type ConstMatrixView. More... | |
ConstMatrixView | operator() (Index p, const Range &r, const Range &c) const |
Const index operator returning an object of type ConstMatrixView. More... | |
ConstVectorView | operator() (Index p, Index r, const Range &c) const |
Const index operator returning an object of type ConstVectorView. More... | |
ConstVectorView | operator() (Index p, const Range &r, Index c) const |
Const index operator returning an object of type ConstVectorView. More... | |
ConstVectorView | operator() (const Range &p, Index r, Index c) const |
Const index operator returning an object of type ConstVectorView. More... | |
Numeric | operator() (Index p, Index r, Index c) const |
Plain const index operator. More... | |
Numeric | get (Index p, Index r, Index c) const |
Get element implementation without assertions. More... | |
ConstIterator3D | begin () const |
Return const iterator to first page. More... | |
ConstIterator3D | end () const |
Return const iterator behind last page. More... | |
virtual | ~ConstTensor3View ()=default |
Destructor. More... | |
ConstTensor3View (const ConstMatrixView &a) | |
Special constructor to make a Tensor3 view of a matrix. More... | |
Protected Member Functions | |
Tensor3View ()=default | |
Tensor3View (Numeric *data, const Range &p, const Range &r, const Range &c) | |
Explicit constructor. More... | |
Tensor3View (Numeric *data, const Range &pp, const Range &pr, const Range &pc, const Range &np, const Range &nr, const Range &nc) | |
Recursive constructor. More... | |
![]() | |
ConstTensor3View ()=default | |
ConstTensor3View (Numeric *data, const Range &p, const Range &r, const Range &c) | |
Explicit constructor. More... | |
ConstTensor3View (Numeric *data, const Range &pp, const Range &pr, const Range &pc, const Range &np, const Range &nr, const Range &nc) | |
Recursive constructor. More... | |
Friends | |
class | Iterator4D |
class | Tensor4View |
class | Tensor5View |
class | Tensor6View |
class | Tensor7View |
Additional Inherited Members | |
![]() | |
Range | mpr {0, 0, 1} |
The page range of mdata that is actually used. More... | |
Range | mrr {0, 0, 1} |
The row range of mdata that is actually used. More... | |
Range | mcr {0, 0, 1} |
The column range of mdata that is actually used. More... | |
Numeric * | mdata {nullptr} |
Pointer to the plain C array that holds the data. More... | |
The Tensor3View class.
This contains the main implementation of a Tensor3. It defines the concepts of Tensor3View. Plus additionally the recursive subrange operator, which makes it possible to create a Tensor3View from a subrange of a Tensor3View.
The class Tensor3 is just a special case of a Tensor3View which also allocates storage.
Definition at line 244 of file matpackIII.h.
|
constexprdefault |
|
virtualdefault |
Destructor.
Tensor3View::Tensor3View | ( | const MatrixView & | a | ) |
Special constructor to make a Tensor3 view of a matrix.
Definition at line 487 of file matpackIII.cc.
|
protecteddefault |
Referenced by operator()().
|
protected |
Explicit constructor.
This one is used by Tensor3 to initialize its own Tensor3View part. The row range rr must have a stride to account for the length of one row.
Definition at line 496 of file matpackIII.cc.
|
protected |
Recursive constructor.
This is used to construct SubMatrices from SubMatrices. That means that the new ranges have to be interpreted relative to the original ranges.
The new ranges may contain -1 for the extent which acts as a joker. However, the used Range constructor converts this to an explicit range, consistent with the original Range.
*data | The actual data. |
pp | Previous range. |
pr | Previous range. |
pc | Previous range. |
np | New Range. |
nr | New Range. |
nc | New Range. |
Definition at line 520 of file matpackIII.cc.
Iterator3D Tensor3View::begin | ( | ) |
Return iterator to first page.
Definition at line 329 of file matpackIII.cc.
References ConstTensor3View::mcr, ConstTensor3View::mdata, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
Referenced by copy(), operator*=(), operator+=(), operator-=(), operator/=(), operator=(), Tensor3::Tensor3(), and transform().
ConstIterator3D ConstTensor3View::begin | ( | ) | const |
Return const iterator to first page.
Definition at line 191 of file matpackIII.cc.
Iterator3D Tensor3View::end | ( | ) |
Return iterator behind last page.
Definition at line 334 of file matpackIII.cc.
References ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
Referenced by copy(), operator*=(), operator+=(), operator-=(), operator/=(), and operator=().
ConstIterator3D ConstTensor3View::end | ( | ) | const |
Return const iterator behind last page.
Definition at line 192 of file matpackIII.cc.
Get element implementation without assertions.
Definition at line 280 of file matpackIII.h.
References c, ConstTensor3View::mcr, ConstTensor3View::mdata, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
Referenced by interpweights(), and operator()().
Get element implementation without assertions.
Definition at line 185 of file matpackIII.h.
Numeric * Tensor3View::get_c_array | ( | ) |
Conversion to plain C-array.
This function returns a pointer to the raw data. It fails if the Tensor3View is not pointing to the beginning of a Tensor3 or the stride is not 1 because the caller expects to get a C array with continuous data.
Definition at line 296 of file matpackIII.cc.
References ARTS_ASSERT, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, Range::mstride, and ConstTensor3View::size().
const Numeric * Tensor3View::get_c_array | ( | ) | const |
Conversion to plain C-array.
This function returns a pointer to the raw data. It fails if the Tensor3View is not pointing to the beginning of a Tensor3 or the stride is not 1 because the caller expects to get a C array with continuous data.
Definition at line 315 of file matpackIII.cc.
References ARTS_ASSERT, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, Range::mstride, and ConstTensor3View::size().
Referenced by nca_read_from_file(), nca_write_to_file(), Reduce(), and test38().
Tensor3View Tensor3View::operator() | ( | const Range & | p, |
const Range & | r, | ||
const Range & | c | ||
) |
Index operator for subrange.
We have to also account for the case, that *this is already a subrange of a Tensor3. This allows correct recursive behavior.
Definition at line 209 of file matpackIII.cc.
References c, ConstTensor3View::mcr, ConstTensor3View::mdata, ConstTensor3View::mpr, ConstTensor3View::mrr, and Tensor3View().
MatrixView Tensor3View::operator() | ( | const Range & | p, |
const Range & | r, | ||
Index | c | ||
) |
Index operator returning an object of type MatrixView.
(Reducing the dimension by one.)
Definition at line 217 of file matpackIII.cc.
References ARTS_ASSERT, c, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
MatrixView Tensor3View::operator() | ( | const Range & | p, |
Index | r, | ||
const Range & | c | ||
) |
Index operator returning an object of type MatrixView.
(Reducing the dimension by one.)
Definition at line 227 of file matpackIII.cc.
References ARTS_ASSERT, c, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
VectorView Tensor3View::operator() | ( | const Range & | p, |
Index | r, | ||
Index | c | ||
) |
Index operator returning an object of type VectorView.
(Reducing the dimension by two.)
Definition at line 277 of file matpackIII.cc.
References ARTS_ASSERT, c, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
MatrixView Tensor3View::operator() | ( | Index | p, |
const Range & | r, | ||
const Range & | c | ||
) |
Index operator returning an object of type MatrixView.
(Reducing the dimension by one.)
Definition at line 237 of file matpackIII.cc.
References ARTS_ASSERT, c, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
VectorView Tensor3View::operator() | ( | Index | p, |
const Range & | r, | ||
Index | c | ||
) |
Index operator returning an object of type VectorView.
(Reducing the dimension by two.)
Definition at line 262 of file matpackIII.cc.
References ARTS_ASSERT, c, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
VectorView Tensor3View::operator() | ( | Index | p, |
Index | r, | ||
const Range & | c | ||
) |
Index operator returning an object of type VectorView.
(Reducing the dimension by two.)
Definition at line 247 of file matpackIII.cc.
References ARTS_ASSERT, c, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
Plain non-const index operator.
Definition at line 267 of file matpackIII.h.
References ARTS_ASSERT, c, get(), ConstTensor3View::mcr, Range::mextent, ConstTensor3View::mpr, and ConstTensor3View::mrr.
Tensor3View & Tensor3View::operator*= | ( | const ConstTensor3View & | x | ) |
Element-vise multiplication by another Tensor3.
Definition at line 431 of file matpackIII.cc.
References ARTS_ASSERT, begin(), ConstTensor3View::begin(), end(), ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().
Tensor3View & Tensor3View::operator*= | ( | Numeric | x | ) |
Multiplication by scalar.
Definition at line 395 of file matpackIII.cc.
Tensor3View & Tensor3View::operator+= | ( | const ConstTensor3View & | x | ) |
Element-vise addition of another Tensor3.
Definition at line 459 of file matpackIII.cc.
References ARTS_ASSERT, begin(), ConstTensor3View::begin(), end(), ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().
Tensor3View & Tensor3View::operator+= | ( | Numeric | x | ) |
Tensor3View & Tensor3View::operator-= | ( | const ConstTensor3View & | x | ) |
Element-vise subtraction of another Tensor3.
Definition at line 473 of file matpackIII.cc.
References ARTS_ASSERT, begin(), ConstTensor3View::begin(), end(), ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().
Tensor3View & Tensor3View::operator-= | ( | Numeric | x | ) |
Tensor3View & Tensor3View::operator/= | ( | const ConstTensor3View & | x | ) |
Element-vise division by another Tensor3.
Definition at line 445 of file matpackIII.cc.
References ARTS_ASSERT, begin(), ConstTensor3View::begin(), end(), ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().
Tensor3View & Tensor3View::operator/= | ( | Numeric | x | ) |
Tensor3View & Tensor3View::operator= | ( | const ConstTensor3View & | m | ) |
Assignment operator.
This copies the data from another Tensor3View to this Tensor3View. Dimensions must agree! Resizing would destroy the selection that we might have done in this Tensor3View by setting its range.
Definition at line 344 of file matpackIII.cc.
References ARTS_ASSERT, begin(), ConstTensor3View::begin(), copy(), ConstTensor3View::end(), ConstTensor3View::mcr, Range::mextent, ConstTensor3View::mpr, and ConstTensor3View::mrr.
Tensor3View & Tensor3View::operator= | ( | const Tensor3 & | m | ) |
Assignment from a Tensor3.
This must exist to overide the automatically generated assignment operators, which don't copy the contents!
Definition at line 372 of file matpackIII.cc.
References ARTS_ASSERT, begin(), copy(), end(), ConstTensor3View::mcr, Range::mextent, ConstTensor3View::mpr, and ConstTensor3View::mrr.
Tensor3View & Tensor3View::operator= | ( | const Tensor3View & | m | ) |
Assignment from Tensor3View to Tensor3View.
This is a tricky one. The problem is that since Tensor3View is derived from ConstTensor3View, a default = operator is generated by the compiler, which does not do what we want. So we need this one to override the default.
Definition at line 359 of file matpackIII.cc.
References ARTS_ASSERT, begin(), copy(), end(), ConstTensor3View::mcr, Range::mextent, ConstTensor3View::mpr, and ConstTensor3View::mrr.
Tensor3View & Tensor3View::operator= | ( | Numeric | x | ) |
Assigning a scalar to a Tensor3View will set all elements to this value.
Definition at line 384 of file matpackIII.cc.
|
friend |
Definition at line 314 of file matpackIII.h.
|
friend |
Definition at line 315 of file matpackIII.h.
|
friend |
Definition at line 316 of file matpackIII.h.
|
friend |
Definition at line 317 of file matpackIII.h.
|
friend |
Definition at line 318 of file matpackIII.h.