ARTS 2.5.10 (git: 2f1c442c)
Tensor4View Class Reference

The Tensor4View class. More...

#include <matpackIV.h>

Inheritance diagram for Tensor4View:
ConstTensor4View Tensor4

Public Member Functions

constexpr Tensor4View (const Tensor4View &)=default
 
Tensor4View operator() (const Range &b, const Range &p, const Range &r, const Range &c)
 Index operator for subrange.
 
Tensor3View operator() (const Range &b, const Range &p, const Range &r, Index c)
 Index operator returning an object of type Tensor3View.
 
Tensor3View operator() (const Range &b, const Range &p, Index r, const Range &c)
 Index operator returning an object of type Tensor3View.
 
Tensor3View operator() (const Range &b, Index p, const Range &r, const Range &c)
 Index operator returning an object of type Tensor3View.
 
Tensor3View operator() (Index b, const Range &p, const Range &r, const Range &c)
 Index operator returning an object of type Tensor3View.
 
MatrixView operator() (const Range &b, const Range &p, Index r, Index c)
 Index operator returning an object of type MatrixView.
 
MatrixView operator() (const Range &b, Index p, const Range &r, Index c)
 Index operator returning an object of type MatrixView.
 
MatrixView operator() (const Range &b, Index p, Index r, const Range &c)
 Index operator returning an object of type MatrixView.
 
MatrixView operator() (Index b, const Range &p, Index r, const Range &c)
 Index operator returning an object of type MatrixView.
 
MatrixView operator() (Index b, const Range &p, const Range &r, Index c)
 Index operator returning an object of type MatrixView.
 
MatrixView operator() (Index b, Index p, const Range &r, const Range &c)
 Index operator returning an object of type MatrixView.
 
VectorView operator() (const Range &b, Index p, Index r, Index c)
 Index operator returning an object of type VectorView.
 
VectorView operator() (Index b, const Range &p, Index r, Index c)
 Index operator returning an object of type VectorView.
 
VectorView operator() (Index b, Index p, const Range &r, Index c)
 Index operator returning an object of type VectorView.
 
VectorView operator() (Index b, Index p, Index r, const Range &c)
 Index operator returning an object of type VectorView.
 
Numericoperator() (Index b, Index p, Index r, Index c)
 Plain non-const index operator.
 
Numericget (Index b, Index p, Index r, Index c)
 Get element implementation without assertions.
 
const Numericget_c_array () const ARTS_NOEXCEPT
 Conversion to plain C-array.
 
Numericget_c_array () ARTS_NOEXCEPT
 Conversion to plain C-array.
 
Iterator4D begin ()
 Return iterator to first book.
 
Iterator4D end ()
 Return iterator behind last book.
 
Tensor4Viewoperator= (const ConstTensor4View &v)
 Assignment operator.
 
Tensor4Viewoperator= (const Tensor4View &v)
 Assignment from Tensor4View to Tensor4View.
 
Tensor4Viewoperator= (const Tensor4 &v)
 Assignment from a Tensor4.
 
Tensor4Viewoperator= (Numeric x)
 Assigning a scalar to a Tensor4View will set all elements to this value.
 
Tensor4Viewoperator*= (Numeric x)
 Multiplication by scalar.
 
Tensor4Viewoperator/= (Numeric x)
 Division by scalar.
 
Tensor4Viewoperator+= (Numeric x)
 Addition of scalar.
 
Tensor4Viewoperator-= (Numeric x)
 Subtraction of scalar.
 
Tensor4Viewoperator*= (const ConstTensor4View &x)
 Element-vise multiplication by another Tensor4.
 
Tensor4Viewoperator/= (const ConstTensor4View &x)
 Element-vise division by another Tensor4.
 
Tensor4Viewoperator+= (const ConstTensor4View &x)
 Element-vise addition of another Tensor4.
 
Tensor4Viewoperator-= (const ConstTensor4View &x)
 Element-vise subtraction of another Tensor4.
 
 ~Tensor4View () override=default
 Destructor.
 
 Tensor4View (const Tensor3View &a)
 Special constructor to make a Tensor4 view of a Tensor3.
 
ConstIterator4D begin () const
 Return const iterator to first book.
 
ConstIterator4D end () const
 Return const iterator behind last book.
 
Numeric get (Index b, Index p, Index r, Index c) const
 Get element implementation without assertions.
 
- Public Member Functions inherited from ConstTensor4View
constexpr ConstTensor4View (const ConstTensor4View &)=default
 
constexpr ConstTensor4View (ConstTensor4View &&)=default
 
ConstTensor4Viewoperator= (const ConstTensor4View &)=default
 
ConstTensor4Viewoperator= (ConstTensor4View &&)=default
 
Index nbooks () const noexcept
 
Index npages () const noexcept
 
Index nrows () const noexcept
 
Index ncols () const noexcept
 
Index size () const noexcept
 
bool empty () const noexcept
 
Shape< 4 > shape () const
 
ConstTensor4View operator() (const Range &b, const Range &p, const Range &r, const Range &c) const
 Const index operator for subrange.
 
ConstTensor3View operator() (const Range &b, const Range &p, const Range &r, Index c) const
 Const index operator returning an object of type ConstTensor3View.
 
ConstTensor3View operator() (const Range &b, const Range &p, Index r, const Range &c) const
 Const index operator returning an object of type ConstTensor3View.
 
ConstTensor3View operator() (const Range &b, Index p, const Range &r, const Range &c) const
 Const index operator returning an object of type ConstTensor3View.
 
ConstTensor3View operator() (Index b, const Range &p, const Range &r, const Range &c) const
 Const index operator returning an object of type ConstTensor3View.
 
ConstMatrixView operator() (const Range &b, const Range &p, Index r, Index c) const
 Const index operator returning an object of type ConstMatrixView.
 
ConstMatrixView operator() (const Range &b, Index p, const Range &r, Index c) const
 Const index operator returning an object of type ConstMatrixView.
 
ConstMatrixView operator() (const Range &b, Index p, Index r, const Range &c) const
 Const index operator returning an object of type ConstMatrixView.
 
ConstMatrixView operator() (Index b, const Range &p, Index r, const Range &c) const
 Const index operator returning an object of type ConstMatrixView.
 
ConstMatrixView operator() (Index b, const Range &p, const Range &r, Index c) const
 Const index operator returning an object of type ConstMatrixView.
 
ConstMatrixView operator() (Index b, Index p, const Range &r, const Range &c) const
 Const index operator returning an object of type ConstMatrixView.
 
ConstVectorView operator() (const Range &b, Index p, Index r, Index c) const
 Const index operator returning an object of type ConstVectorView.
 
ConstVectorView operator() (Index b, const Range &p, Index r, Index c) const
 Const index operator returning an object of type ConstVectorView.
 
ConstVectorView operator() (Index b, Index p, const Range &r, Index c) const
 Const index operator returning an object of type ConstVectorView.
 
ConstVectorView operator() (Index b, Index p, Index r, const Range &c) const
 Const index operator returning an object of type ConstVectorView.
 
Numeric operator() (Index b, Index p, Index r, Index c) const
 Plain const index operator.
 
Numeric get (Index b, Index p, Index r, Index c) const
 Get element implementation without assertions.
 
ConstIterator4D begin () const
 Return const iterator to first book.
 
ConstIterator4D end () const
 Return const iterator behind last book.
 
virtual ~ConstTensor4View ()=default
 Destructor.
 
 ConstTensor4View (const ConstTensor3View &a)
 Special constructor to make a Tensor4 view of a Tensor3.
 

Protected Member Functions

 Tensor4View ()=default
 
 Tensor4View (Numeric *data, const Range &b, const Range &p, const Range &r, const Range &c)
 Explicit constructor.
 
 Tensor4View (Numeric *data, const Range &pb, const Range &pp, const Range &pr, const Range &pc, const Range &nb, const Range &np, const Range &nr, const Range &nc)
 Recursive constructor.
 
- Protected Member Functions inherited from ConstTensor4View
 ConstTensor4View ()=default
 
 ConstTensor4View (Numeric *data, const Range &b, const Range &p, const Range &r, const Range &c)
 Explicit constructor.
 
 ConstTensor4View (Numeric *data, const Range &pb, const Range &pp, const Range &pr, const Range &pc, const Range &nb, const Range &np, const Range &nr, const Range &nc)
 Recursive constructor.
 

Friends

class Iterator5D
 
class Tensor5View
 
class Tensor6View
 
class Tensor7View
 

Additional Inherited Members

- Static Public Attributes inherited from ConstTensor4View
static constexpr bool matpack_type {true}
 
- Protected Attributes inherited from ConstTensor4View
Range mbr {0, 0, 1}
 The book range of mdata that is actually used.
 
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.
 
Numericmdata {nullptr}
 Pointer to the plain C array that holds the data.
 

Detailed Description

The Tensor4View class.

This contains the main implementation of a Tensor4. It defines the concepts of Tensor4View. Plus additionally the recursive subrange operator, which makes it possible to create a Tensor4View from a subrange of a Tensor4View.

The class Tensor4 is just a special case of a Tensor4View which also allocates storage.

Definition at line 296 of file matpackIV.h.

Constructor & Destructor Documentation

◆ Tensor4View() [1/5]

constexpr Tensor4View::Tensor4View ( const Tensor4View )
constexprdefault

◆ ~Tensor4View()

Tensor4View::~Tensor4View ( )
overridedefault

Destructor.

◆ Tensor4View() [2/5]

Tensor4View::Tensor4View ( const Tensor3View a)

Special constructor to make a Tensor4 view of a Tensor3.

Definition at line 861 of file matpackIV.cc.

◆ Tensor4View() [3/5]

Tensor4View::Tensor4View ( )
protecteddefault

Referenced by operator()().

◆ Tensor4View() [4/5]

Tensor4View::Tensor4View ( Numeric data,
const Range br,
const Range pr,
const Range rr,
const Range cr 
)
protected

Explicit constructor.

This one is used by Tensor4 to initialize its own Tensor4View part. The row range rr must have a stride to account for the length of one row.

Definition at line 874 of file matpackIV.cc.

◆ Tensor4View() [5/5]

Tensor4View::Tensor4View ( Numeric data,
const Range pb,
const Range pp,
const Range pr,
const Range pc,
const Range nb,
const Range np,
const Range nr,
const Range nc 
)
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.

Parameters
*dataThe actual data.
pbPrevious range.
ppPrevious range.
prPrevious range.
pcPrevious range.
nbNew Range.
npNew Range.
nrNew Range.
ncNew Range.

Definition at line 901 of file matpackIV.cc.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

ConstIterator4D ConstTensor4View::begin ( ) const

Return const iterator to first book.

Definition at line 237 of file matpackIV.cc.

◆ end() [1/2]

◆ end() [2/2]

ConstIterator4D ConstTensor4View::end ( ) const

Return const iterator behind last book.

Definition at line 238 of file matpackIV.cc.

◆ get() [1/2]

Numeric & Tensor4View::get ( Index  b,
Index  p,
Index  r,
Index  c 
)
inline

Get element implementation without assertions.

Definition at line 363 of file matpackIV.h.

References b, c, and GETFUN.

Referenced by interpweights().

◆ get() [2/2]

Numeric ConstTensor4View::get ( Index  b,
Index  p,
Index  r,
Index  c 
) const
inline

Get element implementation without assertions.

Definition at line 230 of file matpackIV.h.

◆ get_c_array() [1/2]

Numeric * Tensor4View::get_c_array ( )

Conversion to plain C-array.

This function returns a pointer to the raw data. It fails if the Tensor4View is not pointing to the beginning of a Tensor4 or the stride is not 1 because the caller expects to get a C array with continuous data.

Definition at line 318 of file matpackIV.cc.

References ARTS_ASSERT, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, Range::mstride, and ConstTensor4View::size().

◆ get_c_array() [2/2]

const Numeric * Tensor4View::get_c_array ( ) const

Conversion to plain C-array.

This function returns a pointer to the raw data. It fails if the Tensor4View is not pointing to the beginning of a Tensor4 or the stride is not 1 because the caller expects to get a C array with continuous data.

Definition at line 342 of file matpackIV.cc.

References ARTS_ASSERT, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, Range::mstride, and ConstTensor4View::size().

Referenced by nca_get_data(), nca_put_var(), nca_read_from_file(), nca_write_to_file(), Reduce(), WriteMolTau(), and xml_read_from_stream().

◆ operator()() [1/16]

Tensor4View Tensor4View::operator() ( const Range b,
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 Tensor4. This allows correct recursive behavior.

Definition at line 444 of file matpackIV.cc.

References b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, ConstTensor4View::mpr, ConstTensor4View::mrr, and Tensor4View().

◆ operator()() [2/16]

Tensor3View Tensor4View::operator() ( const Range b,
const Range p,
const Range r,
Index  c 
)

Index operator returning an object of type Tensor3View.

(Reducing the dimension by one.)

Definition at line 453 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [3/16]

Tensor3View Tensor4View::operator() ( const Range b,
const Range p,
Index  r,
const Range c 
)

Index operator returning an object of type Tensor3View.

(Reducing the dimension by one.)

Definition at line 467 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [4/16]

MatrixView Tensor4View::operator() ( const Range b,
const Range p,
Index  r,
Index  c 
)

Index operator returning an object of type MatrixView.

(Reducing the dimension by two.)

Definition at line 509 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [5/16]

Tensor3View Tensor4View::operator() ( const Range b,
Index  p,
const Range r,
const Range c 
)

Index operator returning an object of type Tensor3View.

(Reducing the dimension by one.)

Definition at line 481 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [6/16]

MatrixView Tensor4View::operator() ( const Range b,
Index  p,
const Range r,
Index  c 
)

Index operator returning an object of type MatrixView.

(Reducing the dimension by two.)

Definition at line 529 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [7/16]

MatrixView Tensor4View::operator() ( const Range b,
Index  p,
Index  r,
const Range c 
)

Index operator returning an object of type MatrixView.

(Reducing the dimension by two.)

Definition at line 549 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [8/16]

VectorView Tensor4View::operator() ( const Range b,
Index  p,
Index  r,
Index  c 
)

Index operator returning an object of type VectorView.

(Reducing the dimension by three.)

Definition at line 629 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [9/16]

Tensor3View Tensor4View::operator() ( Index  b,
const Range p,
const Range r,
const Range c 
)

Index operator returning an object of type Tensor3View.

(Reducing the dimension by one.)

Definition at line 495 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [10/16]

MatrixView Tensor4View::operator() ( Index  b,
const Range p,
const Range r,
Index  c 
)

Index operator returning an object of type MatrixView.

(Reducing the dimension by two.)

Definition at line 589 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [11/16]

MatrixView Tensor4View::operator() ( Index  b,
const Range p,
Index  r,
const Range c 
)

Index operator returning an object of type MatrixView.

(Reducing the dimension by two.)

Definition at line 569 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [12/16]

VectorView Tensor4View::operator() ( Index  b,
const Range p,
Index  r,
Index  c 
)

Index operator returning an object of type VectorView.

(Reducing the dimension by three.)

Definition at line 646 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [13/16]

MatrixView Tensor4View::operator() ( Index  b,
Index  p,
const Range r,
const Range c 
)

Index operator returning an object of type MatrixView.

(Reducing the dimension by two.)

Definition at line 609 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [14/16]

VectorView Tensor4View::operator() ( Index  b,
Index  p,
const Range r,
Index  c 
)

Index operator returning an object of type VectorView.

(Reducing the dimension by three.)

Definition at line 663 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [15/16]

VectorView Tensor4View::operator() ( Index  b,
Index  p,
Index  r,
const Range c 
)

Index operator returning an object of type VectorView.

Reducing the dimension by three.)

Definition at line 680 of file matpackIV.cc.

References ARTS_ASSERT, b, c, ConstTensor4View::mbr, ConstTensor4View::mcr, ConstTensor4View::mdata, Range::mextent, ConstTensor4View::mpr, ConstTensor4View::mrr, Range::mstart, and Range::mstride.

◆ operator()() [16/16]

Numeric & Tensor4View::operator() ( Index  b,
Index  p,
Index  r,
Index  c 
)
inline

Plain non-const index operator.

Definition at line 346 of file matpackIV.h.

References ARTS_ASSERT, b, c, GETFUN, ConstTensor4View::mbr, ConstTensor4View::mcr, Range::mextent, ConstTensor4View::mpr, and ConstTensor4View::mrr.

◆ operator*=() [1/2]

Tensor4View & Tensor4View::operator*= ( const ConstTensor4View x)

◆ operator*=() [2/2]

Tensor4View & Tensor4View::operator*= ( Numeric  x)

Multiplication by scalar.

Definition at line 765 of file matpackIV.cc.

References b, begin(), and end().

◆ operator+=() [1/2]

Tensor4View & Tensor4View::operator+= ( const ConstTensor4View x)

◆ operator+=() [2/2]

Tensor4View & Tensor4View::operator+= ( Numeric  x)

Addition of scalar.

Definition at line 783 of file matpackIV.cc.

References b, begin(), and end().

◆ operator-=() [1/2]

Tensor4View & Tensor4View::operator-= ( const ConstTensor4View x)

◆ operator-=() [2/2]

Tensor4View & Tensor4View::operator-= ( Numeric  x)

Subtraction of scalar.

Definition at line 792 of file matpackIV.cc.

References b, begin(), and end().

◆ operator/=() [1/2]

Tensor4View & Tensor4View::operator/= ( const ConstTensor4View x)

◆ operator/=() [2/2]

Tensor4View & Tensor4View::operator/= ( Numeric  x)

Division by scalar.

Definition at line 774 of file matpackIV.cc.

References b, begin(), and end().

◆ operator=() [1/4]

Tensor4View & Tensor4View::operator= ( const ConstTensor4View m)

Assignment operator.

This copies the data from another Tensor4View to this Tensor4View. Dimensions must agree! Resizing would destroy the selection that we might have done in this Tensor4View by setting its range.

Definition at line 713 of file matpackIV.cc.

References ARTS_ASSERT, begin(), ConstTensor4View::begin(), copy(), ConstTensor4View::end(), ConstTensor4View::mbr, ConstTensor4View::mcr, Range::mextent, ConstTensor4View::mpr, and ConstTensor4View::mrr.

◆ operator=() [2/4]

Tensor4View & Tensor4View::operator= ( const Tensor4 m)

Assignment from a Tensor4.

This must exist to overide the automatically generated assignment operators, which don't copy the contents!

Definition at line 743 of file matpackIV.cc.

References ARTS_ASSERT, begin(), copy(), end(), ConstTensor4View::mbr, ConstTensor4View::mcr, Range::mextent, ConstTensor4View::mpr, and ConstTensor4View::mrr.

◆ operator=() [3/4]

Tensor4View & Tensor4View::operator= ( const Tensor4View m)

Assignment from Tensor4View to Tensor4View.

This is a tricky one. The problem is that since Tensor4View is derived from ConstTensor4View, 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 729 of file matpackIV.cc.

References ARTS_ASSERT, begin(), copy(), end(), ConstTensor4View::mbr, ConstTensor4View::mcr, Range::mextent, ConstTensor4View::mpr, and ConstTensor4View::mrr.

◆ operator=() [4/4]

Tensor4View & Tensor4View::operator= ( Numeric  x)

Assigning a scalar to a Tensor4View will set all elements to this value.

Definition at line 756 of file matpackIV.cc.

References begin(), copy(), and end().

Friends And Related Function Documentation

◆ Iterator5D

friend class Iterator5D
friend

Definition at line 400 of file matpackIV.h.

◆ Tensor5View

friend class Tensor5View
friend

Definition at line 401 of file matpackIV.h.

◆ Tensor6View

friend class Tensor6View
friend

Definition at line 402 of file matpackIV.h.

◆ Tensor7View

friend class Tensor7View
friend

Definition at line 403 of file matpackIV.h.


The documentation for this class was generated from the following files: