ARTS 2.5.4 (git: 4c0d3b4d)
|
The ComplexMatrix class. More...
#include <matpack_complex.h>
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... | |
ComplexMatrix & | operator= (ComplexMatrix x) |
Assignment operator from another matrix. More... | |
ComplexMatrix & | operator= (Complex x) |
Assignment operator from scalar. More... | |
ComplexMatrix & | operator= (const ConstComplexVectorView &v) |
Assignment from a vector. More... | |
ComplexMatrix & | inv (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 |
Complex * | get_raw_data () |
![]() | |
constexpr | ComplexMatrixView (const ComplexMatrixView &)=default |
Complex & | operator() (Index r, Index c) |
Plain index operator. More... | |
Complex & | get (Index r, Index c) |
Get element implementation without assertions. More... | |
Numeric & | get_real (Index r, Index c) |
Get element implementation without assertions. More... | |
Numeric & | get_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... | |
ComplexMatrixView & | operator= (const ConstComplexMatrixView &v) |
Assignment operator. More... | |
ComplexMatrixView & | operator= (const ComplexMatrixView &v) |
Assignment from ComplexMatrixView to ComplexMatrixView. More... | |
ComplexMatrixView & | operator= (const ComplexMatrix &v) |
Assignment from a ComplexMatrix. More... | |
ComplexMatrixView & | operator= (const ConstComplexVectorView &v) |
Assignment from a vector. More... | |
ComplexMatrixView & | operator= (Complex x) |
Assigning a scalar to a MatrixView will set all elements to this value. More... | |
ComplexMatrixView & | operator*= (Complex x) |
Multiplication by scalar. More... | |
ComplexMatrixView & | operator/= (Complex x) |
Division by scalar. More... | |
ComplexMatrixView & | operator+= (Complex x) |
Addition of scalar. More... | |
ComplexMatrixView & | operator-= (Complex x) |
Subtraction of scalar. More... | |
ComplexMatrixView & | operator*= (Numeric x) |
Multiplication by scalar. More... | |
ComplexMatrixView & | operator/= (Numeric x) |
Division by scalar. More... | |
ComplexMatrixView & | operator+= (Numeric x) |
Addition of scalar. More... | |
ComplexMatrixView & | operator-= (Numeric x) |
Subtraction of scalar. More... | |
ComplexMatrixView & | operator*= (const ConstComplexMatrixView &x) |
Element-vise multiplication by another Matrix. More... | |
ComplexMatrixView & | operator/= (const ConstComplexMatrixView &x) |
Element-vise division by another Matrix. More... | |
ComplexMatrixView & | operator+= (const ConstComplexMatrixView &x) |
Element-vise addition of another Matrix. More... | |
ComplexMatrixView & | operator-= (const ConstComplexMatrixView &x) |
Element-vise subtraction of another Matrix. More... | |
ComplexMatrixView & | operator*= (const ConstMatrixView &x) |
Element-vise multiplication by another Matrix. More... | |
ComplexMatrixView & | operator/= (const ConstMatrixView &x) |
Element-vise division by another Matrix. More... | |
ComplexMatrixView & | operator+= (const ConstMatrixView &x) |
Element-vise addition of another Matrix. More... | |
ComplexMatrixView & | operator-= (const ConstMatrixView &x) |
Element-vise subtraction of another Matrix. More... | |
ComplexMatrixView & | operator*= (const ConstComplexVectorView &x) |
ComplexMatrixView & | operator/= (const ConstComplexVectorView &x) |
ComplexMatrixView & | operator+= (const ConstComplexVectorView &x) |
ComplexMatrixView & | operator-= (const ConstComplexVectorView &x) |
const Complex * | get_c_array () const ARTS_NOEXCEPT |
Conversion to plain C-array. More... | |
Complex * | get_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... | |
![]() | |
constexpr | ConstComplexMatrixView (const ConstComplexMatrixView &)=default |
constexpr | ConstComplexMatrixView (ConstComplexMatrixView &&)=default |
ConstComplexMatrixView & | operator= (const ConstComplexMatrixView &)=default |
ConstComplexMatrixView & | operator= (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 | |
![]() | |
using | iterator = ComplexIterator2D |
![]() | |
using | const_iterator = ConstComplexIterator2D |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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... | |
Complex * | mdata {nullptr} |
Pointer to the plain C array that holds the data. More... | |
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:
Definition at line 898 of file matpack_complex.h.
|
default |
Constructor setting size.
This constructor has to set the stride in the row range correctly!
Definition at line 1358 of file matpack_complex.cc.
Constructor setting size and filling with constant value.
Definition at line 1364 of file matpack_complex.cc.
References c, and ConstComplexMatrixView::mdata.
Constructor setting size and filling with constant value.
Definition at line 1373 of file matpack_complex.cc.
References c, and ConstComplexMatrixView::mdata.
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::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().
|
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.
|
inline |
Definition at line 928 of file matpack_complex.h.
References ConstComplexVectorView::mdata.
ComplexMatrix & ComplexMatrix::inv | ( | const lapack_help::Inverse< Complex > & | help = lapack_help::Inverse<Complex>{0} | ) |
Definition at line 1496 of file matpack_complex.cc.
References ARTS_ASSERT, ARTS_USER_ERROR_IF, lapack_help::Inverse< T >::ipivdata(), lapack_help::Inverse< T >::lsize(), ConstComplexMatrixView::mdata, ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), lapack_help::Inverse< T >::resize_if_smaller(), lapack_help::Inverse< T >::size(), lapack_help::Inverse< T >::workdata(), lapack::zgetrf_(), and lapack::zgetri_().
Referenced by Absorption::LineMixing::EquivalentLines::EquivalentLines(), and lm_hitran_2017::eqvlines().
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().
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.)
m | The other matrix to assign to this one. |
Definition at line 1428 of file matpack_complex.cc.
References swap.
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.
v | The vector to assign to this matrix. |
Definition at line 1453 of file matpack_complex.cc.
References ComplexMatrixView::begin(), ConstComplexMatrixView::begin(), copy(), ConstComplexMatrixView::end(), resize(), and v.
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=().
|
inlinenoexcept |
Definition at line 926 of file matpack_complex.h.
|
friend |