ARTS 2.5.4 (git: 4c0d3b4d)
ComplexMatrixView Class Reference

The ComplexMatrixView class. More...

#include <matpack_complex.h>

Inheritance diagram for ComplexMatrixView:
ConstComplexMatrixView ComplexMatrix

Public Types

using iterator = ComplexIterator2D
 
- Public Types inherited from ConstComplexMatrixView
using const_iterator = ConstComplexIterator2D
 

Public Member Functions

constexpr ComplexMatrixView (const ComplexMatrixView &)=default
 
Complexoperator() (Index r, Index c)
 Plain index operator. More...
 
Complexget (Index r, Index c)
 Get element implementation without assertions. More...
 
Numericget_real (Index r, Index c)
 Get element implementation without assertions. More...
 
Numericget_imag (Index r, Index c)
 Get element implementation without assertions. More...
 
MatrixView real ()
 Get a view of the real part of the matrix. More...
 
MatrixView imag ()
 Get a view of the imaginary parts of the matrix. More...
 
ComplexMatrixView operator() (const Range &r, const Range &c)
 Index operator for subrange. More...
 
ComplexVectorView operator() (const Range &r, Index c)
 Index operator returning a column as an object of type ComplexVectorView. More...
 
ComplexVectorView operator() (Index r, const Range &c)
 Index operator returning a row as an object of type ComplexVectorView. More...
 
ComplexIterator2D begin ()
 Return iterator to first row. More...
 
ComplexIterator2D end ()
 Return iterator behind last row. More...
 
ComplexVectorView diagonal ()
 ComplexMatrix diagonal as vector. More...
 
ComplexMatrixViewoperator= (const ConstComplexMatrixView &v)
 Assignment operator. More...
 
ComplexMatrixViewoperator= (const ComplexMatrixView &v)
 Assignment from ComplexMatrixView to ComplexMatrixView. More...
 
ComplexMatrixViewoperator= (const ComplexMatrix &v)
 Assignment from a ComplexMatrix. More...
 
ComplexMatrixViewoperator= (const ConstComplexVectorView &v)
 Assignment from a vector. More...
 
ComplexMatrixViewoperator= (Complex x)
 Assigning a scalar to a MatrixView will set all elements to this value. More...
 
ComplexMatrixViewoperator*= (Complex x)
 Multiplication by scalar. More...
 
ComplexMatrixViewoperator/= (Complex x)
 Division by scalar. More...
 
ComplexMatrixViewoperator+= (Complex x)
 Addition of scalar. More...
 
ComplexMatrixViewoperator-= (Complex x)
 Subtraction of scalar. More...
 
ComplexMatrixViewoperator*= (Numeric x)
 Multiplication by scalar. More...
 
ComplexMatrixViewoperator/= (Numeric x)
 Division by scalar. More...
 
ComplexMatrixViewoperator+= (Numeric x)
 Addition of scalar. More...
 
ComplexMatrixViewoperator-= (Numeric x)
 Subtraction of scalar. More...
 
ComplexMatrixViewoperator*= (const ConstComplexMatrixView &x)
 Element-vise multiplication by another Matrix. More...
 
ComplexMatrixViewoperator/= (const ConstComplexMatrixView &x)
 Element-vise division by another Matrix. More...
 
ComplexMatrixViewoperator+= (const ConstComplexMatrixView &x)
 Element-vise addition of another Matrix. More...
 
ComplexMatrixViewoperator-= (const ConstComplexMatrixView &x)
 Element-vise subtraction of another Matrix. More...
 
ComplexMatrixViewoperator*= (const ConstMatrixView &x)
 Element-vise multiplication by another Matrix. More...
 
ComplexMatrixViewoperator/= (const ConstMatrixView &x)
 Element-vise division by another Matrix. More...
 
ComplexMatrixViewoperator+= (const ConstMatrixView &x)
 Element-vise addition of another Matrix. More...
 
ComplexMatrixViewoperator-= (const ConstMatrixView &x)
 Element-vise subtraction of another Matrix. More...
 
ComplexMatrixViewoperator*= (const ConstComplexVectorView &x)
 
ComplexMatrixViewoperator/= (const ConstComplexVectorView &x)
 
ComplexMatrixViewoperator+= (const ConstComplexVectorView &x)
 
ComplexMatrixViewoperator-= (const ConstComplexVectorView &x)
 
const Complexget_c_array () const ARTS_NOEXCEPT
 Conversion to plain C-array. More...
 
Complexget_c_array () ARTS_NOEXCEPT
 Conversion to plain C-array. More...
 
 ~ComplexMatrixView () override=default
 Destructor. More...
 
ConstComplexIterator2D begin () const
 Return const iterator to first row. More...
 
ConstComplexIterator2D end () const
 Return const iterator behind last row. More...
 
Complex get (Index r, Index c) const
 Get element implementation without assertions. More...
 
Numeric get_imag (Index r, Index c) const
 Get element implementation without assertions. More...
 
Numeric get_real (Index r, Index c) const
 Get element implementation without assertions. More...
 
ConstMatrixView imag () const
 Get a view of the imaginary part of the matrix. More...
 
ConstMatrixView real () const
 Get a view of the real part of the matrix. More...
 
ConstComplexVectorView diagonal () const
 ComplexMatrix diagonal as vector. More...
 
- Public Member Functions inherited from ConstComplexMatrixView
constexpr ConstComplexMatrixView (const ConstComplexMatrixView &)=default
 
constexpr ConstComplexMatrixView (ConstComplexMatrixView &&)=default
 
ConstComplexMatrixViewoperator= (const ConstComplexMatrixView &)=default
 
ConstComplexMatrixViewoperator= (ConstComplexMatrixView &&)=default
 
Index nrows () const noexcept
 
Index ncols () const noexcept
 
bool empty () const noexcept
 
Complex operator() (Index r, Index c) const
 Plain const index operator. More...
 
Complex get (Index r, Index c) const
 Get element implementation without assertions. More...
 
Numeric get_real (Index r, Index c) const
 Get element implementation without assertions. More...
 
Numeric get_imag (Index r, Index c) const
 Get element implementation without assertions. More...
 
ConstMatrixView real () const
 Get a view of the real part of the matrix. More...
 
ConstMatrixView imag () const
 Get a view of the imaginary part of the matrix. More...
 
Index get_column_extent () const
 Get the extent of the underlying data. More...
 
ConstComplexMatrixView operator() (const Range &r, const Range &c) const
 Returns true if variable size is zero. More...
 
ConstComplexVectorView operator() (const Range &r, Index c) const
 Const index operator returning a column as an object of type C onstComplex*VectorView. More...
 
ConstComplexVectorView operator() (Index r, const Range &c) const
 Const index operator returning a row as an object of type C onstComplex*VectorView. More...
 
ConstComplexIterator2D begin () const
 Return const iterator to first row. More...
 
ConstComplexIterator2D end () const
 Return const iterator behind last row. More...
 
ConstComplexVectorView diagonal () const
 ComplexMatrix diagonal as vector. More...
 
virtual ~ConstComplexMatrixView ()=default
 Destructor. More...
 

Protected Member Functions

 ComplexMatrixView ()
 Default constructor. More...
 
 ComplexMatrixView (Complex *data, const Range &r, const Range &c)
 Explicit constructor. More...
 
 ComplexMatrixView (Complex *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc)
 Recursive constructor. More...
 
- Protected Member Functions inherited from ConstComplexMatrixView
 ConstComplexMatrixView ()=default
 
 ConstComplexMatrixView (Complex *data, const Range &r, const Range &c)
 Explicit constructor. More...
 
 ConstComplexMatrixView (Complex *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc)
 Recursive constructor. More...
 

Friends

class ComplexVectorView
 
ConstComplexMatrixView transpose (ConstComplexMatrixView m)
 Const version of transpose. More...
 
ComplexMatrixView transpose (ComplexMatrixView m)
 Returns the transpose. More...
 

Additional Inherited Members

- Protected Attributes inherited from ConstComplexMatrixView
Range mrr {0, 0, 1}
 The row range of mdata that is actually used. More...
 
Range mcr {0, 0, 1}
 The column range of mdata that is actually used. More...
 
Complexmdata {nullptr}
 Pointer to the plain C array that holds the data. More...
 

Detailed Description

The ComplexMatrixView class.

This contains the main implementation of a ComplexMatrix. It defines
the concepts of ComplexMatrixView. Plus additionally the recursive subrange operator, which makes it possible to create a ComplexMatrixView from a subrange of a ComplexMatrixView.

The class ComplexMatrix is just a special case of a ComplexMatrixView which also allocates storage.

Definition at line 771 of file matpack_complex.h.

Member Typedef Documentation

◆ iterator

Constructor & Destructor Documentation

◆ ComplexMatrixView() [1/4]

constexpr ComplexMatrixView::ComplexMatrixView ( const ComplexMatrixView )
constexprdefault

◆ ~ComplexMatrixView()

ComplexMatrixView::~ComplexMatrixView ( )
overridedefault

Destructor.

◆ ComplexMatrixView() [2/4]

ComplexMatrixView::ComplexMatrixView ( )
protected

Default constructor.

This is necessary, so that we can have a default constructor for the derived class Matrix.

Definition at line 1278 of file matpack_complex.cc.

Referenced by operator()().

◆ ComplexMatrixView() [3/4]

ComplexMatrixView::ComplexMatrixView ( Complex data,
const Range rr,
const Range cr 
)
protected

Explicit constructor.

This one is used by ComplexMatrix to initialize its own ComplexMatrixView part. The row range rr must have a stride to account for the length of one row.

Definition at line 1285 of file matpack_complex.cc.

◆ ComplexMatrixView() [4/4]

ComplexMatrixView::ComplexMatrixView ( Complex data,
const Range pr,
const Range pc,
const Range nr,
const Range nc 
)
protected

Recursive constructor.

This is used to construct SubMatrices from SubMatrices. That means that the new ranges have to be interpreted relative to the original ranges.

The new ranges 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.
prPrevious range.
pcPrevious range.
nrNew Range.
ncNew Range.

Definition at line 1306 of file matpack_complex.cc.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

ConstComplexIterator2D ConstComplexMatrixView::begin ( ) const

Return const iterator to first row.

Definition at line 712 of file matpack_complex.cc.

◆ diagonal() [1/2]

ComplexVectorView ComplexMatrixView::diagonal ( )

ComplexMatrix diagonal as vector.

Returns a ComplexMatrixView on the diagonal entries of the matrix. For a given (n,m) matrix M the diagonal vector v is the vector of length min{n,m} with entries

 v[i] = M(i,i)
Returns
The diagonal vector v.

Definition at line 970 of file matpack_complex.cc.

References ComplexVectorView, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, min, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.

Referenced by lm_hitran_2017::convtp().

◆ diagonal() [2/2]

ConstComplexVectorView ConstComplexMatrixView::diagonal ( ) const

ComplexMatrix diagonal as vector.

R eturns a ConstComplex*MatrixView on the diagonal entries of the matrix. For a given (n,m) matrix M the diagonal vector v is the vector of length min{n,m} with entries

 v[i] = M(i,i)
Returns
The diagonal vector v.

Definition at line 716 of file matpack_complex.cc.

◆ end() [1/2]

◆ end() [2/2]

ConstComplexIterator2D ConstComplexMatrixView::end ( ) const

Return const iterator behind last row.

Definition at line 713 of file matpack_complex.cc.

◆ get() [1/2]

Complex & ComplexMatrixView::get ( Index  r,
Index  c 
)
inline

Get element implementation without assertions.

Definition at line 801 of file matpack_complex.h.

References c, and ConstComplexVectorView::mdata.

◆ get() [2/2]

Complex ConstComplexMatrixView::get ( Index  r,
Index  c 
) const
inline

Get element implementation without assertions.

Definition at line 685 of file matpack_complex.h.

◆ get_c_array() [1/2]

Complex * ComplexMatrixView::get_c_array ( )

Conversion to plain C-array.

This function returns a pointer to the raw data. It fails if the MatrixView is not pointing to the beginning of a Matrix or the stride is not 1 because the caller expects to get a C array with continuous data.

Definition at line 1137 of file matpack_complex.cc.

References ARTS_ASSERT, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.

◆ get_c_array() [2/2]

const Complex * ComplexMatrixView::get_c_array ( ) const

Conversion to plain C-array.

This function returns a pointer to the raw data. It fails if the MatrixView is not pointing to the beginning of a Matrix or the stride is not 1 because the caller expects to get a C array with continuous data.

Definition at line 1124 of file matpack_complex.cc.

References ARTS_ASSERT, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.

Referenced by diagonalize(), and inv().

◆ get_imag() [1/2]

Numeric & ComplexMatrixView::get_imag ( Index  r,
Index  c 
)
inline

Get element implementation without assertions.

Definition at line 812 of file matpack_complex.h.

References c, ComplexVectorView::get(), and ComplexVectorView::imag().

◆ get_imag() [2/2]

Numeric ConstComplexMatrixView::get_imag ( Index  r,
Index  c 
) const
inline

Get element implementation without assertions.

Definition at line 694 of file matpack_complex.h.

◆ get_real() [1/2]

Numeric & ComplexMatrixView::get_real ( Index  r,
Index  c 
)
inline

Get element implementation without assertions.

Definition at line 807 of file matpack_complex.h.

References c, ComplexVectorView::get(), and ComplexVectorView::real().

◆ get_real() [2/2]

Numeric ConstComplexMatrixView::get_real ( Index  r,
Index  c 
) const
inline

Get element implementation without assertions.

Definition at line 691 of file matpack_complex.h.

◆ imag() [1/2]

MatrixView ComplexMatrixView::imag ( )
inline

Get a view of the imaginary parts of the matrix.

Definition at line 821 of file matpack_complex.h.

References ConstComplexVectorView::mdata.

Referenced by lm_hitran_2017::calcw(), lm_hitran_2017::convtp(), and Absorption::LineMixing::single_species_ecs_relaxation_matrix().

◆ imag() [2/2]

ConstMatrixView ConstComplexMatrixView::imag ( ) const
inline

Get a view of the imaginary part of the matrix.

Definition at line 701 of file matpack_complex.h.

◆ operator()() [1/4]

ComplexMatrixView ComplexMatrixView::operator() ( const Range r,
const Range c 
)

Index operator for subrange.

We have to also account for the case, t hat *this is already a subrange of a Complex*Matrix. This allows correct recursive behavior.

Definition at line 919 of file matpack_complex.cc.

References c, ComplexMatrixView(), ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, and ConstComplexMatrixView::mrr.

◆ operator()() [2/4]

ComplexVectorView ComplexMatrixView::operator() ( const Range r,
Index  c 
)

Index operator returning a column as an object of type ComplexVectorView.

Parameters
rA range of rows.
cIndex of selected column

Definition at line 928 of file matpack_complex.cc.

References ARTS_ASSERT, c, ComplexVectorView, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.

◆ operator()() [3/4]

ComplexVectorView ComplexMatrixView::operator() ( Index  r,
const Range c 
)

Index operator returning a row as an object of type ComplexVectorView.

Parameters
rIndex of selected row.
cRange of columns

Definition at line 940 of file matpack_complex.cc.

References ARTS_ASSERT, c, ComplexVectorView, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.

◆ operator()() [4/4]

Complex & ComplexMatrixView::operator() ( Index  r,
Index  c 
)
inline

Plain index operator.

Definition at line 791 of file matpack_complex.h.

References ARTS_ASSERT, c, and ComplexVectorView::get().

◆ operator*=() [1/5]

ComplexMatrixView & ComplexMatrixView::operator*= ( Complex  x)

Multiplication by scalar.

Definition at line 1039 of file matpack_complex.cc.

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

◆ operator*=() [2/5]

◆ operator*=() [3/5]

ComplexMatrixView & ComplexMatrixView::operator*= ( const ConstComplexVectorView x)

◆ operator*=() [4/5]

◆ operator*=() [5/5]

ComplexMatrixView & ComplexMatrixView::operator*= ( Numeric  x)

Multiplication by scalar.

Definition at line 1049 of file matpack_complex.cc.

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

◆ operator+=() [1/5]

ComplexMatrixView & ComplexMatrixView::operator+= ( Complex  x)

Addition of scalar.

Definition at line 1079 of file matpack_complex.cc.

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

◆ operator+=() [2/5]

◆ operator+=() [3/5]

ComplexMatrixView & ComplexMatrixView::operator+= ( const ConstComplexVectorView x)

◆ operator+=() [4/5]

◆ operator+=() [5/5]

ComplexMatrixView & ComplexMatrixView::operator+= ( Numeric  x)

Addition of scalar.

Definition at line 1089 of file matpack_complex.cc.

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

◆ operator-=() [1/5]

ComplexMatrixView & ComplexMatrixView::operator-= ( Complex  x)

Subtraction of scalar.

Definition at line 1099 of file matpack_complex.cc.

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

◆ operator-=() [2/5]

◆ operator-=() [3/5]

ComplexMatrixView & ComplexMatrixView::operator-= ( const ConstComplexVectorView x)

◆ operator-=() [4/5]

◆ operator-=() [5/5]

ComplexMatrixView & ComplexMatrixView::operator-= ( Numeric  x)

Subtraction of scalar.

Definition at line 1109 of file matpack_complex.cc.

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

◆ operator/=() [1/5]

ComplexMatrixView & ComplexMatrixView::operator/= ( Complex  x)

Division by scalar.

Definition at line 1059 of file matpack_complex.cc.

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

◆ operator/=() [2/5]

◆ operator/=() [3/5]

ComplexMatrixView & ComplexMatrixView::operator/= ( const ConstComplexVectorView x)

◆ operator/=() [4/5]

◆ operator/=() [5/5]

ComplexMatrixView & ComplexMatrixView::operator/= ( Numeric  x)

Division by scalar.

Definition at line 1069 of file matpack_complex.cc.

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

◆ operator=() [1/5]

ComplexMatrixView & ComplexMatrixView::operator= ( Complex  x)

Assigning a scalar to a MatrixView will set all elements to this value.

Definition at line 1033 of file matpack_complex.cc.

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

◆ operator=() [2/5]

ComplexMatrixView & ComplexMatrixView::operator= ( const ComplexMatrix m)

Assignment from a ComplexMatrix.

This must exist to overide the automatically generated assignment operators, which don't copy the contents!

Definition at line 1007 of file matpack_complex.cc.

References ARTS_ASSERT, begin(), copy(), end(), ConstComplexMatrixView::mcr, Range::mextent, and ConstComplexMatrixView::mrr.

◆ operator=() [3/5]

ComplexMatrixView & ComplexMatrixView::operator= ( const ComplexMatrixView m)

Assignment from ComplexMatrixView to ComplexMatrixView.

This is a tricky one. The problem is that since ComplexMatrixView is derived from ConstMatrixView, 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 995 of file matpack_complex.cc.

References ARTS_ASSERT, begin(), copy(), end(), ConstComplexMatrixView::mcr, Range::mextent, and ConstComplexMatrixView::mrr.

◆ operator=() [4/5]

ComplexMatrixView & ComplexMatrixView::operator= ( const ConstComplexMatrixView m)

Assignment operator.

This copies the data from another ComplexMatrixView to this ComplexMatrixView. Dimensions must agree! Resizing would destroy the selection that we might have done in this ComplexMatrixView by setting its range.

Definition at line 980 of file matpack_complex.cc.

References ARTS_ASSERT, begin(), ConstComplexMatrixView::begin(), copy(), ConstComplexMatrixView::end(), ConstComplexMatrixView::mcr, Range::mextent, and ConstComplexMatrixView::mrr.

◆ operator=() [5/5]

ComplexMatrixView & ComplexMatrixView::operator= ( const ConstComplexVectorView v)

Assignment from a vector.

This copies the data from a ComplexVectorView to this ComplexMatrixView. Dimensions must agree! Resizing would destroy the selection that we might have done in this ComplexMatrixView by setting its range.

Definition at line 1020 of file matpack_complex.cc.

References ARTS_ASSERT, begin(), ConstComplexMatrixView::begin(), copy(), ConstComplexMatrixView::end(), ConstComplexMatrixView::mcr, Range::mextent, ConstComplexMatrixView::mrr, and v.

◆ real() [1/2]

MatrixView ComplexMatrixView::real ( )
inline

Get a view of the real part of the matrix.

Definition at line 817 of file matpack_complex.h.

References ConstComplexVectorView::mdata.

Referenced by propmat_clearskyAddLines().

◆ real() [2/2]

ConstMatrixView ConstComplexMatrixView::real ( ) const
inline

Get a view of the real part of the matrix.

Definition at line 697 of file matpack_complex.h.

Friends And Related Function Documentation

◆ ComplexVectorView

friend class ComplexVectorView
friend

Definition at line 875 of file matpack_complex.h.

Referenced by begin(), diagonal(), end(), and operator()().

◆ transpose [1/2]

ComplexMatrixView transpose ( ComplexMatrixView  m)
friend

Returns the transpose.

This creates a special MatrixView for the transpose. The original is not changed!

Definition at line 1522 of file matpack_complex.cc.

◆ transpose [2/2]

Const version of transpose.

Definition at line 1516 of file matpack_complex.cc.


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