ARTS 2.5.4 (git: 31ce4f0e)
ComplexVectorView Class Reference

The ComplexVectorView class. More...

#include <matpack_complex.h>

Inheritance diagram for ComplexVectorView:
ConstComplexVectorView ComplexVector

Public Types

using iterator = ComplexIterator1D
 
- Public Types inherited from ConstComplexVectorView
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. More...
 
 ComplexVectorView (ComplexVector &v)
 Create ComplexVectorView from a ComplexVector. More...
 
Complexoperator[] (Index n)
 Plain Index operator. More...
 
Complexget (Index n)
 Get element implementation without assertions. More...
 
Numericget_real (Index n)
 Get element implementation without assertions. More...
 
Numericget_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...
 
ComplexVectorViewoperator= (const ConstComplexVectorView &v)
 Assignment operator. More...
 
ComplexVectorViewoperator= (const ComplexVectorView &v)
 Assignment from ComplexVectorView to ComplexVectorView. More...
 
ComplexVectorViewoperator= (const ComplexVector &v)
 Assignment from ComplexVector. More...
 
ComplexVectorViewoperator= (const Array< Complex > &v)
 Assignment operator from Array<Complex>. More...
 
ComplexVectorViewoperator= (Complex x)
 Assigning a scalar to a ComplexVectorView will set all elements to this value. More...
 
ComplexVectorViewoperator= (const ConstVectorView &v)
 
ComplexVectorViewoperator= (const VectorView &v)
 
ComplexVectorViewoperator= (const Vector &v)
 
ComplexVectorViewoperator= (const Array< Numeric > &v)
 
ComplexVectorViewoperator= (Numeric x)
 Assigning a scalar to a ComplexVectorView will set all elements to this value. More...
 
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...
 
 ~ComplexVectorView () override=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 Complexget (Index n) const
 Get element implementation without assertions. More...
 
const Numericget_imag (Index n) const
 Get element implementation without assertions. More...
 
const Numericget_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
 
ConstComplexVectorViewoperator= (const ConstComplexVectorView &)=default
 
ConstComplexVectorViewoperator= (ConstComplexVectorView &&)=default
 
bool empty () const noexcept
 
Index nelem () const noexcept
 
Index size () const noexcept
 
Complex sum () const
 Returns true if variable size is zero. More...
 
const Complexoperator[] (Index n) const
 Plain const index operator. More...
 
const Complexget (Index n) const
 Get element implementation without assertions. More...
 
const Numericget_real (Index n) const
 Get element implementation without assertions. More...
 
const Numericget_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...
 
Index selem () const noexcept
 Start element in memory. More...
 
Index delem () const noexcept
 Steps in memory between elements. More...
 
Complexget_c_array () const noexcept
 

Protected Member Functions

 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...
 

Friends

class ConstComplexIterator2D
 
class ComplexIterator2D
 
class ComplexMatrixView
 

Additional Inherited Members

- Protected Attributes inherited from ConstComplexVectorView
Range mrange {0, 0}
 The range of mdata that is actually used. More...
 
Complexmdata {nullptr}
 Pointer to the plain C array that holds the data. More...
 

Detailed Description

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 389 of file matpack_complex.h.

Member Typedef Documentation

◆ iterator

Constructor & Destructor Documentation

◆ ComplexVectorView() [1/7]

constexpr ComplexVectorView::ComplexVectorView ( const ComplexVectorView )
constexprdefault

◆ ComplexVectorView() [2/7]

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() [3/7]

ComplexVectorView::ComplexVectorView ( ComplexVector v)

◆ ~ComplexVectorView()

ComplexVectorView::~ComplexVectorView ( )
overridedefault

Destructor.

◆ ComplexVectorView() [4/7]

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.

◆ ComplexVectorView() [5/7]

ComplexVectorView::ComplexVectorView ( )
protecteddefault

Referenced by operator[]().

◆ ComplexVectorView() [6/7]

ComplexVectorView::ComplexVectorView ( Complex data,
const Range range 
)
protected

Explicit constructor.

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

Definition at line 430 of file matpack_complex.cc.

◆ ComplexVectorView() [7/7]

ComplexVectorView::ComplexVectorView ( Complex data,
const Range p,
const Range n 
)
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
*dataThe actual data.
pPrevious range.
nNew Range.

Definition at line 445 of file matpack_complex.cc.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

ConstComplexIterator1D ConstComplexVectorView::begin ( ) const

Return const iterator to first element.

Definition at line 334 of file matpack_complex.cc.

◆ end() [1/2]

◆ end() [2/2]

ConstComplexIterator1D ConstComplexVectorView::end ( ) const

Return const iterator behind last element.

Definition at line 335 of file matpack_complex.cc.

◆ get() [1/2]

Complex & ComplexVectorView::get ( Index  n)
inline

Get element implementation without assertions.

Definition at line 416 of file matpack_complex.h.

References ConstComplexVectorView::mdata, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.

Referenced by get_imag(), get_real(), and operator[]().

◆ get() [2/2]

const Complex & ConstComplexVectorView::get ( Index  n) const
inline

Get element implementation without assertions.

Definition at line 309 of file matpack_complex.h.

◆ get_imag() [1/2]

Numeric & ComplexVectorView::get_imag ( Index  n)
inline

Get element implementation without assertions.

Definition at line 426 of file matpack_complex.h.

References get(), and imag().

◆ get_imag() [2/2]

const Numeric & ConstComplexVectorView::get_imag ( Index  n) const
inline

Get element implementation without assertions.

Definition at line 319 of file matpack_complex.h.

◆ get_real() [1/2]

Numeric & ComplexVectorView::get_real ( Index  n)
inline

Get element implementation without assertions.

Definition at line 421 of file matpack_complex.h.

References get(), and real().

◆ get_real() [2/2]

const Numeric & ConstComplexVectorView::get_real ( Index  n) const
inline

Get element implementation without assertions.

Definition at line 314 of file matpack_complex.h.

◆ imag() [1/2]

VectorView ComplexVectorView::imag ( )
inline

Get a view of the imaginary part of the vector.

Definition at line 434 of file matpack_complex.h.

References ConstComplexVectorView::mdata, Range::mextent, ConstComplexVectorView::mrange, Range::mstart, and Range::mstride.

Referenced by get_imag().

◆ imag() [2/2]

ConstVectorView ConstComplexVectorView::imag ( ) const
inline

Get a view of the imaginary part of the vector.

Definition at line 327 of file matpack_complex.h.

◆ operator ComplexMatrixView()

ComplexVectorView::operator ComplexMatrixView ( )

Conversion to 1 column matrix.

Definition at line 412 of file matpack_complex.cc.

◆ operator*=() [1/4]

ComplexVectorView ComplexVectorView::operator*= ( Complex  x)

Multiplication by scalar.

Definition at line 248 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator*=() [2/4]

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(), Constant::e, end(), and ConstComplexVectorView::nelem().

◆ operator*=() [3/4]

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(), Constant::e, end(), ConstComplexVectorView::nelem(), and ConstVectorView::nelem().

◆ operator*=() [4/4]

ComplexVectorView ComplexVectorView::operator*= ( Numeric  x)

Multiplication by scalar.

Definition at line 255 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator+=() [1/4]

ComplexVectorView ComplexVectorView::operator+= ( Complex  x)

Addition of scalar.

Definition at line 276 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator+=() [2/4]

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(), Constant::e, end(), and ConstComplexVectorView::nelem().

◆ operator+=() [3/4]

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(), Constant::e, end(), ConstComplexVectorView::nelem(), and ConstVectorView::nelem().

◆ operator+=() [4/4]

ComplexVectorView ComplexVectorView::operator+= ( Numeric  x)

Addition of scalar.

Definition at line 283 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator-=() [1/4]

ComplexVectorView ComplexVectorView::operator-= ( Complex  x)

Subtraction of scalar.

Definition at line 290 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator-=() [2/4]

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(), Constant::e, end(), and ConstComplexVectorView::nelem().

◆ operator-=() [3/4]

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(), Constant::e, end(), ConstComplexVectorView::nelem(), and ConstVectorView::nelem().

◆ operator-=() [4/4]

ComplexVectorView ComplexVectorView::operator-= ( Numeric  x)

Subtraction of scalar.

Definition at line 297 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator/=() [1/4]

ComplexVectorView ComplexVectorView::operator/= ( Complex  x)

Division by scalar.

Definition at line 262 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator/=() [2/4]

ComplexVectorView ComplexVectorView::operator/= ( const ConstComplexVectorView x)

Element-vise division by another vector.

Definition at line 331 of file matpack_complex.cc.

References ARTS_ASSERT, and ConstComplexVectorView::nelem().

◆ operator/=() [3/4]

ComplexVectorView ComplexVectorView::operator/= ( const ConstVectorView x)

Element-vise division by another vector.

Definition at line 345 of file matpack_complex.cc.

References ARTS_ASSERT, ConstComplexVectorView::nelem(), and ConstVectorView::nelem().

◆ operator/=() [4/4]

ComplexVectorView ComplexVectorView::operator/= ( Numeric  x)

Division by scalar.

Definition at line 269 of file matpack_complex.cc.

References begin(), Constant::e, and end().

◆ operator=() [1/10]

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.

References begin(), copy(), and end().

◆ operator=() [2/10]

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 1492 of file matpack_complex.cc.

References ARTS_ASSERT, begin(), Constant::e, Range::mextent, ConstComplexVectorView::mrange, and v.

◆ operator=() [3/10]

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

◆ operator=() [4/10]

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.

References ARTS_ASSERT, begin(), copy(), Range::mextent, ConstComplexVectorView::mrange, and v.

◆ operator=() [5/10]

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.

◆ operator=() [6/10]

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=().

◆ operator=() [7/10]

ComplexVectorView & ComplexVectorView::operator= ( const ConstVectorView v)

◆ operator=() [8/10]

ComplexVectorView & ComplexVectorView::operator= ( const Vector v)

◆ operator=() [9/10]

ComplexVectorView & ComplexVectorView::operator= ( const VectorView v)

◆ operator=() [10/10]

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.

References begin(), copy(), and end().

◆ operator[]() [1/2]

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.

◆ operator[]() [2/2]

Complex & ComplexVectorView::operator[] ( Index  n)
inline

Plain Index operator.

Definition at line 409 of file matpack_complex.h.

References ARTS_ASSERT, get(), Range::mextent, and ConstComplexVectorView::mrange.

◆ real() [1/2]

◆ real() [2/2]

ConstVectorView ConstComplexVectorView::real ( ) const
inline

Get a view of the real part of the vector.

Definition at line 324 of file matpack_complex.h.

Friends And Related Function Documentation

◆ ComplexIterator2D

friend class ComplexIterator2D
friend

Definition at line 481 of file matpack_complex.h.

◆ ComplexMatrixView

friend class ComplexMatrixView
friend

Definition at line 482 of file matpack_complex.h.

◆ ConstComplexIterator2D

friend class ConstComplexIterator2D
friend

Definition at line 480 of file matpack_complex.h.


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