ARTS
1.0.222
|
#include <matpackI.h>
Public Member Functions | |
Vector () | |
Default constructor. More... | |
Vector (Index n) | |
Constructor setting size. More... | |
Vector (Index n, Numeric fill) | |
Constructor setting size and filling with constant value. More... | |
Vector (Numeric start, Index extent, Numeric stride) | |
Constructor filling with values. More... | |
Vector (const ConstVectorView &v) | |
Copy constructor from VectorView. More... | |
Vector (const Vector &v) | |
Copy constructor from Vector. More... | |
Vector & | operator= (const Vector &v) |
Assignment from another Vector. More... | |
Vector & | operator= (const Array< Numeric > &v) |
Assignment operator from Array<Numeric>. More... | |
Vector & | operator= (Numeric x) |
Assignment operator from scalar. More... | |
void | resize (Index n) |
Resize function. More... | |
~Vector () | |
Destructor for Vector. More... | |
![]() | |
Numeric | operator[] (Index n) const |
Plain const index operator. More... | |
ConstVectorView | operator[] (const Range &r) const |
Const index operator for subrange. More... | |
Numeric & | operator[] (Index n) |
Plain Index operator. More... | |
VectorView | operator[] (const Range &r) |
Index operator for subrange. More... | |
ConstIterator1D | begin () const |
Return const iterator to first element. More... | |
ConstIterator1D | end () const |
Return const iterator behind last element. More... | |
Iterator1D | begin () |
Return iterator to first element. More... | |
Iterator1D | end () |
Return iterator behind last element. More... | |
VectorView | operator= (const ConstVectorView &v) |
Assignment operator. More... | |
VectorView | operator= (const VectorView &v) |
Assignment from VectorView to VectorView. More... | |
VectorView | operator= (const Vector &v) |
Assignment from Vector. More... | |
VectorView | operator= (const Array< Numeric > &v) |
Assignment operator from Array<Numeric>. More... | |
VectorView | operator= (Numeric x) |
Assigning a scalar to a VectorView will set all elements to this value. More... | |
VectorView | operator*= (Numeric x) |
Multiplication by scalar. More... | |
VectorView | operator/= (Numeric x) |
Division by scalar. More... | |
VectorView | operator+= (Numeric x) |
Addition of scalar. More... | |
VectorView | operator-= (Numeric x) |
Subtraction of scalar. More... | |
VectorView | operator*= (const ConstVectorView &x) |
Element-vise multiplication by another vector. More... | |
VectorView | operator/= (const ConstVectorView &x) |
Element-vise division by another vector. More... | |
VectorView | operator+= (const ConstVectorView &x) |
Element-vise addition of another vector. More... | |
VectorView | operator-= (const ConstVectorView &x) |
Element-vise subtraction of another vector. More... | |
operator MatrixView () | |
Conversion to 1 column matrix. More... | |
![]() | |
Index | nelem () const |
Returns the number of elements. More... | |
Numeric | sum () const |
The sum of all elements of a Vector. More... | |
Numeric | operator[] (Index n) const |
Plain const index operator. More... | |
ConstVectorView | operator[] (const Range &r) const |
Const index operator for subrange. More... | |
ConstIterator1D | begin () const |
Return const iterator to first element. More... | |
ConstIterator1D | end () const |
Return const iterator behind last element. More... | |
operator ConstMatrixView () const | |
Conversion to const 1 column matrix. More... | |
Additional Inherited Members | |
![]() | |
VectorView () | |
Default constructor. More... | |
VectorView (Numeric *data, const Range &range) | |
Explicit constructor. More... | |
VectorView (Numeric *data, const Range &p, const Range &n) | |
Recursive constructor. More... | |
![]() | |
ConstVectorView () | |
Default constructor. More... | |
ConstVectorView (Numeric *data, const Range &range) | |
Explicit constructor. More... | |
ConstVectorView (Numeric *data, const Range &p, const Range &n) | |
Recursive constructor. More... | |
![]() | |
Range | mrange |
The range of mdata that is actually used. More... | |
Numeric * | mdata |
Pointer to the plain C array that holds the data. More... | |
The Vector class.
This is a subvector that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from VectorView. Additionally defined in this class are:
It seems that we need no assignment operator from VectorView or Vector, because the one of VectorView is used.
Definition at line 389 of file matpackI.h.
|
inline |
Default constructor.
Definition at line 1341 of file matpackI.h.
|
inlineexplicit |
Constructor setting size.
Definition at line 1347 of file matpackI.h.
Constructor setting size and filling with constant value.
Definition at line 1355 of file matpackI.h.
Constructor filling with values.
Examples:
Vector v(1,5,1); // 1, 2, 3, 4, 5 Vector v(1,5,.5); // 1, 1.5, 2, 2.5, 3 Vector v(5,5,-1); // 5, 4, 3, 2, 1
Definition at line 1373 of file matpackI.h.
|
inline |
Copy constructor from VectorView.
This automatically sets the size and copies the data. The vector created will have start zero and stride 1, independent on how these parameters are set for the original. So, what is copied is the data, not the shape of the selection.
Definition at line 1393 of file matpackI.h.
|
inline |
Copy constructor from Vector.
This is important to override the automatically generated shallow constructor. We want deep copies!
Definition at line 1402 of file matpackI.h.
|
inline |
Destructor for Vector.
This is important, since Vector uses new to allocate storage.
Definition at line 1481 of file matpackI.h.
Assignment operator from Array<Numeric>.
This copies the data from a 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.
Assignment operators are not inherited, so we have to make an explicit call to:
VectorView VectorView::operator=(const Array<Numeric>& v)
here.
Definition at line 1439 of file matpackI.h.
Assignment from another Vector.
Important to avoid segmentation fault for x = Vector(n);
Definition at line 1413 of file matpackI.h.
Assignment operator from scalar.
Assignment operators are not inherited.
Definition at line 1447 of file matpackI.h.
|
inline |
Resize function.
If the size is already correct this function does nothing. All data is lost after resizing! The new Vector is not initialized, so it will contain random values.
Definition at line 1467 of file matpackI.h.