ARTS  1.0.222
Public Member Functions | Private Attributes | Friends | List of all members
Range Class Reference

The range class. More...

#include <matpackI.h>

Public Member Functions

 Range (Index start, Index extent, Index stride=1)
 
 Range (Index start, Joker joker, Index stride=1)
 Constructor with joker extent. More...
 
 Range (Joker joker, Index stride=1)
 Constructor with just a joker. More...
 
 Range (Index max_size, const Range &r)
 Constructor which converts a range with joker to an explicit range. More...
 
 Range (const Range &p, const Range &n)
 Constructor of a new range relative to an old range. More...
 

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
 
class ConstMatrixView
 
class MatrixView
 
class Matrix
 
class Iterator2D
 
class Iterator3D
 
class ConstIterator2D
 
class ConstIterator3D
 
class SparseMatrixView
 
class ConstTensor3View
 
class Tensor3View
 
class Tensor3
 
std::ostream & operator<< (std::ostream &os, const SparseMatrixView &v)
 

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 139 of file matpackI.h.

Constructor & Destructor Documentation

◆ Range() [1/5]

Range::Range ( Index  start,
Index  extent,
Index  stride = 1 
)
inline

Definition at line 611 of file matpackI.h.

◆ Range() [2/5]

Range::Range ( Index  start,
Joker  joker,
Index  stride = 1 
)
inline

Constructor with joker extent.

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

Definition at line 627 of file matpackI.h.

◆ Range() [3/5]

Range::Range ( Joker  joker,
Index  stride = 1 
)
inline

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 637 of file matpackI.h.

◆ Range() [4/5]

Range::Range ( Index  max_size,
const Range r 
)
inline

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

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

Definition at line 648 of file matpackI.h.

◆ Range() [5/5]

Range::Range ( const Range p,
const Range n 
)
inline

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
pPrevious range.
nNew range.

Definition at line 685 of file matpackI.h.

Friends And Related Function Documentation

◆ ConstIterator2D

friend class ConstIterator2D
friend

Definition at line 157 of file matpackI.h.

◆ ConstIterator3D

friend class ConstIterator3D
friend

Definition at line 158 of file matpackI.h.

◆ ConstMatrixView

friend class ConstMatrixView
friend

Definition at line 152 of file matpackI.h.

◆ ConstTensor3View

friend class ConstTensor3View
friend

Definition at line 160 of file matpackI.h.

◆ ConstVectorView

friend class ConstVectorView
friend

Definition at line 149 of file matpackI.h.

◆ Iterator2D

friend class Iterator2D
friend

Definition at line 155 of file matpackI.h.

◆ Iterator3D

friend class Iterator3D
friend

Definition at line 156 of file matpackI.h.

◆ Matrix

friend class Matrix
friend

Definition at line 154 of file matpackI.h.

◆ MatrixView

friend class MatrixView
friend

Definition at line 153 of file matpackI.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const SparseMatrixView v 
)
friend

◆ SparseMatrixView

friend class SparseMatrixView
friend

Definition at line 159 of file matpackI.h.

◆ Tensor3

friend class Tensor3
friend

Definition at line 162 of file matpackI.h.

◆ Tensor3View

friend class Tensor3View
friend

Definition at line 161 of file matpackI.h.

◆ Vector

friend class Vector
friend

Definition at line 151 of file matpackI.h.

◆ VectorView

friend class VectorView
friend

Definition at line 150 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 171 of file matpackI.h.

◆ mstart

Index Range::mstart
private

The start index.

Definition at line 168 of file matpackI.h.

◆ mstride

Index Range::mstride
private

The stride.

Can be positive or negative.

Definition at line 173 of file matpackI.h.


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