ARTS
2.4.0(git:4fb77825)
|
The ComplexVector class. More...
#include <complex.h>
Public Member Functions | |
ComplexVector () | |
Default constructor. More... | |
ComplexVector (Index n) | |
Constructor setting size. More... | |
ComplexVector (Index n, Complex fill) | |
Constructor setting size and filling with constant value. More... | |
ComplexVector (Index n, Numeric fill) | |
Constructor setting size and filling with constant value. More... | |
ComplexVector (Complex start, Index extent, Complex stride) | |
Constructor filling with values. More... | |
ComplexVector (Complex start, Index extent, Numeric stride) | |
Constructor filling with values. More... | |
ComplexVector (Numeric start, Index extent, Complex stride) | |
Constructor filling with values. More... | |
ComplexVector (Numeric start, Index extent, Numeric stride) | |
Constructor filling with values. More... | |
ComplexVector (const ConstComplexVectorView &v) | |
Copy constructor from ComplexVectorView. More... | |
ComplexVector (const ComplexVector &v) | |
Copy constructor from ComplexVector. More... | |
ComplexVector (const Vector &v) | |
ComplexVector (const std::vector< Complex > &) | |
Converting constructor from std::vector. More... | |
ComplexVector (const std::vector< Numeric > &) | |
Converting constructor from std::vector. More... | |
ComplexVector & | operator= (ComplexVector v) |
Assignment from another Vector. More... | |
ComplexVector & | operator= (const Array< Complex > &v) |
Assignment operator from Array<Numeric>. More... | |
ComplexVector & | operator= (Complex x) |
Assignment operator from scalar. More... | |
void | resize (Index n) |
Resize function. More... | |
virtual | ~ComplexVector () |
Destructor for ComplexVector. More... | |
Public Member Functions inherited from ComplexVectorView | |
constexpr | ComplexVectorView (const ComplexVectorView &)=default |
ComplexVectorView (const ComplexVector &) | |
Bail out immediately if somebody tries to create a ComplexVectorView from a const Complex*Vector. More... | |
ComplexVectorView (ComplexVector &v) | |
Create ComplexVectorView from a ComplexVector. More... | |
Complex & | operator[] (Index n) |
Plain Index operator. More... | |
Complex & | get (Index n) |
Get element implementation without assertions. More... | |
Numeric & | get_real (Index n) |
Get element implementation without assertions. More... | |
Numeric & | get_imag (Index n) |
Get element implementation without assertions. More... | |
VectorView | real () |
Get a view of the real part of the vector. More... | |
VectorView | imag () |
Get a view of the imaginary part of the vector. More... | |
ComplexVectorView | operator[] (const Range &r) |
Index operator for subrange. More... | |
ComplexIterator1D | begin () |
Return iterator to first element. More... | |
ComplexIterator1D | end () |
Return iterator behind last element. More... | |
ComplexVectorView & | operator= (const ConstComplexVectorView &v) |
Assignment operator. More... | |
ComplexVectorView & | operator= (const ComplexVectorView &v) |
Assignment from ComplexVectorView to ComplexVectorView. More... | |
ComplexVectorView & | operator= (const ComplexVector &v) |
Assignment from ComplexVector. More... | |
ComplexVectorView & | operator= (const Array< Complex > &v) |
Assignment operator from Array<Complex>. More... | |
ComplexVectorView & | operator= (Complex x) |
Assigning a scalar to a ComplexVectorView will set all elements to this value. More... | |
ComplexVectorView & | operator= (const ConstVectorView &v) |
ComplexVectorView & | operator= (const VectorView &v) |
ComplexVectorView & | operator= (const Vector &v) |
ComplexVectorView & | operator= (const Array< Numeric > &v) |
ComplexVectorView & | operator= (Numeric x) |
ComplexVectorView | operator*= (Complex x) |
Multiplication by scalar. More... | |
ComplexVectorView | operator/= (Complex x) |
Division by scalar. More... | |
ComplexVectorView | operator+= (Complex x) |
Addition of scalar. More... | |
ComplexVectorView | operator-= (Complex x) |
Subtraction of scalar. More... | |
ComplexVectorView | operator*= (Numeric x) |
Multiplication by scalar. More... | |
ComplexVectorView | operator/= (Numeric x) |
Division by scalar. More... | |
ComplexVectorView | operator+= (Numeric x) |
Addition of scalar. More... | |
ComplexVectorView | operator-= (Numeric x) |
Subtraction of scalar. More... | |
ComplexVectorView | operator*= (const ConstComplexVectorView &x) |
Element-vise multiplication by another vector. More... | |
ComplexVectorView | operator/= (const ConstComplexVectorView &x) |
Element-vise division by another vector. More... | |
ComplexVectorView | operator+= (const ConstComplexVectorView &x) |
Element-vise addition of another vector. More... | |
ComplexVectorView | operator-= (const ConstComplexVectorView &x) |
Element-vise subtraction of another vector. More... | |
ComplexVectorView | operator*= (const ConstVectorView &x) |
Element-vise multiplication by another vector. More... | |
ComplexVectorView | operator/= (const ConstVectorView &x) |
Element-vise division by another vector. More... | |
ComplexVectorView | operator+= (const ConstVectorView &x) |
Element-vise addition of another vector. More... | |
ComplexVectorView | operator-= (const ConstVectorView &x) |
Element-vise subtraction of another vector. More... | |
operator ComplexMatrixView () | |
Conversion to 1 column matrix. More... | |
const Complex * | get_c_array () const |
Conversion to plain C-array. More... | |
Complex * | get_c_array () |
Conversion to plain C-array. More... | |
virtual | ~ComplexVectorView ()=default |
Destructor. More... | |
ComplexVectorView (Complex &a) | |
A special constructor, which allows to make a VectorView from a scalar. More... | |
ConstComplexIterator1D | begin () const |
Return const iterator to first element. More... | |
ConstComplexIterator1D | end () const |
Return const iterator behind last element. More... | |
const Complex & | get (Index n) const |
Get element implementation without assertions. More... | |
const Numeric & | get_imag (Index n) const |
Get element implementation without assertions. More... | |
const Numeric & | get_real (Index n) const |
Get element implementation without assertions. More... | |
ConstVectorView | imag () const |
Get a view of the imaginary part of the vector. More... | |
ConstVectorView | real () const |
Get a view of the real part of the vector. More... | |
Public Member Functions inherited from ConstComplexVectorView | |
constexpr | ConstComplexVectorView (const ConstComplexVectorView &)=default |
constexpr | ConstComplexVectorView (ConstComplexVectorView &&)=default |
ConstComplexVectorView & | operator= (const ConstComplexVectorView &)=default |
ConstComplexVectorView & | operator= (ConstComplexVectorView &&)=default |
bool | empty () const |
Index | nelem () const |
Complex | sum () const |
Returns true if variable size is zero. More... | |
const Complex & | operator[] (Index n) const |
Plain const index operator. More... | |
const Complex & | get (Index n) const |
Get element implementation without assertions. More... | |
const Numeric & | get_real (Index n) const |
Get element implementation without assertions. More... | |
const Numeric & | get_imag (Index n) const |
Get element implementation without assertions. More... | |
ConstVectorView | real () const |
Get a view of the real part of the vector. More... | |
ConstVectorView | imag () const |
Get a view of the imaginary part of the vector. More... | |
ConstComplexVectorView | operator[] (const Range &r) const |
Const index operator for subrange. More... | |
ConstComplexIterator1D | begin () const |
Return const iterator to first element. More... | |
ConstComplexIterator1D | end () const |
Return const iterator behind last element. More... | |
operator ConstComplexMatrixView () const | |
Conversion to const 1 column matrix. More... | |
virtual | ~ConstComplexVectorView ()=default |
Destructor. More... | |
ConstComplexVectorView (const Complex &a) | |
A special constructor, which allows to make a ConstComplexVectorView from a scalar. More... | |
Friends | |
void | swap (ComplexVector &v1, ComplexVector &v2) |
Swaps two objects. More... | |
Additional Inherited Members | |
Public Types inherited from ComplexVectorView | |
typedef ComplexIterator1D | iterator |
Public Types inherited from ConstComplexVectorView | |
typedef ConstComplexIterator1D | const_iterator |
Protected Member Functions inherited from ComplexVectorView | |
ComplexVectorView ()=default | |
ComplexVectorView (Complex *data, const Range &range) | |
Explicit constructor. More... | |
ComplexVectorView (Complex *data, const Range &p, const Range &n) | |
Recursive constructor. More... | |
Protected Member Functions inherited from ConstComplexVectorView | |
ConstComplexVectorView ()=default | |
ConstComplexVectorView (Complex *data, const Range &range) | |
Explicit constructor. More... | |
ConstComplexVectorView (Complex *data, const Range &p, const Range &n) | |
Recursive constructor. More... | |
Protected Attributes inherited from ConstComplexVectorView | |
Range | mrange {0, 0} |
The range of mdata that is actually used. More... | |
Complex * | mdata {nullptr} |
Pointer to the plain C array that holds the data. More... | |
The ComplexVector class.
This is a subvector that also allocates storage automatically, and deallocates it when it is destroyed. We take * all the functionality from ComplexVectorView. Additionally defined in this class are:
ComplexVector::ComplexVector | ( | ) |
Default constructor.
Definition at line 498 of file complex.cc.
|
explicit |
Constructor setting size.
Definition at line 503 of file complex.cc.
Constructor setting size and filling with constant value.
Definition at line 509 of file complex.cc.
References ConstComplexVectorView::mdata, and ARTS::Var::x().
Constructor setting size and filling with constant value.
Definition at line 518 of file complex.cc.
References ConstComplexVectorView::mdata, and ARTS::Var::x().
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 534 of file complex.cc.
References ComplexVectorView::begin(), Zeeman::start(), and ARTS::Var::x().
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 574 of file complex.cc.
References ComplexVectorView::begin(), Zeeman::start(), and ARTS::Var::x().
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 554 of file complex.cc.
References ComplexVectorView::begin(), Zeeman::start(), and ARTS::Var::x().
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 594 of file complex.cc.
References ComplexVectorView::begin(), Zeeman::start(), and ARTS::Var::x().
ComplexVector::ComplexVector | ( | const ConstComplexVectorView & | v | ) |
Copy constructor from ComplexVectorView.
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 611 of file complex.cc.
References ComplexVectorView::begin(), ConstComplexVectorView::begin(), copy(), and ConstComplexVectorView::end().
ComplexVector::ComplexVector | ( | const ComplexVector & | v | ) |
Copy constructor from ComplexVector.
This is important to override the automatically generated shallow constructor. We want deep copies!
Definition at line 618 of file complex.cc.
References ComplexVectorView::begin(), copy(), and ComplexVectorView::end().
ComplexVector::ComplexVector | ( | const Vector & | v | ) |
ComplexVector::ComplexVector | ( | const std::vector< Complex > & | v | ) |
Converting constructor from std::vector.
Definition at line 624 of file complex.cc.
References ComplexVectorView::begin(), and ComplexVectorView::end().
ComplexVector::ComplexVector | ( | const std::vector< Numeric > & | v | ) |
Converting constructor from std::vector.
Definition at line 635 of file complex.cc.
References ComplexVectorView::begin(), and ComplexVectorView::end().
|
virtual |
Destructor for ComplexVector.
This is important, since Vector uses new to allocate storage.
Definition at line 738 of file complex.cc.
References ConstComplexVectorView::mdata.
ComplexVector & ComplexVector::operator= | ( | Complex | x | ) |
Assignment operator from scalar.
Assignment operators are not inherited.
Definition at line 700 of file complex.cc.
ComplexVector & ComplexVector::operator= | ( | ComplexVector | v | ) |
Assignment from another Vector.
While dimensions of VectorViews can not be adjusted, dimensions of Vectors can be adjusted. Hence, the behavior of the assignment operator is different.
In this case the size of the target is automatically adjusted. This is important, so that structures containing Vectors are copied correctly.
This is a deviation from the old ARTS paradigm that sizes must match exactly before copying!
Note: It is sufficient to have only this one version of the assignment (Vector = Vector). It implicitly covers the cases Vector=VectorView, etc, because there is a default constructor for Vector from VectorView. (See C++ Primer Plus, page 571ff.)
v | The other vector to copy to this one. |
Definition at line 670 of file complex.cc.
References swap.
ComplexVector & ComplexVector::operator= | ( | const Array< Complex > & | x | ) |
Assignment operator from Array<Numeric>.
This copies the data from a Array<Numeric> to this VectorView. The size is adjusted automatically.
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.
x | The array to assign to this. |
Definition at line 692 of file complex.cc.
References resize(), and ARTS::Var::x().
void ComplexVector::resize | ( | Index | n | ) |
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 719 of file complex.cc.
References ConstComplexVectorView::mdata, Range::mextent, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.
Referenced by operator=().
|
friend |