ARTS 2.5.10 (git: 2f1c442c)
|
#include <matpackIII.h>
Public Member Functions | |
Tensor3 ()=default | |
Tensor3 (Index p, Index r, Index c) | |
Constructor setting size. | |
Tensor3 (Index p, Index r, Index c, Numeric fill) | |
Constructor setting size and filling with constant value. | |
Tensor3 (const ConstTensor3View &v) | |
Copy constructor from Tensor3View. | |
Tensor3 (const Tensor3 &v) | |
Copy constructor from Tensor3. | |
Tensor3 (Tensor3 &&v) noexcept | |
Tensor3 (const matpack::tensor3_like_not_tensor3 auto &init) | |
Initialization from a tensor type. | |
Tensor3 & | operator= (const matpack::tensor3_like_not_tensor3 auto &init) |
Set from a tensor type. | |
Tensor3 (Numeric *d, const Range &r0, const Range &r1, const Range &r2) ARTS_NOEXCEPT | |
Tensor3 & | operator= (const Tensor3 &x) |
Assignment operator from another tensor. | |
Tensor3 & | operator= (Tensor3 &&x) ARTS_NOEXCEPT |
Move assignment operator from another tensor. | |
Tensor3 & | operator= (Numeric x) |
Assignment operator from scalar. | |
void | resize (Index p, Index r, Index c) |
Resize function. | |
~Tensor3 () noexcept override | |
Destructor for Tensor3. | |
template<std::size_t dim0> | |
Vector | reduce_rank () &&ARTS_NOEXCEPT |
template<std::size_t dim0, std::size_t dim1> | |
Matrix | reduce_rank () &&ARTS_NOEXCEPT |
template<class F > | |
void | transform_elementwise (F &&func) |
![]() | |
constexpr | Tensor3View (const Tensor3View &)=default |
Tensor3View | operator() (const Range &p, const Range &r, const Range &c) |
Index operator for subrange. | |
MatrixView | operator() (const Range &p, const Range &r, Index c) |
Index operator returning an object of type MatrixView. | |
MatrixView | operator() (const Range &p, Index r, const Range &c) |
Index operator returning an object of type MatrixView. | |
MatrixView | operator() (Index p, const Range &r, const Range &c) |
Index operator returning an object of type MatrixView. | |
VectorView | operator() (Index p, Index r, const Range &c) |
Index operator returning an object of type VectorView. | |
VectorView | operator() (Index p, const Range &r, Index c) |
Index operator returning an object of type VectorView. | |
VectorView | operator() (const Range &p, Index r, Index c) |
Index operator returning an object of type VectorView. | |
Numeric & | operator() (Index p, Index r, Index c) |
Plain non-const index operator. | |
Numeric & | get (Index p, Index r, Index c) |
Get element implementation without assertions. | |
const Numeric * | get_c_array () const ARTS_NOEXCEPT |
Conversion to plain C-array. | |
Numeric * | get_c_array () ARTS_NOEXCEPT |
Conversion to plain C-array. | |
Iterator3D | begin () |
Return iterator to first page. | |
Iterator3D | end () |
Return iterator behind last page. | |
Tensor3View & | operator= (const ConstTensor3View &v) |
Assignment operator. | |
Tensor3View & | operator= (const Tensor3View &v) |
Assignment from Tensor3View to Tensor3View. | |
Tensor3View & | operator= (const Tensor3 &v) |
Assignment from a Tensor3. | |
Tensor3View & | operator= (Numeric x) |
Assigning a scalar to a Tensor3View will set all elements to this value. | |
Tensor3View & | operator*= (Numeric x) |
Multiplication by scalar. | |
Tensor3View & | operator/= (Numeric x) |
Division by scalar. | |
Tensor3View & | operator+= (Numeric x) |
Addition of scalar. | |
Tensor3View & | operator-= (Numeric x) |
Subtraction of scalar. | |
Tensor3View & | operator*= (const ConstTensor3View &x) |
Element-vise multiplication by another Tensor3. | |
Tensor3View & | operator/= (const ConstTensor3View &x) |
Element-vise division by another Tensor3. | |
Tensor3View & | operator+= (const ConstTensor3View &x) |
Element-vise addition of another Tensor3. | |
Tensor3View & | operator-= (const ConstTensor3View &x) |
Element-vise subtraction of another Tensor3. | |
~Tensor3View () override=default | |
Destructor. | |
Tensor3View (const MatrixView &a) | |
Special constructor to make a Tensor3 view of a matrix. | |
ConstIterator3D | begin () const |
Return const iterator to first page. | |
ConstIterator3D | end () const |
Return const iterator behind last page. | |
Numeric | get (Index p, Index r, Index c) const |
Get element implementation without assertions. | |
![]() | |
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. | |
Index | nrows () const |
Returns the number of rows. | |
Index | ncols () const |
Returns the number of columns. | |
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. | |
ConstMatrixView | operator() (const Range &p, const Range &r, Index c) const |
Const index operator returning an object of type ConstMatrixView. | |
ConstMatrixView | operator() (const Range &p, Index r, const Range &c) const |
Const index operator returning an object of type ConstMatrixView. | |
ConstMatrixView | operator() (Index p, const Range &r, const Range &c) const |
Const index operator returning an object of type ConstMatrixView. | |
ConstVectorView | operator() (Index p, Index r, const Range &c) const |
Const index operator returning an object of type ConstVectorView. | |
ConstVectorView | operator() (Index p, const Range &r, Index c) const |
Const index operator returning an object of type ConstVectorView. | |
ConstVectorView | operator() (const Range &p, Index r, Index c) const |
Const index operator returning an object of type ConstVectorView. | |
Numeric | operator() (Index p, Index r, Index c) const |
Plain const index operator. | |
Numeric | get (Index p, Index r, Index c) const |
Get element implementation without assertions. | |
ConstIterator3D | begin () const |
Return const iterator to first page. | |
ConstIterator3D | end () const |
Return const iterator behind last page. | |
virtual | ~ConstTensor3View ()=default |
Destructor. | |
ConstTensor3View (const ConstMatrixView &a) | |
Special constructor to make a Tensor3 view of a matrix. | |
Friends | |
void | swap (Tensor3 &t1, Tensor3 &t2) noexcept |
Swaps two objects. | |
Additional Inherited Members | |
![]() | |
static constexpr bool | matpack_type {true} |
![]() | |
Tensor3View ()=default | |
Tensor3View (Numeric *data, const Range &p, const Range &r, const Range &c) | |
Explicit constructor. | |
Tensor3View (Numeric *data, const Range &pp, const Range &pr, const Range &pc, const Range &np, const Range &nr, const Range &nc) | |
Recursive constructor. | |
![]() | |
ConstTensor3View ()=default | |
ConstTensor3View (Numeric *data, const Range &p, const Range &r, const Range &c) | |
Explicit constructor. | |
ConstTensor3View (Numeric *data, const Range &pp, const Range &pr, const Range &pc, const Range &np, const Range &nr, const Range &nc) | |
Recursive constructor. | |
![]() | |
Range | mpr {0, 0, 1} |
The page range of mdata that is actually used. | |
Range | mrr {0, 0, 1} |
The row range of mdata that is actually used. | |
Range | mcr {0, 0, 1} |
The column range of mdata that is actually used. | |
Numeric * | mdata {nullptr} |
Pointer to the plain C array that holds the data. | |
The Tensor3 class.
This is a Tensor3View that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from Tensor3View. Additionally defined here are:
Definition at line 352 of file matpackIII.h.
|
default |
Constructor setting size.
This constructor has to set the strides in the page and row ranges correctly!
Definition at line 559 of file matpackIII.cc.
Constructor setting size and filling with constant value.
Definition at line 568 of file matpackIII.cc.
References c, and ConstTensor3View::mdata.
Tensor3::Tensor3 | ( | const ConstTensor3View & | m | ) |
Copy constructor from Tensor3View.
This automatically sets the size and copies the data.
Definition at line 580 of file matpackIII.cc.
References Tensor3View::begin(), ConstTensor3View::begin(), copy(), and ConstTensor3View::end().
Tensor3::Tensor3 | ( | const Tensor3 & | m | ) |
Copy constructor from Tensor3.
This automatically sets the size and copies the data.
Definition at line 590 of file matpackIII.cc.
References ConstTensor3View::mdata, ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().
|
inlinenoexcept |
Definition at line 360 of file matpackIII.h.
References v.
|
inlineexplicit |
Initialization from a tensor type.
Definition at line 365 of file matpackIII.h.
Construct from known data
Note that this will call delete on the pointer if it is still valid at the end of the lifetime of this variable
[in] | d | - A pointer to some raw data |
[in] | r0 | - The Range along the first dimension |
[in] | r1 | - The Range along the second dimension |
[in] | r2 | - The Range along the third dimension |
Definition at line 395 of file matpackIII.h.
References ARTS_ASSERT.
|
overridenoexcept |
Destructor for Tensor3.
This is important, since Tensor3 uses new to allocate storage.
Definition at line 695 of file matpackIII.cc.
References ConstTensor3View::mdata.
|
inline |
Set from a tensor type.
Definition at line 372 of file matpackIII.h.
References ConstTensor3View::shape().
Assignment operator from another tensor.
While dimensions of views can not be adjusted, dimensions of tensors can be adjusted. Hence, the behavior of the assignment operator is different.
In this case the size of the target is automatically adjusted. This is important, so that structures containing tensors are copied correctly.
This is a deviation from the old ARTS paradigm that sizes must match exactly before copying!
Note: It is sufficient to have only this one version of the assignment (Tensor = Tensor). It implicitly covers the cases Tensor=TensorView, etc, because there is a default constructor for Tensor from TensorView. (See C++ Primer Plus, page 571ff.)
m | The other tensor to assign to this one. |
Definition at line 627 of file matpackIII.cc.
References ConstTensor3View::mdata, ConstTensor3View::ncols(), ConstTensor3View::npages(), ConstTensor3View::nrows(), and resize().
Assignment operator from scalar.
Assignment operators are not inherited.
Definition at line 653 of file matpackIII.cc.
References ConstTensor3View::mdata, ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().
Move assignment operator from another tensor.
Definition at line 636 of file matpackIII.cc.
|
inline |
Reduce a Tensor3 to a Vector and leave this in an empty state
Definition at line 418 of file matpackIII.h.
References ARTS_ASSERT, ConstTensor3View::mdata, ConstTensor3View::ncols(), ConstTensor3View::npages(), ConstTensor3View::nrows(), ConstVectorView::size(), and ConstTensor3View::size().
Referenced by test48().
|
inline |
Reduce a Tensor3 to a Matrix and leave this in an empty state
Definition at line 432 of file matpackIII.h.
References ARTS_ASSERT, Range::get_extent(), ConstTensor3View::mdata, ConstTensor3View::ncols(), ConstTensor3View::npages(), ConstTensor3View::nrows(), ConstMatrixView::size(), and ConstTensor3View::size().
Resize function.
If the size is already correct this function does nothing. All data is lost after resizing! The new tensor is not initialized, so it will contain random values.
Definition at line 661 of file matpackIII.cc.
References ARTS_ASSERT, c, ConstTensor3View::mcr, ConstTensor3View::mdata, Range::mextent, ConstTensor3View::mpr, ConstTensor3View::mrr, Range::mstart, and Range::mstride.
Referenced by Append(), AtmFieldPRegrid(), AtmFieldsAndParticleBulkPropFieldFromCompact(), AtmFieldsCalc(), AtmFieldsCalcExpand1D(), AtmFieldsExpand1D(), AtmFieldsExtract1D(), Extract(), heating_ratesFromIrradiance(), iy_transmittance_mult(), iyClearsky(), iyEmissionHybrid(), iyEmissionStandard(), iyTransmissionStandard(), MagFieldsCalc(), MagFieldsCalcExpand1D(), MagFieldsFromAltitudeRawCalc(), MCGeneral(), nca_read_from_file(), operator=(), opt_prop_sptFromData(), opt_prop_sptFromScat_data(), OptimizeDoitPressureGrid(), pndFromPsd(), pndFromPsdBasic(), psdMilbrandtYau05(), psdSeifertBeheng06(), Reduce(), regrid_atmfield_by_gp(), regrid_atmfield_by_gp_oem(), GriddedField3::resize(), run_cdisort(), run_cdisort_flux(), spectral_radiance_fieldClearskyPlaneParallel(), surface_reflectivityFromGriddedField6(), Tensor3Add(), Tensor3ExtractFromTensor4(), Tensor3FromVector(), Tensor3Multiply(), Tensor3SetConstant(), water_p_eq_fieldMK05(), WindFieldsCalc(), WindFieldsCalcExpand1D(), xml_read_from_stream(), y_geo_swathFromY_geo(), and y_swathFromY().
|
inline |
Definition at line 447 of file matpackIII.h.
References ConstTensor3View::mdata, and ConstTensor3View::size().
Swaps two objects.
Definition at line 685 of file matpackIII.cc.