ARTS  2.4.0(git:4fb77825)
ConstComplexVectorView Class Reference

A constant view of a ComplexVector. More...

#include <complex.h>

Inheritance diagram for ConstComplexVectorView:
ComplexVectorView ComplexVector

Public Types

typedef ConstComplexIterator1D const_iterator
 

Public Member Functions

constexpr ConstComplexVectorView (const ConstComplexVectorView &)=default
 
constexpr ConstComplexVectorView (ConstComplexVectorView &&)=default
 
ConstComplexVectorViewoperator= (const ConstComplexVectorView &)=default
 
ConstComplexVectorViewoperator= (ConstComplexVectorView &&)=default
 
bool empty () const
 
Index nelem () const
 
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...
 

Protected Member Functions

 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

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

Friends

class ComplexVectorView
 
class ConstComplexIterator2D
 
class ConstComplexMatrixView
 
Complex operator* (const ConstComplexVectorView &a, const ConstComplexVectorView &b)
 Scalar product. More...
 
void mult (ComplexVectorView, const ConstComplexMatrixView &, const ConstComplexVectorView &)
 Matrix-Vector Multiplication. More...
 
ComplexConstMatrixViewMap MapToEigen (const ConstComplexVectorView &)
 
ComplexConstMatrixViewMap MapToEigenCol (const ConstComplexVectorView &)
 
ComplexMatrixViewMap MapToEigen (ComplexVectorView &)
 
ComplexMatrixViewMap MapToEigenCol (ComplexVectorView &)
 

Detailed Description

A constant view of a ComplexVector.

Together with the derived class ComplexVectorView this contains the main implementation of a ComplexVector. The class ComplexVector is just a special case of a ComplexVectorView which also allocates storage.

Definition at line 268 of file complex.h.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ ConstComplexVectorView() [1/6]

constexpr ConstComplexVectorView::ConstComplexVectorView ( const ConstComplexVectorView )
constexprdefault

◆ ConstComplexVectorView() [2/6]

constexpr ConstComplexVectorView::ConstComplexVectorView ( ConstComplexVectorView &&  )
constexprdefault

◆ ~ConstComplexVectorView()

virtual ConstComplexVectorView::~ConstComplexVectorView ( )
virtualdefault

Destructor.

◆ ConstComplexVectorView() [3/6]

ConstComplexVectorView::ConstComplexVectorView ( const Complex a)

A special constructor, which allows to make a ConstComplexVectorView from a scalar.

This one is a bit tricky: We have to cast away the arguments const qualifier, because mdata is not const. This should be safe, since there are no non-const methods for ConstComplexVectorView.

Definition at line 101 of file complex.cc.

◆ ConstComplexVectorView() [4/6]

ConstComplexVectorView::ConstComplexVectorView ( )
protecteddefault

Referenced by operator[]().

◆ ConstComplexVectorView() [5/6]

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

Explicit constructor.

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

Definition at line 108 of file complex.cc.

◆ ConstComplexVectorView() [6/6]

ConstComplexVectorView::ConstComplexVectorView ( 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 124 of file complex.cc.

Member Function Documentation

◆ begin()

◆ empty()

bool ConstComplexVectorView::empty ( ) const
inline

Definition at line 279 of file complex.h.

References nelem().

◆ end()

ConstComplexIterator1D ConstComplexVectorView::end ( ) const

Return const iterator behind last element.

Definition at line 83 of file complex.cc.

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

Referenced by ComplexVector::ComplexVector(), operator*(), operator<<(), and ComplexVectorView::operator=().

◆ get()

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

Get element implementation without assertions.

Definition at line 292 of file complex.h.

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

◆ get_imag()

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

Get element implementation without assertions.

Definition at line 302 of file complex.h.

◆ get_real()

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

Get element implementation without assertions.

Definition at line 297 of file complex.h.

◆ imag()

ConstVectorView ConstComplexVectorView::imag ( ) const
inline

Get a view of the imaginary part of the vector.

Definition at line 310 of file complex.h.

◆ nelem()

◆ operator ConstComplexMatrixView()

ConstComplexVectorView::operator ConstComplexMatrixView ( ) const

Conversion to const 1 column matrix.

Definition at line 90 of file complex.cc.

◆ operator=() [1/2]

ConstComplexVectorView& ConstComplexVectorView::operator= ( const ConstComplexVectorView )
default

◆ operator=() [2/2]

ConstComplexVectorView& ConstComplexVectorView::operator= ( ConstComplexVectorView &&  )
default

◆ operator[]() [1/2]

ConstComplexVectorView ConstComplexVectorView::operator[] ( const Range r) const

Const 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 72 of file complex.cc.

References ConstComplexVectorView(), mdata, and mrange.

◆ operator[]() [2/2]

const Complex& ConstComplexVectorView::operator[] ( Index  n) const
inline

Plain const index operator.

Definition at line 285 of file complex.h.

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

◆ real()

ConstVectorView ConstComplexVectorView::real ( ) const
inline

Get a view of the real part of the vector.

Definition at line 307 of file complex.h.

◆ sum()

Complex ConstComplexVectorView::sum ( ) const

Returns true if variable size is zero.

Returns the number of elements. The names ‘size’ and ‘length’ are already used by STL functions returning size_t. To avoid confusion we choose the name ‘nelem’. This is also more consistent with ‘nrow’ and ‘ncol’ for matrices.

The value range of long, which is used to store the index is on a PC from -2147483648 to 2147483647. This means that a 15GB large array of float can be addressed with this index. So the extra bit that size_t has compared to long is not needed. The sum of all elements of a Vector.

Definition at line 59 of file complex.cc.

References begin().

Friends And Related Function Documentation

◆ ComplexVectorView

friend class ComplexVectorView
friend

Definition at line 327 of file complex.h.

◆ ConstComplexIterator2D

friend class ConstComplexIterator2D
friend

Definition at line 328 of file complex.h.

◆ ConstComplexMatrixView

friend class ConstComplexMatrixView
friend

Definition at line 329 of file complex.h.

◆ MapToEigen [1/2]

ComplexMatrixViewMap MapToEigen ( ComplexVectorView )
friend

Definition at line 1694 of file complex.cc.

◆ MapToEigen [2/2]

ComplexConstMatrixViewMap MapToEigen ( const ConstComplexVectorView )
friend

Definition at line 1664 of file complex.cc.

◆ MapToEigenCol [1/2]

ComplexMatrixViewMap MapToEigenCol ( ComplexVectorView )
friend

Definition at line 1707 of file complex.cc.

◆ MapToEigenCol [2/2]

ComplexConstMatrixViewMap MapToEigenCol ( const ConstComplexVectorView )
friend

Definition at line 1677 of file complex.cc.

◆ mult

void mult ( ComplexVectorView  ,
const ConstComplexMatrixView ,
const ConstComplexVectorView  
)
friend

Matrix-Vector Multiplication.

Uses the Eigen library. Be carful to test the size of your input beforehand.

For left-hand multiplication, please use pure matrix-mult.

Parameters
[out]yThe length-m ComplexVectorView where the result is stored.
[in]MReference to the m-times-n Const{Complex,}MatrixView holding the matrix M.
[in]xReference to the length-n Const{Complex,}VectorView holding the vector x.

Definition at line 1579 of file complex.cc.

◆ operator*

Complex operator* ( const ConstComplexVectorView a,
const ConstComplexVectorView b 
)
friend

Scalar product.

The two vectors may be identical.

Definition at line 1554 of file complex.cc.

Member Data Documentation

◆ mdata

◆ mrange


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