ARTS 2.5.10 (git: 2f1c442c)
|
The ComplexVector class. More...
#include <matpack_complex.h>
Public Member Functions | |
ComplexVector ()=default | |
ComplexVector (ComplexVector &&cv) noexcept | |
ComplexVector (Index n) | |
Constructor setting size. | |
ComplexVector (Index n, Complex fill) | |
Constructor setting size and filling with constant value. | |
ComplexVector (Index n, Numeric fill) | |
Constructor setting size and filling with constant value. | |
ComplexVector (Complex start, Index extent, Complex stride) | |
Constructor filling with values. | |
ComplexVector (Complex start, Index extent, Numeric stride) | |
Constructor filling with values. | |
ComplexVector (Numeric start, Index extent, Complex stride) | |
Constructor filling with values. | |
ComplexVector (Numeric start, Index extent, Numeric stride) | |
Constructor filling with values. | |
ComplexVector (const ConstComplexVectorView &v) | |
Copy constructor from ComplexVectorView. | |
ComplexVector (const ComplexVector &v) | |
Copy constructor from ComplexVector. | |
ComplexVector (const Vector &v) | |
ComplexVector (const std::vector< Complex > &) | |
Converting constructor from std::vector. | |
ComplexVector (const std::vector< Numeric > &) | |
Converting constructor from std::vector. | |
ComplexVector (Complex *c, const Range &r0) ARTS_NOEXCEPT | |
ComplexVector (const matpack::vector_like_not_vector auto &init) | |
Initialization from a vector type. | |
Shape< 1 > | shape () const |
ComplexVector & | operator= (const ComplexVector &v) |
Assignment from another Vector. | |
ComplexVector & | operator= (const Array< Complex > &v) |
Assignment operator from Array<Numeric>. | |
ComplexVector & | operator= (Complex x) |
Assignment operator from scalar. | |
ComplexVector & | operator= (const matpack::vector_like_not_vector auto &init) |
Set from a vector type. | |
ComplexVector & | operator= (ComplexVector &&v) ARTS_NOEXCEPT |
void | resize (Index n) |
Resize function. | |
~ComplexVector () noexcept override | |
Destructor for ComplexVector. | |
![]() | |
constexpr | ComplexVectorView (const ComplexVectorView &)=default |
ComplexVectorView (const ComplexVector &) | |
Bail out immediately if somebody tries to create a ComplexVectorView from a const Complex*Vector. | |
ComplexVectorView (ComplexVector &v) | |
Create ComplexVectorView from a ComplexVector. | |
Complex & | operator[] (Index n) |
Plain Index operator. | |
Complex & | get (Index n) |
Get element implementation without assertions. | |
Numeric & | get_real (Index n) |
Get element implementation without assertions. | |
Numeric & | get_imag (Index n) |
Get element implementation without assertions. | |
VectorView | real () |
Get a view of the real part of the vector. | |
VectorView | imag () |
Get a view of the imaginary part of the vector. | |
ComplexVectorView | operator[] (const Range &r) |
Index operator for subrange. | |
ComplexIterator1D | begin () |
Return iterator to first element. | |
ComplexIterator1D | end () |
Return iterator behind last element. | |
ComplexVectorView & | operator= (const ConstComplexVectorView &v) |
Assignment operator. | |
ComplexVectorView & | operator= (const ComplexVectorView &v) |
Assignment from ComplexVectorView to ComplexVectorView. | |
ComplexVectorView & | operator= (const ComplexVector &v) |
Assignment from ComplexVector. | |
ComplexVectorView & | operator= (const Array< Complex > &v) |
Assignment operator from Array<Complex>. | |
ComplexVectorView & | operator= (Complex x) |
Assigning a scalar to a ComplexVectorView will set all elements to this value. | |
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) |
Assigning a scalar to a ComplexVectorView will set all elements to this value. | |
ComplexVectorView | operator*= (Complex x) |
Multiplication by scalar. | |
ComplexVectorView | operator/= (Complex x) |
Division by scalar. | |
ComplexVectorView | operator+= (Complex x) |
Addition of scalar. | |
ComplexVectorView | operator-= (Complex x) |
Subtraction of scalar. | |
ComplexVectorView | operator*= (Numeric x) |
Multiplication by scalar. | |
ComplexVectorView | operator/= (Numeric x) |
Division by scalar. | |
ComplexVectorView | operator+= (Numeric x) |
Addition of scalar. | |
ComplexVectorView | operator-= (Numeric x) |
Subtraction of scalar. | |
ComplexVectorView | operator*= (const ConstComplexVectorView &x) |
Element-vise multiplication by another vector. | |
ComplexVectorView | operator/= (const ConstComplexVectorView &x) |
Element-vise division by another vector. | |
ComplexVectorView | operator+= (const ConstComplexVectorView &x) |
Element-vise addition of another vector. | |
ComplexVectorView | operator-= (const ConstComplexVectorView &x) |
Element-vise subtraction of another vector. | |
ComplexVectorView | operator*= (const ConstVectorView &x) |
Element-vise multiplication by another vector. | |
ComplexVectorView | operator/= (const ConstVectorView &x) |
Element-vise division by another vector. | |
ComplexVectorView | operator+= (const ConstVectorView &x) |
Element-vise addition of another vector. | |
ComplexVectorView | operator-= (const ConstVectorView &x) |
Element-vise subtraction of another vector. | |
operator ComplexMatrixView () | |
Conversion to 1 column matrix. | |
~ComplexVectorView () override=default | |
Destructor. | |
ComplexVectorView (Complex &a) | |
A special constructor, which allows to make a VectorView from a scalar. | |
ConstComplexIterator1D | begin () const |
Return const iterator to first element. | |
ConstComplexIterator1D | end () const |
Return const iterator behind last element. | |
const Complex & | get (Index n) const |
Get element implementation without assertions. | |
const Numeric & | get_imag (Index n) const |
Get element implementation without assertions. | |
const Numeric & | get_real (Index n) const |
Get element implementation without assertions. | |
ConstVectorView | imag () const |
Get a view of the imaginary part of the vector. | |
ConstVectorView | real () const |
Get a view of the real part of the vector. | |
![]() | |
constexpr | ConstComplexVectorView (const ConstComplexVectorView &)=default |
constexpr | ConstComplexVectorView (ConstComplexVectorView &&)=default |
ConstComplexVectorView & | operator= (const ConstComplexVectorView &)=default |
ConstComplexVectorView & | operator= (ConstComplexVectorView &&)=default |
bool | empty () const noexcept |
Index | nelem () const noexcept |
Index | size () const noexcept |
Complex | sum () const |
Returns true if variable size is zero. | |
const Complex & | operator[] (Index n) const |
Plain const index operator. | |
const Complex & | get (Index n) const |
Get element implementation without assertions. | |
const Numeric & | get_real (Index n) const |
Get element implementation without assertions. | |
const Numeric & | get_imag (Index n) const |
Get element implementation without assertions. | |
ConstVectorView | real () const |
Get a view of the real part of the vector. | |
ConstVectorView | imag () const |
Get a view of the imaginary part of the vector. | |
ConstComplexVectorView | operator[] (const Range &r) const |
Const index operator for subrange. | |
ConstComplexIterator1D | begin () const |
Return const iterator to first element. | |
ConstComplexIterator1D | end () const |
Return const iterator behind last element. | |
operator ConstComplexMatrixView () const | |
Conversion to const 1 column matrix. | |
virtual | ~ConstComplexVectorView ()=default |
Destructor. | |
ConstComplexVectorView (const Complex &a) | |
A special constructor, which allows to make a ConstComplexVectorView from a scalar. | |
Index | selem () const noexcept |
Start element in memory. | |
Index | delem () const noexcept |
Steps in memory between elements. | |
Complex * | get_c_array () const noexcept |
Friends | |
void | swap (ComplexVector &v1, ComplexVector &v2) noexcept |
Swaps two objects. | |
Additional Inherited Members | |
![]() | |
using | iterator = ComplexIterator1D |
![]() | |
using | const_iterator = ConstComplexIterator1D |
![]() | |
static constexpr bool | matpack_type {true} |
![]() | |
ComplexVectorView ()=default | |
ComplexVectorView (Complex *data, const Range &range) | |
Explicit constructor. | |
ComplexVectorView (Complex *data, const Range &p, const Range &n) | |
Recursive constructor. | |
![]() | |
ConstComplexVectorView ()=default | |
ConstComplexVectorView (Complex *data, const Range &range) | |
Explicit constructor. | |
ConstComplexVectorView (Complex *data, const Range &p, const Range &n) | |
Recursive constructor. | |
![]() | |
Range | mrange {0, 0} |
The range of mdata that is actually used. | |
Complex * | mdata {nullptr} |
Pointer to the plain C array that holds the data. | |
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:
Definition at line 593 of file matpack_complex.h.
|
default |
|
inlinenoexcept |
Definition at line 597 of file matpack_complex.h.
|
explicit |
Constructor setting size.
Definition at line 476 of file matpack_complex.cc.
Constructor setting size and filling with constant value.
Definition at line 482 of file matpack_complex.cc.
References ConstComplexVectorView::mdata.
Constructor setting size and filling with constant value.
Definition at line 491 of file matpack_complex.cc.
References ConstComplexVectorView::mdata.
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 507 of file matpack_complex.cc.
References ComplexVectorView::begin(), and ComplexVectorView::end().
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 547 of file matpack_complex.cc.
References ComplexVectorView::begin(), and ComplexVectorView::end().
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 527 of file matpack_complex.cc.
References ComplexVectorView::begin(), and ComplexVectorView::end().
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 567 of file matpack_complex.cc.
References ComplexVectorView::begin(), and ComplexVectorView::end().
|
explicit |
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 584 of file matpack_complex.cc.
References ComplexVectorView::begin(), copy(), and v.
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 591 of file matpack_complex.cc.
References ComplexVectorView::begin(), copy(), and v.
|
explicit |
Definition at line 596 of file matpack_complex.cc.
References ConstComplexVectorView::nelem(), and v.
|
explicit |
Converting constructor from std::vector.
Definition at line 601 of file matpack_complex.cc.
References ComplexVectorView::begin(), and v.
|
explicit |
Converting constructor from std::vector.
Definition at line 612 of file matpack_complex.cc.
References ComplexVectorView::begin(), and v.
Definition at line 612 of file matpack_complex.h.
References ARTS_ASSERT.
|
inlineexplicit |
Initialization from a vector type.
Definition at line 618 of file matpack_complex.h.
|
overridenoexcept |
Destructor for ComplexVector.
This is important, since Vector uses new to allocate storage.
Definition at line 769 of file matpack_complex.cc.
References ConstComplexVectorView::mdata.
ComplexVector & ComplexVector::operator= | ( | Complex | x | ) |
Assignment operator from scalar.
Assignment operators are not inherited.
Definition at line 730 of file matpack_complex.cc.
References ComplexVectorView::operator=().
|
inline |
Definition at line 641 of file matpack_complex.h.
References ConstComplexVectorView::mdata, ConstComplexVectorView::mrange, and v.
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 722 of file matpack_complex.cc.
References Array< base >::nelem(), ComplexVectorView::operator=(), and resize().
ComplexVector & ComplexVector::operator= | ( | const 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 647 of file matpack_complex.cc.
References resize(), matpack::eigen::row_vec(), and v.
|
inline |
Set from a vector type.
Definition at line 631 of file matpack_complex.h.
References resize(), shape(), and ConstComplexVectorView::size().
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 749 of file matpack_complex.cc.
References ARTS_ASSERT.
Referenced by operator=().
|
inline |
Definition at line 623 of file matpack_complex.h.
References ConstComplexVectorView::nelem().
Referenced by operator=().
|
friend |
Swaps two objects.
Definition at line 761 of file matpack_complex.cc.