VectorView Class Reference

The VectorView class. More...

#include <matpackI.h>

Inheritance diagram for VectorView:

ConstVectorView Vector MakeVector

List of all members.

Public Member Functions

Numeric operator[] (Index n) const
 Plain const index operator.
ConstVectorView operator[] (const Range &r) const
 Const index operator for subrange.
Numericoperator[] (Index n)
 Plain Index operator.
VectorView operator[] (const Range &r)
 Index operator for subrange.
ConstIterator1D begin () const
 Return const iterator to first element.
ConstIterator1D end () const
 Return const iterator behind last element.
Iterator1D begin ()
 Return iterator to first element.
Iterator1D end ()
 Return iterator behind last element.
VectorView operator= (const ConstVectorView &v)
 Assignment operator.
VectorView operator= (const VectorView &v)
 Assignment from VectorView to VectorView.
VectorView operator= (const Vector &v)
 Assignment from Vector.
VectorView operator= (const Array< Numeric > &v)
 Assignment operator from Array<Numeric>.
VectorView operator= (Numeric x)
 Assigning a scalar to a VectorView will set all elements to this value.
VectorView operator*= (Numeric x)
 Multiplication by scalar.
VectorView operator/= (Numeric x)
 Division by scalar.
VectorView operator+= (Numeric x)
 Addition of scalar.
VectorView operator-= (Numeric x)
 Subtraction of scalar.
VectorView operator*= (const ConstVectorView &x)
 Element-vise multiplication by another vector.
VectorView operator/= (const ConstVectorView &x)
 Element-vise division by another vector.
VectorView operator+= (const ConstVectorView &x)
 Element-vise addition of another vector.
VectorView operator-= (const ConstVectorView &x)
 Element-vise subtraction of another vector.
 operator MatrixView ()
 Conversion to 1 column matrix.

Protected Member Functions

 VectorView ()
 Default constructor.
 VectorView (Numeric *data, const Range &range)
 Explicit constructor.
 VectorView (Numeric *data, const Range &p, const Range &n)
 Recursive constructor.

Friends

class ConstIterator2D
class Iterator2D
class MatrixView
class Tensor3View


Detailed Description

The VectorView class.

This contains the main implementation of a vector. The class Vector is just a special case of subvector which also allocates storage.

Unfortunately, names of element functions of derived classes hide the names of the original class, even if the arguments are different. This means that we have to redefine those element functions that can have different arguments, for example the constant index operators and iterators.

Definition at line 281 of file matpackI.h.


Constructor & Destructor Documentation

VectorView::VectorView (  )  [inline, protected]

Default constructor.

This is necessary, so that we can have a default constructor for the derived class Vector.

Definition at line 1282 of file matpackI.h.

VectorView::VectorView ( Numeric data,
const Range range 
) [inline, protected]

Explicit constructor.

This one is used by Vector to initialize its own VectorView part.

Definition at line 1290 of file matpackI.h.

VectorView::VectorView ( Numeric data,
const Range p,
const Range n 
) [inline, protected]

Recursive constructor.

This is used to construct sub ranges from sub ranges. That means that the new range has to be interpreted relative to the original range. The new range 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:
*data The actual data.
p Previous range.
n New Range.

Definition at line 1307 of file matpackI.h.


Member Function Documentation

Numeric VectorView::operator[] ( Index  n  )  const [inline]

Plain const index operator.

Has to be redifined here, because the one from ConstVectorView is hidden.

Reimplemented from ConstVectorView.

Definition at line 1059 of file matpackI.h.

ConstVectorView VectorView::operator[] ( const Range r  )  const [inline]

Const index operator for subrange.

We have to also account for the case, that *this is already a subrange of a Vector. This allows correct recursive behavior. Has to be redifined here, because the one from ConstVectorView is hidden.

Reimplemented from ConstVectorView.

Definition at line 1068 of file matpackI.h.

Numeric & VectorView::operator[] ( Index  n  )  [inline]

Plain Index operator.

Definition at line 1074 of file matpackI.h.

VectorView VectorView::operator[] ( const Range r  )  [inline]

Index operator for subrange.

We have to also account for the case, that *this is already a subrange of a Vector. This allows correct recursive behavior.

Definition at line 1087 of file matpackI.h.

ConstIterator1D VectorView::begin (  )  const [inline]

Return const iterator to first element.

Has to be redefined here, since it is hiden by the non-const operator of the derived class.

Reimplemented from ConstVectorView.

Definition at line 1095 of file matpackI.h.

ConstIterator1D VectorView::end (  )  const [inline]

Return const iterator behind last element.

Has to be redefined here, since it is hiden by the non-const operator of the derived class.

Reimplemented from ConstVectorView.

Definition at line 1103 of file matpackI.h.

Iterator1D VectorView::begin (  )  [inline]

Return iterator to first element.

Definition at line 1109 of file matpackI.h.

Iterator1D VectorView::end (  )  [inline]

Return iterator behind last element.

Definition at line 1115 of file matpackI.h.

VectorView VectorView::operator= ( const ConstVectorView v  )  [inline]

Assignment operator.

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

Definition at line 1127 of file matpackI.h.

VectorView VectorView::operator= ( const VectorView v  )  [inline]

Assignment from VectorView to VectorView.

This is a tricky one. The problem is that since VectorView is derived from ConstVectorView, 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 1144 of file matpackI.h.

VectorView VectorView::operator= ( const Vector v  )  [inline]

Assignment from Vector.

This is important to avoid a bug when assigning a Vector to a VectorView.

Reimplemented in Vector.

Definition at line 1158 of file matpackI.h.

VectorView VectorView::operator= ( const Array< Numeric > &  v  ) 

Assignment operator from Array<Numeric>.

This copies the data from an Array<Numeric> to this VectorView. Dimensions must agree! Resizing would destroy the selection that we might have done in this VectorView by setting its range.

Array<Numeric> can be useful to collect things in, because there is a .push_back method for it. Then, after collecting we usually have to transfer the content to a Vector. With this assignment operator that's easy.

Reimplemented in Vector.

Definition at line 41 of file matpackI.cc.

VectorView VectorView::operator= ( Numeric  x  )  [inline]

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

Reimplemented in Vector.

Definition at line 1172 of file matpackI.h.

VectorView VectorView::operator*= ( Numeric  x  )  [inline]

Multiplication by scalar.

Definition at line 1179 of file matpackI.h.

VectorView VectorView::operator/= ( Numeric  x  )  [inline]

Division by scalar.

Definition at line 1188 of file matpackI.h.

VectorView VectorView::operator+= ( Numeric  x  )  [inline]

Addition of scalar.

Definition at line 1197 of file matpackI.h.

VectorView VectorView::operator-= ( Numeric  x  )  [inline]

Subtraction of scalar.

Definition at line 1206 of file matpackI.h.

VectorView VectorView::operator*= ( const ConstVectorView x  )  [inline]

Element-vise multiplication by another vector.

Definition at line 1215 of file matpackI.h.

VectorView VectorView::operator/= ( const ConstVectorView x  )  [inline]

Element-vise division by another vector.

Definition at line 1230 of file matpackI.h.

VectorView VectorView::operator+= ( const ConstVectorView x  )  [inline]

Element-vise addition of another vector.

Definition at line 1245 of file matpackI.h.

VectorView VectorView::operator-= ( const ConstVectorView x  )  [inline]

Element-vise subtraction of another vector.

Definition at line 1260 of file matpackI.h.

VectorView::operator MatrixView (  )  [inline]

Conversion to 1 column matrix.

Definition at line 1275 of file matpackI.h.


Friends And Related Function Documentation

friend class ConstIterator2D [friend]

Reimplemented from ConstVectorView.

Definition at line 320 of file matpackI.h.

friend class Iterator2D [friend]

Definition at line 321 of file matpackI.h.

friend class MatrixView [friend]

Definition at line 322 of file matpackI.h.

friend class Tensor3View [friend]

Definition at line 323 of file matpackI.h.


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

Generated on Wed Feb 4 08:17:40 2009 for ARTS by  doxygen 1.5.6