ARTS  2.4.0(git:4fb77825)
Range Class Reference

The range class. More...

#include <matpackI.h>

Public Member Functions

constexpr Range (Index start, Index extent, Index stride=1)
 Explicit constructor. More...
 
constexpr Range (Index start, Joker, Index stride=1)
 Constructor with joker extent. More...
 
constexpr Range (Joker, Index stride=1)
 Constructor with just a joker. More...
 
constexpr Range (Index max_size, const Range &r)
 Constructor which converts a range with joker to an explicit range. More...
 
constexpr Range (const Range &p, const Range &n)
 Constructor of a new range relative to an old range. More...
 
constexpr Index get_start () const
 Returns the start index of the range. More...
 
constexpr Index get_extent () const
 Returns the extent of the range. More...
 
constexpr Index get_stride () const
 Returns the stride of the range. More...
 
constexpr Range operator() (const Range r) const
 Range of range. More...
 
constexpr Index operator() (const Index i) const
 

Private Attributes

Index mstart
 The start index. More...
 
Index mextent
 The number of elements. More...
 
Index mstride
 The stride. More...
 

Friends

class ConstVectorView
 
class VectorView
 
class Vector
 invlib wrapper type for ARTS vectors. More...
 
class ConstMatrixView
 
class MatrixView
 
class Matrix
 invlib wrapper type for ARTS matrices. More...
 
class Iterator2D
 
class Iterator3D
 
class Iterator4D
 
class Iterator5D
 
class Iterator6D
 
class Iterator7D
 
class ConstIterator2D
 
class ConstIterator3D
 
class ConstIterator4D
 
class ConstIterator5D
 
class ConstIterator6D
 
class ConstIterator7D
 
class ConstTensor3View
 
class Tensor3View
 
class Tensor3
 
class ConstTensor4View
 
class Tensor4View
 
class Tensor4
 
class ConstTensor5View
 
class Tensor5View
 
class Tensor5
 
class ConstTensor6View
 
class Tensor6View
 
class Tensor6
 
class ConstTensor7View
 
class Tensor7View
 
class Tensor7
 
class Sparse
 
class ConstComplexVectorView
 
class ComplexVectorView
 
class ComplexVector
 
class ConstComplexMatrixView
 
class ComplexMatrixView
 
class ComplexMatrix
 
class ComplexIterator2D
 
class ConstComplexIterator2D
 
void mult_general (VectorView, const ConstMatrixView &, const ConstVectorView &)
 Matrix Vector multiplication. More...
 

Detailed Description

The range class.

This is used to specifiy a range of a vector. In general, a range is given by a start index, an extent, and a stride. The entire vector would be: start = 0, range = # elements, stride = 1

Stride specifies the stepsize of the vector. A stride of 2 means only every second element. This is particularly important in connection with matrices.

There are a number of special constructors for this class, of particular interest should be those using jokers, which provide a Matlab-like functionality.

Definition at line 160 of file matpackI.h.

Constructor & Destructor Documentation

◆ Range() [1/5]

constexpr Range::Range ( Index  start,
Index  extent,
Index  stride = 1 
)
inlineconstexpr

Explicit constructor.

Parameters
[in]startStart must be >= 0.
[in]extentExtent also. Although internally negative extent means "to the end", this can not be created this way, only with the joker. Zero extent is allowed, though, which corresponds to an empty range.
[in]strideStride can be anything. It can be omitted, in which case the default value is 1.

Definition at line 175 of file matpackI.h.

References mextent, and mstart.

Referenced by operator()().

◆ Range() [2/5]

constexpr Range::Range ( Index  start,
Joker  ,
Index  stride = 1 
)
inlineconstexpr

Constructor with joker extent.

Depending on the sign of stride, this means "to the end", or "to the beginning".

Definition at line 190 of file matpackI.h.

References mstart.

◆ Range() [3/5]

constexpr Range::Range ( Joker  ,
Index  stride = 1 
)
inlineconstexpr

Constructor with just a joker.

This means, take everything. You can still optionally give a stride, though. This constructor is just shorter notation for Range(0,joker)

Definition at line 199 of file matpackI.h.

◆ Range() [4/5]

constexpr Range::Range ( Index  max_size,
const Range r 
)
inlineconstexpr

Constructor which converts a range with joker to an explicit range.

Parameters
[in]max_sizeThe maximum allowed size of the vector.
[in]rThe new range, with joker.

Definition at line 208 of file matpackI.h.

References mextent, mstart, and mstride.

◆ Range() [5/5]

constexpr Range::Range ( const Range p,
const Range n 
)
inlineconstexpr

Constructor of a new range relative to an old range.

The new range may contain -1 for the stride, which acts as a joker.

Parameters
[in]pPrevious range.
[in]nNew range.

Definition at line 239 of file matpackI.h.

References mextent, mstart, and mstride.

Member Function Documentation

◆ get_extent()

constexpr Index Range::get_extent ( ) const
inlineconstexpr

◆ get_start()

constexpr Index Range::get_start ( ) const
inlineconstexpr

◆ get_stride()

constexpr Index Range::get_stride ( ) const
inlineconstexpr

Returns the stride of the range.

Definition at line 331 of file matpackI.h.

References mstride.

Referenced by lubacksub(), MapToEigen(), MapToEigen4x4(), MapToEigenCol(), mult(), and operator<<().

◆ operator()() [1/2]

constexpr Index Range::operator() ( const Index  i) const
inlineconstexpr

Definition at line 346 of file matpackI.h.

References mstart, and mstride.

◆ operator()() [2/2]

constexpr Range Range::operator() ( const Range  r) const
inlineconstexpr

Range of range.

Definition at line 334 of file matpackI.h.

References joker, mextent, mstart, mstride, and Range().

Friends And Related Function Documentation

◆ ComplexIterator2D

friend class ComplexIterator2D
friend

Definition at line 317 of file matpackI.h.

◆ ComplexMatrix

friend class ComplexMatrix
friend

Definition at line 316 of file matpackI.h.

◆ ComplexMatrixView

friend class ComplexMatrixView
friend

Definition at line 315 of file matpackI.h.

◆ ComplexVector

friend class ComplexVector
friend

Definition at line 313 of file matpackI.h.

◆ ComplexVectorView

friend class ComplexVectorView
friend

Definition at line 312 of file matpackI.h.

◆ ConstComplexIterator2D

friend class ConstComplexIterator2D
friend

Definition at line 318 of file matpackI.h.

◆ ConstComplexMatrixView

friend class ConstComplexMatrixView
friend

Definition at line 314 of file matpackI.h.

◆ ConstComplexVectorView

friend class ConstComplexVectorView
friend

Definition at line 311 of file matpackI.h.

◆ ConstIterator2D

friend class ConstIterator2D
friend

Definition at line 289 of file matpackI.h.

◆ ConstIterator3D

friend class ConstIterator3D
friend

Definition at line 290 of file matpackI.h.

◆ ConstIterator4D

friend class ConstIterator4D
friend

Definition at line 291 of file matpackI.h.

◆ ConstIterator5D

friend class ConstIterator5D
friend

Definition at line 292 of file matpackI.h.

◆ ConstIterator6D

friend class ConstIterator6D
friend

Definition at line 293 of file matpackI.h.

◆ ConstIterator7D

friend class ConstIterator7D
friend

Definition at line 294 of file matpackI.h.

◆ ConstMatrixView

friend class ConstMatrixView
friend

Definition at line 280 of file matpackI.h.

◆ ConstTensor3View

friend class ConstTensor3View
friend

Definition at line 295 of file matpackI.h.

◆ ConstTensor4View

friend class ConstTensor4View
friend

Definition at line 298 of file matpackI.h.

◆ ConstTensor5View

friend class ConstTensor5View
friend

Definition at line 301 of file matpackI.h.

◆ ConstTensor6View

friend class ConstTensor6View
friend

Definition at line 304 of file matpackI.h.

◆ ConstTensor7View

friend class ConstTensor7View
friend

Definition at line 307 of file matpackI.h.

◆ ConstVectorView

friend class ConstVectorView
friend

Definition at line 277 of file matpackI.h.

◆ Iterator2D

friend class Iterator2D
friend

Definition at line 283 of file matpackI.h.

◆ Iterator3D

friend class Iterator3D
friend

Definition at line 284 of file matpackI.h.

◆ Iterator4D

friend class Iterator4D
friend

Definition at line 285 of file matpackI.h.

◆ Iterator5D

friend class Iterator5D
friend

Definition at line 286 of file matpackI.h.

◆ Iterator6D

friend class Iterator6D
friend

Definition at line 287 of file matpackI.h.

◆ Iterator7D

friend class Iterator7D
friend

Definition at line 288 of file matpackI.h.

◆ Matrix

friend class Matrix
friend

invlib wrapper type for ARTS matrices.

Definition at line 282 of file matpackI.h.

◆ MatrixView

friend class MatrixView
friend

Definition at line 281 of file matpackI.h.

◆ mult_general

void mult_general ( VectorView  y,
const ConstMatrixView M,
const ConstVectorView x 
)
friend

Matrix Vector multiplication.

y = M*x. Note that the order is different from MTL, output comes first! Dimensions of y, M, and x must match. No memory reallocation takes place, only the data is copied. Using this function on overlapping Matrix and VectorViews belonging to the same Matrix will lead to unpredictable results.

The implementation here is different from the other multiplication routines. It does not use iterators but a more drastic approach to gain maximum performance.

Definition at line 1181 of file matpackI.cc.

◆ Sparse

friend class Sparse
friend

Definition at line 310 of file matpackI.h.

◆ Tensor3

friend class Tensor3
friend

Definition at line 297 of file matpackI.h.

◆ Tensor3View

friend class Tensor3View
friend

Definition at line 296 of file matpackI.h.

◆ Tensor4

friend class Tensor4
friend

Definition at line 300 of file matpackI.h.

◆ Tensor4View

friend class Tensor4View
friend

Definition at line 299 of file matpackI.h.

◆ Tensor5

friend class Tensor5
friend

Definition at line 303 of file matpackI.h.

◆ Tensor5View

friend class Tensor5View
friend

Definition at line 302 of file matpackI.h.

◆ Tensor6

friend class Tensor6
friend

Definition at line 306 of file matpackI.h.

◆ Tensor6View

friend class Tensor6View
friend

Definition at line 305 of file matpackI.h.

◆ Tensor7

friend class Tensor7
friend

Definition at line 309 of file matpackI.h.

◆ Tensor7View

friend class Tensor7View
friend

Definition at line 308 of file matpackI.h.

◆ Vector

friend class Vector
friend

invlib wrapper type for ARTS vectors.

Definition at line 279 of file matpackI.h.

◆ VectorView

friend class VectorView
friend

Definition at line 278 of file matpackI.h.

Member Data Documentation

◆ mextent

Index Range::mextent
private

The number of elements.

-1 means extent to the end of the vector.

Definition at line 353 of file matpackI.h.

Referenced by ComplexMatrixView::diagonal(), ConstComplexMatrixView::diagonal(), ConstMatrixView::diagonal(), ComplexVectorView::end(), ComplexMatrixView::end(), VectorView::end(), MatrixView::end(), Tensor3View::end(), Tensor4View::end(), Tensor5View::end(), Tensor6View::end(), Tensor7View::end(), ConstComplexVectorView::end(), ConstComplexMatrixView::end(), ConstVectorView::end(), ConstMatrixView::end(), ConstTensor3View::end(), ConstTensor4View::end(), ConstTensor5View::end(), ConstTensor6View::end(), ConstTensor7View::end(), Tensor3View::get_c_array(), Tensor4View::get_c_array(), Tensor5View::get_c_array(), Tensor6View::get_c_array(), Tensor7View::get_c_array(), ComplexMatrixView::get_c_array(), MatrixView::get_c_array(), get_extent(), ComplexVectorView::imag(), ComplexMatrixView::imag(), ConstTensor4View::nbooks(), ConstTensor5View::nbooks(), ConstTensor6View::nbooks(), ConstTensor7View::nbooks(), ConstComplexMatrixView::ncols(), ConstMatrixView::ncols(), ConstTensor3View::ncols(), ConstTensor4View::ncols(), ConstTensor5View::ncols(), ConstTensor6View::ncols(), ConstTensor7View::ncols(), ConstComplexVectorView::nelem(), ConstVectorView::nelem(), ConstTensor7View::nlibraries(), ConstTensor3View::npages(), ConstTensor4View::npages(), ConstTensor5View::npages(), ConstTensor6View::npages(), ConstTensor7View::npages(), ConstComplexMatrixView::nrows(), ConstMatrixView::nrows(), ConstTensor3View::nrows(), ConstTensor4View::nrows(), ConstTensor5View::nrows(), ConstTensor6View::nrows(), ConstTensor7View::nrows(), ConstTensor5View::nshelves(), ConstTensor6View::nshelves(), ConstTensor7View::nshelves(), ConstTensor6View::nvitrines(), ConstTensor7View::nvitrines(), operator()(), ComplexMatrixView::operator=(), ComplexVectorView::operator=(), MatrixView::operator=(), Tensor3View::operator=(), Tensor4View::operator=(), Tensor5View::operator=(), Tensor6View::operator=(), Tensor7View::operator=(), VectorView::operator=(), ComplexVectorView::operator[](), VectorView::operator[](), ConstComplexVectorView::operator[](), ConstVectorView::operator[](), Range(), ComplexVectorView::real(), ComplexMatrixView::real(), ComplexVector::resize(), and Vector::resize().

◆ mstart

Index Range::mstart
private

The start index.

Definition at line 350 of file matpackI.h.

Referenced by ComplexVectorView::begin(), ComplexMatrixView::begin(), VectorView::begin(), MatrixView::begin(), Tensor3View::begin(), Tensor4View::begin(), Tensor5View::begin(), Tensor6View::begin(), Tensor7View::begin(), ConstComplexVectorView::begin(), ConstComplexMatrixView::begin(), ConstVectorView::begin(), ConstMatrixView::begin(), ConstTensor3View::begin(), ConstTensor4View::begin(), ConstTensor5View::begin(), ConstTensor6View::begin(), ConstTensor7View::begin(), ComplexMatrixView::diagonal(), ConstComplexMatrixView::diagonal(), ConstMatrixView::diagonal(), ComplexVectorView::end(), ComplexMatrixView::end(), VectorView::end(), MatrixView::end(), Tensor3View::end(), Tensor4View::end(), Tensor5View::end(), Tensor6View::end(), Tensor7View::end(), ConstComplexVectorView::end(), ConstComplexMatrixView::end(), ConstVectorView::end(), ConstMatrixView::end(), ConstTensor3View::end(), ConstTensor4View::end(), ConstTensor5View::end(), ConstTensor6View::end(), ConstTensor7View::end(), ComplexVectorView::get(), VectorView::get(), Tensor3View::get_c_array(), Tensor4View::get_c_array(), Tensor5View::get_c_array(), Tensor6View::get_c_array(), Tensor7View::get_c_array(), ComplexVectorView::get_c_array(), ComplexMatrixView::get_c_array(), VectorView::get_c_array(), MatrixView::get_c_array(), get_start(), ComplexVectorView::imag(), ComplexMatrixView::imag(), ComplexIterator2D::operator!=(), ConstComplexIterator2D::operator!=(), ConstIterator2D::operator!=(), ConstIterator3D::operator!=(), ConstIterator4D::operator!=(), ConstIterator5D::operator!=(), ConstIterator6D::operator!=(), ConstIterator7D::operator!=(), Iterator2D::operator!=(), Iterator3D::operator!=(), Iterator4D::operator!=(), Iterator5D::operator!=(), Iterator6D::operator!=(), Iterator7D::operator!=(), operator()(), Range(), ComplexVectorView::real(), ComplexMatrixView::real(), and ComplexVector::resize().

◆ mstride

Index Range::mstride
private

The stride.

Can be positive or negative.

Definition at line 355 of file matpackI.h.

Referenced by ComplexVectorView::begin(), ComplexMatrixView::begin(), VectorView::begin(), MatrixView::begin(), Tensor3View::begin(), Tensor4View::begin(), Tensor5View::begin(), Tensor6View::begin(), Tensor7View::begin(), ConstComplexVectorView::begin(), ConstComplexMatrixView::begin(), ConstVectorView::begin(), ConstMatrixView::begin(), ConstTensor3View::begin(), ConstTensor4View::begin(), ConstTensor5View::begin(), ConstTensor6View::begin(), ConstTensor7View::begin(), ComplexMatrixView::diagonal(), ConstComplexMatrixView::diagonal(), ConstMatrixView::diagonal(), ComplexVectorView::end(), ComplexMatrixView::end(), VectorView::end(), MatrixView::end(), Tensor3View::end(), Tensor4View::end(), Tensor5View::end(), Tensor6View::end(), Tensor7View::end(), ConstComplexVectorView::end(), ConstComplexMatrixView::end(), ConstVectorView::end(), ConstMatrixView::end(), ConstTensor3View::end(), ConstTensor4View::end(), ConstTensor5View::end(), ConstTensor6View::end(), ConstTensor7View::end(), ComplexVectorView::get(), VectorView::get(), Tensor3View::get_c_array(), Tensor4View::get_c_array(), Tensor5View::get_c_array(), Tensor6View::get_c_array(), Tensor7View::get_c_array(), ComplexVectorView::get_c_array(), ComplexMatrixView::get_c_array(), VectorView::get_c_array(), MatrixView::get_c_array(), get_stride(), ComplexVectorView::imag(), ComplexMatrixView::imag(), operator()(), Range(), ComplexVectorView::real(), ComplexMatrixView::real(), and ComplexVector::resize().


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