ARTS 2.5.4 (git: 4c0d3b4d)
ConstComplexVectorView Class Reference

A constant view of a ComplexVector. More...

#include <matpack_complex.h>

Inheritance diagram for ConstComplexVectorView:
ComplexVectorView ComplexVector

Public Types

using const_iterator = ConstComplexIterator1D
 

Public Member Functions

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

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...
 
ConstComplexMatrixViewMap MapToEigen (const ConstComplexVectorView &)
 
ConstComplexMatrixViewMap 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 289 of file matpack_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 99 of file matpack_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 106 of file matpack_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 122 of file matpack_complex.cc.

Member Function Documentation

◆ begin()

◆ empty()

bool ConstComplexVectorView::empty ( ) const
inlinenoexcept

Definition at line 300 of file matpack_complex.h.

References nelem().

◆ end()

ConstComplexIterator1D ConstComplexVectorView::end ( ) const

Return const iterator behind last element.

Definition at line 81 of file matpack_complex.cc.

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

Referenced by operator<<().

◆ get()

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

Get element implementation without assertions.

Definition at line 313 of file matpack_complex.h.

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

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

◆ get_imag()

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

Get element implementation without assertions.

Definition at line 323 of file matpack_complex.h.

References get(), and imag().

◆ get_real()

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

Get element implementation without assertions.

Definition at line 318 of file matpack_complex.h.

References get(), and real().

◆ imag()

ConstVectorView ConstComplexVectorView::imag ( ) const
inline

Get a view of the imaginary part of the vector.

Definition at line 331 of file matpack_complex.h.

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

Referenced by get_imag().

◆ nelem()

◆ operator ConstComplexMatrixView()

ConstComplexVectorView::operator ConstComplexMatrixView ( ) const

Conversion to const 1 column matrix.

Definition at line 88 of file matpack_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 70 of file matpack_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 306 of file matpack_complex.h.

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

◆ real()

ConstVectorView ConstComplexVectorView::real ( ) const
inline

Get a view of the real part of the vector.

Definition at line 328 of file matpack_complex.h.

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

Referenced by get_real().

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

References begin().

Friends And Related Function Documentation

◆ ComplexVectorView

friend class ComplexVectorView
friend

Definition at line 348 of file matpack_complex.h.

◆ ConstComplexIterator2D

friend class ConstComplexIterator2D
friend

Definition at line 349 of file matpack_complex.h.

◆ ConstComplexMatrixView

friend class ConstComplexMatrixView
friend

Definition at line 350 of file matpack_complex.h.

◆ MapToEigen [1/2]

ComplexMatrixViewMap MapToEigen ( ComplexVectorView )
friend

Definition at line 1701 of file matpack_complex.cc.

◆ MapToEigen [2/2]

ConstComplexMatrixViewMap MapToEigen ( const ConstComplexVectorView )
friend

Definition at line 1671 of file matpack_complex.cc.

◆ MapToEigenCol [1/2]

ComplexMatrixViewMap MapToEigenCol ( ComplexVectorView )
friend

Definition at line 1714 of file matpack_complex.cc.

◆ MapToEigenCol [2/2]

ConstComplexMatrixViewMap MapToEigenCol ( const ConstComplexVectorView )
friend

Definition at line 1684 of file matpack_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 1586 of file matpack_complex.cc.

◆ operator*

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

Scalar product.

The two vectors may be identical.

Definition at line 1561 of file matpack_complex.cc.

Member Data Documentation

◆ mdata

◆ mrange


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