ARTS  2.4.0(git:4fb77825)
ComplexMatrixView Class Reference

The ComplexMatrixView class. More...

#include <complex.h>

Inheritance diagram for ComplexMatrixView:
ConstComplexMatrixView ComplexMatrix

Public Types

typedef ComplexIterator2D iterator
 
- Public Types inherited from ConstComplexMatrixView
typedef ConstComplexIterator2D const_iterator
 

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
 Conversion to plain C-array. More...
 
Complexget_c_array ()
 Conversion to plain C-array. More...
 
virtual ~ComplexMatrixView ()=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
 
bool empty () const
 
Index nrows () const
 
Index ncols () const
 
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 731 of file complex.h.

Member Typedef Documentation

◆ iterator

Definition at line 747 of file complex.h.

Constructor & Destructor Documentation

◆ ComplexMatrixView() [1/4]

constexpr ComplexMatrixView::ComplexMatrixView ( const ComplexMatrixView )
constexprdefault

◆ ~ComplexMatrixView()

virtual ComplexMatrixView::~ComplexMatrixView ( )
virtualdefault

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

◆ 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 1277 of file 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 1298 of file complex.cc.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

ConstComplexIterator2D ConstComplexMatrixView::begin

Return const iterator to first row.

Definition at line 672 of file 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 958 of file complex.cc.

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

◆ diagonal() [2/2]

ConstComplexVectorView ConstComplexMatrixView::diagonal

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

◆ end() [1/2]

◆ end() [2/2]

ConstComplexIterator2D ConstComplexMatrixView::end

Return const iterator behind last row.

Definition at line 673 of file complex.cc.

◆ get() [1/2]

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

Get element implementation without assertions.

Definition at line 761 of file complex.h.

◆ get() [2/2]

Complex ConstComplexMatrixView::get
inline

Get element implementation without assertions.

Definition at line 645 of file 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 1127 of file complex.cc.

References 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 1112 of file complex.cc.

References 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 772 of file complex.h.

◆ get_imag() [2/2]

Numeric ConstComplexMatrixView::get_imag
inline

Get element implementation without assertions.

Definition at line 654 of file complex.h.

◆ get_real() [1/2]

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

Get element implementation without assertions.

Definition at line 767 of file complex.h.

◆ get_real() [2/2]

Numeric ConstComplexMatrixView::get_real
inline

Get element implementation without assertions.

Definition at line 651 of file complex.h.

◆ imag() [1/2]

MatrixView ComplexMatrixView::imag ( )
inline

Get a view of the imaginary parts of the matrix.

Definition at line 781 of file complex.h.

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

◆ imag() [2/2]

ConstMatrixView ConstComplexMatrixView::imag
inline

Get a view of the imaginary part of the matrix.

Definition at line 661 of file complex.h.

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

◆ 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 907 of file complex.cc.

◆ 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 916 of file complex.cc.

◆ 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 928 of file complex.cc.

◆ operator()() [4/4]

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

Plain index operator.

Definition at line 751 of file complex.h.

◆ operator*=() [1/5]

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

Multiplication by scalar.

Definition at line 1027 of file complex.cc.

References begin(), and end().

◆ operator*=() [2/5]

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

Element-vise multiplication by another Matrix.

Definition at line 1137 of file complex.cc.

References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator*=() [3/5]

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

◆ operator*=() [4/5]

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

Element-vise multiplication by another Matrix.

Definition at line 1154 of file complex.cc.

References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator*=() [5/5]

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

Multiplication by scalar.

Definition at line 1037 of file complex.cc.

References begin(), and end().

◆ operator+=() [1/5]

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

Addition of scalar.

Definition at line 1067 of file complex.cc.

References begin(), and end().

◆ operator+=() [2/5]

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

Element-vise addition of another Matrix.

Definition at line 1203 of file complex.cc.

References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator+=() [3/5]

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

◆ operator+=() [4/5]

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

Element-vise addition of another Matrix.

Definition at line 1220 of file complex.cc.

References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator+=() [5/5]

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

Addition of scalar.

Definition at line 1077 of file complex.cc.

References begin(), and end().

◆ operator-=() [1/5]

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

Subtraction of scalar.

Definition at line 1087 of file complex.cc.

References begin(), and end().

◆ operator-=() [2/5]

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

Element-vise subtraction of another Matrix.

Definition at line 1236 of file complex.cc.

References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator-=() [3/5]

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

◆ operator-=() [4/5]

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

Element-vise subtraction of another Matrix.

Definition at line 1253 of file complex.cc.

References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator-=() [5/5]

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

Subtraction of scalar.

Definition at line 1097 of file complex.cc.

References begin(), and end().

◆ operator/=() [1/5]

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

Division by scalar.

Definition at line 1047 of file complex.cc.

References begin(), and end().

◆ operator/=() [2/5]

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

Element-vise division by another Matrix.

Definition at line 1170 of file complex.cc.

References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator/=() [3/5]

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

◆ operator/=() [4/5]

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

Element-vise division by another Matrix.

Definition at line 1187 of file complex.cc.

References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().

◆ operator/=() [5/5]

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

Division by scalar.

Definition at line 1057 of file complex.cc.

References begin(), 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 1021 of file complex.cc.

References begin(), copy(), end(), and ARTS::Var::x().

◆ 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 995 of file complex.cc.

References 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 983 of file complex.cc.

References 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 968 of file complex.cc.

References 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 1008 of file complex.cc.

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

◆ real() [1/2]

MatrixView ComplexMatrixView::real ( )
inline

Get a view of the real part of the matrix.

Definition at line 777 of file complex.h.

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

◆ real() [2/2]

ConstMatrixView ConstComplexMatrixView::real
inline

Get a view of the real part of the matrix.

Definition at line 657 of file complex.h.

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

Friends And Related Function Documentation

◆ ComplexVectorView

friend class ComplexVectorView
friend

Definition at line 835 of file complex.h.

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

◆ 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 1515 of file complex.cc.

◆ transpose [2/2]

Const version of transpose.

Definition at line 1509 of file complex.cc.


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