ARTS 2.5.4 (git: 31ce4f0e)
ConstComplexMatrixView Class Reference

A constant view of a ComplexMatrix. More...

#include <matpack_complex.h>

Inheritance diagram for ConstComplexMatrixView:
ComplexMatrixView ComplexMatrix

Public Types

using const_iterator = ConstComplexIterator2D
 

Public Member Functions

constexpr ConstComplexMatrixView (const ConstComplexMatrixView &)=default
 
constexpr ConstComplexMatrixView (ConstComplexMatrixView &&)=default
 
ConstComplexMatrixViewoperator= (const ConstComplexMatrixView &)=default
 
ConstComplexMatrixViewoperator= (ConstComplexMatrixView &&)=default
 
Index selem () const noexcept
 
Index nrows () const noexcept
 
Index ncols () const noexcept
 
Index drows () const noexcept
 
Index dcols () const noexcept
 
Index size () 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...
 
Complexget_c_array () const noexcept
 

Protected Member Functions

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

Protected Attributes

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

Friends

class ComplexMatrixView
 
class ConstComplexVectorView
 
ConstComplexMatrixView transpose (ConstComplexMatrixView m)
 Const version of transpose. More...
 
void mult (ComplexVectorView, const ConstComplexMatrixView &, const ConstComplexVectorView &)
 Matrix-Vector Multiplication. More...
 
void mult (ComplexMatrixView, const ConstComplexMatrixView &, const ConstComplexMatrixView &)
 Matrix-Matrix Multiplication. More...
 
void mult (ComplexMatrixView, const ConstMatrixView &, const ConstComplexMatrixView &)
 
void mult (ComplexMatrixView, const ConstComplexMatrixView &, const ConstMatrixView &)
 
std::ostream & operator<< (std::ostream &os, const ConstComplexMatrixView &v)
 Output operator. More...
 

Detailed Description

A constant view of a ComplexMatrix.

This, together with the derived class Complex*MatrixView, 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 658 of file matpack_complex.h.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ ConstComplexMatrixView() [1/5]

constexpr ConstComplexMatrixView::ConstComplexMatrixView ( const ConstComplexMatrixView )
constexprdefault

◆ ConstComplexMatrixView() [2/5]

constexpr ConstComplexMatrixView::ConstComplexMatrixView ( ConstComplexMatrixView &&  )
constexprdefault

◆ ~ConstComplexMatrixView()

virtual ConstComplexMatrixView::~ConstComplexMatrixView ( )
virtualdefault

Destructor.

◆ ConstComplexMatrixView() [3/5]

ConstComplexMatrixView::ConstComplexMatrixView ( )
protecteddefault

Referenced by operator()().

◆ ConstComplexMatrixView() [4/5]

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

Explicit constructor.

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

Definition at line 818 of file matpack_complex.cc.

◆ ConstComplexMatrixView() [5/5]

ConstComplexMatrixView::ConstComplexMatrixView ( 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 839 of file matpack_complex.cc.

Member Function Documentation

◆ begin()

◆ dcols()

Index ConstComplexMatrixView::dcols ( ) const
inlinenoexcept

Definition at line 673 of file matpack_complex.h.

References mcr, and Range::mstride.

◆ diagonal()

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

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

◆ drows()

Index ConstComplexMatrixView::drows ( ) const
inlinenoexcept

Definition at line 672 of file matpack_complex.h.

References mrr, and Range::mstride.

◆ empty()

bool ConstComplexMatrixView::empty ( ) const
inlinenoexcept

Definition at line 677 of file matpack_complex.h.

References ncols(), and nrows().

◆ end()

ConstComplexIterator2D ConstComplexMatrixView::end ( ) const

Return const iterator behind last row.

Definition at line 793 of file matpack_complex.cc.

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

Referenced by ComplexMatrix::ComplexMatrix(), ComplexMatrixView::operator=(), and ComplexMatrix::operator=().

◆ get()

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

Get element implementation without assertions.

Definition at line 691 of file matpack_complex.h.

References c, mcr, mdata, mrr, Range::mstart, and Range::mstride.

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

◆ get_c_array()

Complex * ConstComplexMatrixView::get_c_array ( ) const
inlinenoexcept

Definition at line 746 of file matpack_complex.h.

References mdata.

Referenced by diagonalize(), and inv().

◆ get_column_extent()

Index ConstComplexMatrixView::get_column_extent ( ) const
inline

Get the extent of the underlying data.

Definition at line 711 of file matpack_complex.h.

References Range::get_extent(), and mcr.

Referenced by diagonalize().

◆ get_imag()

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

Get element implementation without assertions.

Definition at line 700 of file matpack_complex.h.

References c, and get().

◆ get_real()

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

Get element implementation without assertions.

Definition at line 697 of file matpack_complex.h.

References c, and get().

◆ imag()

ConstMatrixView ConstComplexMatrixView::imag ( ) const
inline

Get a view of the imaginary part of the matrix.

Definition at line 707 of file matpack_complex.h.

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

◆ ncols()

◆ nrows()

◆ operator()() [1/4]

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

Returns true if variable size is zero.

Returns the number of rows. Returns the number of columns. Const index operator for subrange. We have to also account for the case, that *this is already a subrange of a Matrix. This allows correct recursive behavior.

Definition at line 753 of file matpack_complex.cc.

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

◆ operator()() [2/4]

ConstComplexVectorView ConstComplexMatrixView::operator() ( const Range r,
Index  c 
) const

Const index operator returning a column as an object of type C onstComplex*VectorView.

Parameters
rA range of rows.
cIndex of selected column

Definition at line 763 of file matpack_complex.cc.

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

◆ operator()() [3/4]

ConstComplexVectorView ConstComplexMatrixView::operator() ( Index  r,
const Range c 
) const

Const index operator returning a row as an object of type C onstComplex*VectorView.

Parameters
rIndex of selected row.
cRange of columns

Definition at line 777 of file matpack_complex.cc.

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

◆ operator()() [4/4]

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

Plain const index operator.

Definition at line 681 of file matpack_complex.h.

References ARTS_ASSERT, c, get(), mcr, Range::mextent, and mrr.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

ConstComplexMatrixView & ConstComplexMatrixView::operator= ( ConstComplexMatrixView &&  )
default

◆ real()

ConstMatrixView ConstComplexMatrixView::real ( ) const
inline

Get a view of the real part of the matrix.

Definition at line 703 of file matpack_complex.h.

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

◆ selem()

Index ConstComplexMatrixView::selem ( ) const
inlinenoexcept

Definition at line 669 of file matpack_complex.h.

References mcr, mrr, and Range::mstart.

◆ size()

Index ConstComplexMatrixView::size ( ) const
inlinenoexcept

Definition at line 676 of file matpack_complex.h.

References ncols(), and nrows().

Friends And Related Function Documentation

◆ ComplexMatrixView

friend class ComplexMatrixView
friend

Definition at line 728 of file matpack_complex.h.

◆ ConstComplexVectorView

friend class ConstComplexVectorView
friend

Definition at line 729 of file matpack_complex.h.

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

◆ mult [1/4]

void mult ( ComplexMatrixView  ,
const ConstComplexMatrixView ,
const ConstComplexMatrixView  
)
friend

Matrix-Matrix Multiplication.

Uses the Eigen library. Be carful to test the size of your input beforehand. Note that to keep speed, the inputs should be different variables. There is memory duplication if this is not the case. Note that it is mdata that is checked, so even if the matrices are at different parts of a tensor, there is still a slowdown

Parameters
[in,out]AThe matrix A, that will hold the result of the multiplication.
[in]BThe matrix B
[in]CThe matrix C

Definition at line 1562 of file matpack_complex.cc.

◆ mult [2/4]

void mult ( ComplexMatrixView  ,
const ConstComplexMatrixView ,
const ConstMatrixView  
)
friend

Definition at line 1576 of file matpack_complex.cc.

◆ mult [3/4]

void mult ( ComplexMatrixView  ,
const ConstMatrixView ,
const ConstComplexMatrixView  
)
friend

Definition at line 1590 of file matpack_complex.cc.

◆ mult [4/4]

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

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ConstComplexMatrixView v 
)
friend

Output operator.

This demonstrates how iterators can be used to traverse the matrix. The iterators know which part of the matrix is ‘active’, and also the strides in both directions. This function is a bit more complicated than necessary to illustrate the concept, because the formating should look nice. This means that the first row, and the first element in each row, have to be treated individually.

Definition at line 855 of file matpack_complex.cc.

◆ transpose

Const version of transpose.

Definition at line 1467 of file matpack_complex.cc.

Member Data Documentation

◆ mcr

◆ mdata

◆ mrr


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