ARTS 2.5.4 (git: 4c0d3b4d)
ComplexMatrix Class Reference

The ComplexMatrix class. More...

#include <matpack_complex.h>

Inheritance diagram for ComplexMatrix:
ComplexMatrixView ConstComplexMatrixView

Public Member Functions

 ComplexMatrix ()=default
 
 ComplexMatrix (Index r, Index c)
 Constructor setting size. More...
 
 ComplexMatrix (Index r, Index c, Complex fill)
 Constructor setting size and filling with constant value. More...
 
 ComplexMatrix (Index r, Index c, Numeric fill)
 Constructor setting size and filling with constant value. More...
 
 ComplexMatrix (const ConstComplexMatrixView &v)
 Copy constructor from MatrixView. More...
 
 ComplexMatrix (const ComplexMatrix &v)
 Copy constructor from Matrix. More...
 
ComplexMatrixoperator= (ComplexMatrix x)
 Assignment operator from another matrix. More...
 
ComplexMatrixoperator= (Complex x)
 Assignment operator from scalar. More...
 
ComplexMatrixoperator= (const ConstComplexVectorView &v)
 Assignment from a vector. More...
 
ComplexMatrixinv (const lapack_help::Inverse< Complex > &help=lapack_help::Inverse< Complex >{0})
 
void resize (Index r, Index c)
 Resize function. More...
 
 ~ComplexMatrix () override
 Destructor for Matrix. More...
 
Index size () const noexcept
 
Complexget_raw_data ()
 
- Public Member Functions inherited from ComplexMatrixView
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...
 

Friends

void swap (ComplexMatrix &m1, ComplexMatrix &m2)
 Swaps two objects. More...
 

Additional Inherited Members

- Public Types inherited from ComplexMatrixView
using iterator = ComplexIterator2D
 
- Public Types inherited from ConstComplexMatrixView
using const_iterator = ConstComplexIterator2D
 
- Protected Member Functions inherited from ComplexMatrixView
 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...
 
- 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 ComplexMatrix class.

This is a ComplexMatrixView that also allocates storage automatically, and deallocates it when it is destroyed. We take * all the functionality from ComplexMatrixView. Additionally defined here are:

  1. Constructors and destructor.
  2. Assignment operator from scalar.
  3. Resize function.

Definition at line 898 of file matpack_complex.h.

Constructor & Destructor Documentation

◆ ComplexMatrix() [1/6]

ComplexMatrix::ComplexMatrix ( )
default

◆ ComplexMatrix() [2/6]

ComplexMatrix::ComplexMatrix ( Index  r,
Index  c 
)

Constructor setting size.

This constructor has to set the stride in the row range correctly!

Definition at line 1358 of file matpack_complex.cc.

◆ ComplexMatrix() [3/6]

ComplexMatrix::ComplexMatrix ( Index  r,
Index  c,
Complex  fill 
)

Constructor setting size and filling with constant value.

Definition at line 1364 of file matpack_complex.cc.

References c, and ConstComplexMatrixView::mdata.

◆ ComplexMatrix() [4/6]

ComplexMatrix::ComplexMatrix ( Index  r,
Index  c,
Numeric  fill 
)

Constructor setting size and filling with constant value.

Definition at line 1373 of file matpack_complex.cc.

References c, and ConstComplexMatrixView::mdata.

◆ ComplexMatrix() [5/6]

ComplexMatrix::ComplexMatrix ( const ConstComplexMatrixView m)

Copy constructor from MatrixView.

This automatically sets the size and copies the data.

Definition at line 1383 of file matpack_complex.cc.

References ComplexMatrixView::begin(), ConstComplexMatrixView::begin(), copy(), and ConstComplexMatrixView::end().

◆ ComplexMatrix() [6/6]

ComplexMatrix::ComplexMatrix ( const ComplexMatrix m)

Copy constructor from Matrix.

This automatically sets the size and copies the data.

Definition at line 1392 of file matpack_complex.cc.

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

◆ ~ComplexMatrix()

ComplexMatrix::~ComplexMatrix ( )
override

Destructor for Matrix.

This is important, since Matrix uses new to allocate storage.

Definition at line 1490 of file matpack_complex.cc.

References ConstComplexMatrixView::mdata.

Member Function Documentation

◆ get_raw_data()

Complex * ComplexMatrix::get_raw_data ( )
inline

Definition at line 928 of file matpack_complex.h.

References ConstComplexVectorView::mdata.

◆ inv()

◆ operator=() [1/3]

ComplexMatrix & ComplexMatrix::operator= ( Complex  x)

Assignment operator from scalar.

Assignment operators also seem to be not inherited.

Definition at line 1435 of file matpack_complex.cc.

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

◆ operator=() [2/3]

ComplexMatrix & ComplexMatrix::operator= ( ComplexMatrix  m)

Assignment operator from another matrix.

While dimensions of MatrixViews can not be adjusted, dimensions of matrices can be adjusted. Hence, the behavior of the assignment operator is different.

In this case the size of the target is automatically adjusted. This is important, so that structures containing matrices are copied correctly.

This is a deviation from the old ARTS paradigm that sizes must match exactly before copying!

Note: It is sufficient to have only this one version of the assignment (Matrix = Matrix). It implicitly covers the cases Matrix=MatrixView, etc, because there is a default constructor for Matrix from MatrixView. (See C++ Primer Plus, page 571ff.)

Parameters
mThe other matrix to assign to this one.
Returns
This matrix, by tradition.
Author
Stefan Buehler
Date
2002-12-19

Definition at line 1428 of file matpack_complex.cc.

References swap.

◆ operator=() [3/3]

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

Assignment from a vector.

This copies the data from a VectorView to this MatrixView.

The dimension is adjusted automatically.

Parameters
vThe vector to assign to this matrix.
Returns
This matrix, by tradition.
Author
Stefan Buehler
Date
2002-12-19

Definition at line 1453 of file matpack_complex.cc.

References ComplexMatrixView::begin(), ConstComplexMatrixView::begin(), copy(), ConstComplexMatrixView::end(), resize(), and v.

◆ resize()

void ComplexMatrix::resize ( Index  r,
Index  c 
)

Resize function.

If the size is already correct this function does nothing. All data is lost after resizing! The new Matrix is not initialized, so it will contain random values.

Definition at line 1463 of file matpack_complex.cc.

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

Referenced by operator=().

◆ size()

Index ComplexMatrix::size ( ) const
inlinenoexcept

Definition at line 926 of file matpack_complex.h.

Friends And Related Function Documentation

◆ swap

void swap ( ComplexMatrix m1,
ComplexMatrix m2 
)
friend

Swaps two objects.

Definition at line 1482 of file matpack_complex.cc.

Referenced by operator=().


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