ARTS 2.5.10 (git: 2f1c442c)
|
The ComplexVectorView class. More...
#include <matpack_complex.h>
Public Types | |
using | iterator = ComplexIterator1D |
![]() | |
using | const_iterator = ConstComplexIterator1D |
Public Member Functions | |
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 |
Protected Member Functions | |
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. | |
Friends | |
class | ConstComplexIterator2D |
class | ComplexIterator2D |
class | ComplexMatrixView |
Additional Inherited Members | |
![]() | |
static constexpr bool | matpack_type {true} |
![]() | |
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 ComplexVectorView class.
This contains the main implementation of a complex vector. The class
ComplexVector 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 392 of file matpack_complex.h.
Definition at line 409 of file matpack_complex.h.
|
constexprdefault |
ComplexVectorView::ComplexVectorView | ( | const ComplexVector & | ) |
Bail out immediately if somebody tries to create a ComplexVectorView from a const Complex*Vector.
Definition at line 153 of file matpack_complex.cc.
References ARTS_ASSERT.
ComplexVectorView::ComplexVectorView | ( | ComplexVector & | v | ) |
Create ComplexVectorView from a ComplexVector.
Definition at line 164 of file matpack_complex.cc.
References ConstComplexVectorView::mdata, ConstComplexVectorView::mrange, and v.
|
overridedefault |
Destructor.
ComplexVectorView::ComplexVectorView | ( | Complex & | a | ) |
A special constructor, which allows to make a VectorView from a scalar.
Definition at line 424 of file matpack_complex.cc.
|
protecteddefault |
Referenced by operator[]().
Explicit constructor.
This one is used by Vector to initialize its own VectorView part.
Definition at line 430 of file matpack_complex.cc.
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.
*data | The actual data. |
p | Previous range. |
n | New Range. |
Definition at line 445 of file matpack_complex.cc.
ComplexIterator1D ComplexVectorView::begin | ( | ) |
Return iterator to first element.
Definition at line 177 of file matpack_complex.cc.
References ConstComplexVectorView::mdata, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.
Referenced by ComplexVector::ComplexVector(), copy(), operator*=(), ComplexMatrixView::operator*=(), operator+=(), ComplexMatrixView::operator+=(), operator-=(), ComplexMatrixView::operator-=(), operator/=(), ComplexMatrixView::operator/=(), and operator=().
ConstComplexIterator1D ConstComplexVectorView::begin | ( | ) | const |
Return const iterator to first element.
Definition at line 337 of file matpack_complex.cc.
ComplexIterator1D ComplexVectorView::end | ( | ) |
Return iterator behind last element.
Definition at line 182 of file matpack_complex.cc.
References ConstComplexVectorView::mdata, Range::mextent, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.
Referenced by ComplexVector::ComplexVector(), copy(), operator*=(), ComplexMatrixView::operator*=(), operator+=(), ComplexMatrixView::operator+=(), operator-=(), ComplexMatrixView::operator-=(), operator/=(), ComplexMatrixView::operator/=(), and operator=().
ConstComplexIterator1D ConstComplexVectorView::end | ( | ) | const |
Return const iterator behind last element.
Definition at line 338 of file matpack_complex.cc.
Get element implementation without assertions.
Definition at line 419 of file matpack_complex.h.
References ConstComplexVectorView::mdata, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.
Referenced by get_imag(), ComplexMatrixView::get_imag(), ConstComplexMatrixView::get_imag(), get_real(), ComplexMatrixView::get_real(), ConstComplexMatrixView::get_real(), ConstComplexMatrixView::operator()(), and operator[]().
Get element implementation without assertions.
Definition at line 312 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 429 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 322 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 424 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 317 of file matpack_complex.h.
VectorView ComplexVectorView::imag | ( | ) |
Get a view of the imaginary part of the vector.
Definition at line 674 of file matpack_complex.cc.
References ConstComplexVectorView::mdata, Range::mextent, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.
Referenced by get_imag(), and ComplexMatrixView::get_imag().
ConstVectorView ConstComplexVectorView::imag | ( | ) | const |
Get a view of the imaginary part of the vector.
Definition at line 330 of file matpack_complex.cc.
ComplexVectorView::operator ComplexMatrixView | ( | ) |
Conversion to 1 column matrix.
Definition at line 412 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator*= | ( | Complex | x | ) |
Multiplication by scalar.
Definition at line 248 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator*= | ( | const ConstComplexVectorView & | x | ) |
Element-vise multiplication by another vector.
Definition at line 304 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), ConstComplexVectorView::begin(), end(), and ConstComplexVectorView::nelem().
ComplexVectorView ComplexVectorView::operator*= | ( | const ConstVectorView & | x | ) |
Element-vise multiplication by another vector.
Definition at line 318 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), ConstVectorView::begin(), end(), ConstComplexVectorView::nelem(), and ConstVectorView::nelem().
ComplexVectorView ComplexVectorView::operator*= | ( | Numeric | x | ) |
Multiplication by scalar.
Definition at line 255 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator+= | ( | Complex | x | ) |
Addition of scalar.
Definition at line 276 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator+= | ( | const ConstComplexVectorView & | x | ) |
Element-vise addition of another vector.
Definition at line 358 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), ConstComplexVectorView::begin(), end(), and ConstComplexVectorView::nelem().
ComplexVectorView ComplexVectorView::operator+= | ( | const ConstVectorView & | x | ) |
Element-vise addition of another vector.
Definition at line 372 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), ConstVectorView::begin(), end(), ConstComplexVectorView::nelem(), and ConstVectorView::nelem().
ComplexVectorView ComplexVectorView::operator+= | ( | Numeric | x | ) |
Addition of scalar.
Definition at line 283 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator-= | ( | Complex | x | ) |
Subtraction of scalar.
Definition at line 290 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator-= | ( | const ConstComplexVectorView & | x | ) |
Element-vise subtraction of another vector.
Definition at line 385 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), ConstComplexVectorView::begin(), end(), and ConstComplexVectorView::nelem().
ComplexVectorView ComplexVectorView::operator-= | ( | const ConstVectorView & | x | ) |
Element-vise subtraction of another vector.
Definition at line 399 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), ConstVectorView::begin(), end(), ConstComplexVectorView::nelem(), and ConstVectorView::nelem().
ComplexVectorView ComplexVectorView::operator-= | ( | Numeric | x | ) |
Subtraction of scalar.
Definition at line 297 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator/= | ( | Complex | x | ) |
Division by scalar.
Definition at line 262 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator/= | ( | const ConstComplexVectorView & | x | ) |
Element-vise division by another vector.
Definition at line 331 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator/= | ( | const ConstVectorView & | x | ) |
Element-vise division by another vector.
Definition at line 345 of file matpack_complex.cc.
References ARTS_ASSERT, ConstVectorView::begin(), ConstComplexVectorView::nelem(), and ConstVectorView::nelem().
ComplexVectorView ComplexVectorView::operator/= | ( | Numeric | x | ) |
Division by scalar.
Definition at line 269 of file matpack_complex.cc.
ComplexVectorView & ComplexVectorView::operator= | ( | Complex | x | ) |
Assigning a scalar to a ComplexVectorView will set all elements to this value.
Definition at line 235 of file matpack_complex.cc.
ComplexVectorView & ComplexVectorView::operator= | ( | const Array< Complex > & | v | ) |
Assignment operator from Array<Complex>.
This copies the data from an Array<Complex> to this VectorView. Dimensions must agree! Resizing would destroy the selection that we might have done in this VectorView by setting its range.
Array<Complex> 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.
Definition at line 1535 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), Range::mextent, ConstComplexVectorView::mrange, and v.
ComplexVectorView & ComplexVectorView::operator= | ( | const Array< Numeric > & | v | ) |
ComplexVectorView & ComplexVectorView::operator= | ( | const ComplexVector & | v | ) |
Assignment from ComplexVector.
This is important to avoid a bug when assigning a Vector to a Complex*VectorView.
Definition at line 222 of file matpack_complex.cc.
ComplexVectorView & ComplexVectorView::operator= | ( | const ComplexVectorView & | v | ) |
Assignment from ComplexVectorView to ComplexVectorView.
This is a tricky one. The problem is that since ComplexVectorView is derived from ConstComplexVectorView, 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 209 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), copy(), Range::mextent, ConstComplexVectorView::mrange, and v.
ComplexVectorView & ComplexVectorView::operator= | ( | const ConstComplexVectorView & | v | ) |
Assignment operator.
This copies the data from another VectorView t o this Complex*VectorView. Dimensions must agree! Resizing would destroy the selection that we might have done in this VectorView by setting its range.
Definition at line 192 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), copy(), Range::mextent, ConstComplexVectorView::mrange, and v.
Referenced by ComplexVector::operator=().
ComplexVectorView & ComplexVectorView::operator= | ( | const ConstVectorView & | v | ) |
ComplexVectorView & ComplexVectorView::operator= | ( | const Vector & | v | ) |
ComplexVectorView & ComplexVectorView::operator= | ( | const VectorView & | v | ) |
ComplexVectorView & ComplexVectorView::operator= | ( | Numeric | x | ) |
Assigning a scalar to a ComplexVectorView will set all elements to this value.
Definition at line 242 of file matpack_complex.cc.
ComplexVectorView ComplexVectorView::operator[] | ( | const Range & | r | ) |
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 172 of file matpack_complex.cc.
References ComplexVectorView(), ConstComplexVectorView::mdata, and ConstComplexVectorView::mrange.
Plain Index operator.
Definition at line 412 of file matpack_complex.h.
References ARTS_ASSERT, get(), Range::mextent, and ConstComplexVectorView::mrange.
VectorView ComplexVectorView::real | ( | ) |
Get a view of the real part of the vector.
Definition at line 668 of file matpack_complex.cc.
References ConstComplexVectorView::mdata, Range::mextent, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.
Referenced by lm_hitran_2017::convtp(), Absorption::LineMixing::ecs_absorption_impl(), get_real(), ComplexMatrixView::get_real(), lm_hitran_2017::hitran_lm_eigenvalue_approximation(), propmat_clearskyAddLines(), and Absorption::LineMixing::EquivalentLines::sort_by_frequency().
ConstVectorView ConstComplexVectorView::real | ( | ) | const |
Get a view of the real part of the vector.
Definition at line 327 of file matpack_complex.cc.
|
friend |
Definition at line 484 of file matpack_complex.h.
|
friend |
Definition at line 485 of file matpack_complex.h.
|
friend |
Definition at line 483 of file matpack_complex.h.