ARTS 2.5.4 (git: 4c0d3b4d)
|
The ComplexMatrixView class. More...
#include <matpack_complex.h>
Public Types | |
using | iterator = ComplexIterator2D |
![]() | |
using | const_iterator = ConstComplexIterator2D |
Public Member Functions | |
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... | |
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... | |
![]() | |
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 | |
![]() | |
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 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.
Definition at line 787 of file matpack_complex.h.
|
constexprdefault |
|
overridedefault |
Destructor.
|
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()().
|
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.
|
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.
Definition at line 1306 of file matpack_complex.cc.
ComplexIterator2D ComplexMatrixView::begin | ( | ) |
Return iterator to first row.
Definition at line 949 of file matpack_complex.cc.
References ComplexVectorView, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by ComplexMatrix::ComplexMatrix(), operator*=(), operator+=(), operator-=(), operator/=(), ComplexMatrix::operator=(), and operator=().
ConstComplexIterator2D ConstComplexMatrixView::begin | ( | ) | const |
Return const iterator to first row.
Definition at line 712 of file matpack_complex.cc.
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)
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().
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)
Definition at line 716 of file matpack_complex.cc.
ComplexIterator2D ComplexMatrixView::end | ( | ) |
Return iterator behind last row.
Definition at line 955 of file matpack_complex.cc.
References ComplexVectorView, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by ComplexMatrix::ComplexMatrix(), operator*=(), operator+=(), operator-=(), operator/=(), ComplexMatrix::operator=(), and operator=().
ConstComplexIterator2D ConstComplexMatrixView::end | ( | ) | const |
Return const iterator behind last row.
Definition at line 713 of file matpack_complex.cc.
Get element implementation without assertions.
Definition at line 801 of file matpack_complex.h.
References c, and ConstComplexVectorView::mdata.
Get element implementation without assertions.
Definition at line 685 of file matpack_complex.h.
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.
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 element implementation without assertions.
Definition at line 812 of file matpack_complex.h.
References c, ComplexVectorView::get(), and ComplexVectorView::imag().
Get element implementation without assertions.
Definition at line 694 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 807 of file matpack_complex.h.
References c, ComplexVectorView::get(), and ComplexVectorView::real().
Get element implementation without assertions.
Definition at line 691 of file matpack_complex.h.
|
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().
|
inline |
Get a view of the imaginary part of the matrix.
Definition at line 701 of file matpack_complex.h.
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.
ComplexVectorView ComplexMatrixView::operator() | ( | const Range & | r, |
Index | c | ||
) |
Index operator returning a column as an object of type ComplexVectorView.
r | A range of rows. |
c | Index 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.
ComplexVectorView ComplexMatrixView::operator() | ( | Index | r, |
const Range & | c | ||
) |
Index operator returning a row as an object of type ComplexVectorView.
r | Index of selected row. |
c | Range 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.
Plain index operator.
Definition at line 791 of file matpack_complex.h.
References ARTS_ASSERT, c, and ComplexVectorView::get().
ComplexMatrixView & ComplexMatrixView::operator*= | ( | Complex | x | ) |
Multiplication by scalar.
Definition at line 1039 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator*= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise multiplication by another Matrix.
Definition at line 1145 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstComplexVectorView::begin(), ConstComplexMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), and ConstComplexMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator*= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator*= | ( | const ConstMatrixView & | x | ) |
Element-vise multiplication by another Matrix.
Definition at line 1162 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstVectorView::begin(), ConstMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), ConstMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ConstMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator*= | ( | Numeric | x | ) |
Multiplication by scalar.
Definition at line 1049 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator+= | ( | Complex | x | ) |
Addition of scalar.
Definition at line 1079 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator+= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise addition of another Matrix.
Definition at line 1211 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstComplexVectorView::begin(), ConstComplexMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), and ConstComplexMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator+= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator+= | ( | const ConstMatrixView & | x | ) |
Element-vise addition of another Matrix.
Definition at line 1228 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstVectorView::begin(), ConstMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), ConstMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ConstMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator+= | ( | Numeric | x | ) |
Addition of scalar.
Definition at line 1089 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator-= | ( | Complex | x | ) |
Subtraction of scalar.
Definition at line 1099 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator-= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise subtraction of another Matrix.
Definition at line 1244 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstComplexVectorView::begin(), ConstComplexMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), and ConstComplexMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator-= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator-= | ( | const ConstMatrixView & | x | ) |
Element-vise subtraction of another Matrix.
Definition at line 1261 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstVectorView::begin(), ConstMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), ConstMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ConstMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator-= | ( | Numeric | x | ) |
Subtraction of scalar.
Definition at line 1109 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator/= | ( | Complex | x | ) |
Division by scalar.
Definition at line 1059 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator/= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise division by another Matrix.
Definition at line 1178 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstComplexVectorView::begin(), ConstComplexMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), and ConstComplexMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator/= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator/= | ( | const ConstMatrixView & | x | ) |
Element-vise division by another Matrix.
Definition at line 1195 of file matpack_complex.cc.
References ARTS_ASSERT, ComplexVectorView::begin(), begin(), ConstVectorView::begin(), ConstMatrixView::begin(), c, ComplexVectorView::end(), end(), ConstComplexMatrixView::ncols(), ConstMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ConstMatrixView::nrows().
ComplexMatrixView & ComplexMatrixView::operator/= | ( | Numeric | x | ) |
Division by scalar.
Definition at line 1069 of file matpack_complex.cc.
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.
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.
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.
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.
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.
|
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().
|
inline |
Get a view of the real part of the matrix.
Definition at line 697 of file matpack_complex.h.
|
friend |
Definition at line 875 of file matpack_complex.h.
Referenced by begin(), diagonal(), end(), and operator()().
|
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.
|
friend |
Const version of transpose.
Definition at line 1516 of file matpack_complex.cc.