ARTS 2.5.10 (git: 2f1c442c)
|
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. | |
Complex & | get (Index r, Index c) |
Get element implementation without assertions. | |
Numeric & | get_real (Index r, Index c) |
Get element implementation without assertions. | |
Numeric & | get_imag (Index r, Index c) |
Get element implementation without assertions. | |
MatrixView | real () |
Get a view of the real part of the matrix. | |
MatrixView | imag () |
Get a view of the imaginary parts of the matrix. | |
ComplexMatrixView | operator() (const Range &r, const Range &c) |
Index operator for subrange. | |
ComplexVectorView | operator() (const Range &r, Index c) |
Index operator returning a column as an object of type ComplexVectorView. | |
ComplexVectorView | operator() (Index r, const Range &c) |
Index operator returning a row as an object of type ComplexVectorView. | |
ComplexIterator2D | begin () |
Return iterator to first row. | |
ComplexIterator2D | end () |
Return iterator behind last row. | |
ComplexVectorView | diagonal () |
ComplexMatrix diagonal as vector. | |
ComplexMatrixView & | operator= (const ConstComplexMatrixView &v) |
Assignment operator. | |
ComplexMatrixView & | operator= (const ComplexMatrixView &v) |
Assignment from ComplexMatrixView to ComplexMatrixView. | |
ComplexMatrixView & | operator= (const ComplexMatrix &v) |
Assignment from a ComplexMatrix. | |
ComplexMatrixView & | operator= (const ConstComplexVectorView &v) |
Assignment from a vector. | |
ComplexMatrixView & | operator= (Complex x) |
Assigning a scalar to a MatrixView will set all elements to this value. | |
ComplexMatrixView & | operator*= (Complex x) |
Multiplication by scalar. | |
ComplexMatrixView & | operator/= (Complex x) |
Division by scalar. | |
ComplexMatrixView & | operator+= (Complex x) |
Addition of scalar. | |
ComplexMatrixView & | operator-= (Complex x) |
Subtraction of scalar. | |
ComplexMatrixView & | operator*= (Numeric x) |
Multiplication by scalar. | |
ComplexMatrixView & | operator/= (Numeric x) |
Division by scalar. | |
ComplexMatrixView & | operator+= (Numeric x) |
Addition of scalar. | |
ComplexMatrixView & | operator-= (Numeric x) |
Subtraction of scalar. | |
ComplexMatrixView & | operator*= (const ConstComplexMatrixView &x) |
Element-vise multiplication by another Matrix. | |
ComplexMatrixView & | operator/= (const ConstComplexMatrixView &x) |
Element-vise division by another Matrix. | |
ComplexMatrixView & | operator+= (const ConstComplexMatrixView &x) |
Element-vise addition of another Matrix. | |
ComplexMatrixView & | operator-= (const ConstComplexMatrixView &x) |
Element-vise subtraction of another Matrix. | |
ComplexMatrixView & | operator*= (const ConstMatrixView &x) |
Element-vise multiplication by another Matrix. | |
ComplexMatrixView & | operator/= (const ConstMatrixView &x) |
Element-vise division by another Matrix. | |
ComplexMatrixView & | operator+= (const ConstMatrixView &x) |
Element-vise addition of another Matrix. | |
ComplexMatrixView & | operator-= (const ConstMatrixView &x) |
Element-vise subtraction of another Matrix. | |
ComplexMatrixView & | operator*= (const ConstComplexVectorView &x) |
ComplexMatrixView & | operator/= (const ConstComplexVectorView &x) |
ComplexMatrixView & | operator+= (const ConstComplexVectorView &x) |
ComplexMatrixView & | operator-= (const ConstComplexVectorView &x) |
~ComplexMatrixView () override=default | |
Destructor. | |
ConstComplexIterator2D | begin () const |
Return const iterator to first row. | |
ConstComplexIterator2D | end () const |
Return const iterator behind last row. | |
Complex | get (Index r, Index c) const |
Get element implementation without assertions. | |
Numeric | get_imag (Index r, Index c) const |
Get element implementation without assertions. | |
Numeric | get_real (Index r, Index c) const |
Get element implementation without assertions. | |
ConstMatrixView | imag () const |
Get a view of the imaginary part of the matrix. | |
ConstMatrixView | real () const |
Get a view of the real part of the matrix. | |
ConstComplexVectorView | diagonal () const |
ComplexMatrix diagonal as vector. | |
![]() | |
constexpr | ConstComplexMatrixView (const ConstComplexMatrixView &)=default |
constexpr | ConstComplexMatrixView (ConstComplexMatrixView &&)=default |
ConstComplexMatrixView & | operator= (const ConstComplexMatrixView &)=default |
ConstComplexMatrixView & | operator= (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. | |
Complex | get (Index r, Index c) const |
Get element implementation without assertions. | |
Numeric | get_real (Index r, Index c) const |
Get element implementation without assertions. | |
Numeric | get_imag (Index r, Index c) const |
Get element implementation without assertions. | |
ConstMatrixView | real () const |
Get a view of the real part of the matrix. | |
ConstMatrixView | imag () const |
Get a view of the imaginary part of the matrix. | |
Index | get_column_extent () const |
Get the extent of the underlying data. | |
ConstComplexMatrixView | operator() (const Range &r, const Range &c) const |
Returns true if variable size is zero. | |
ConstComplexVectorView | operator() (const Range &r, Index c) const |
Const index operator returning a column as an object of type C onstComplex*VectorView. | |
ConstComplexVectorView | operator() (Index r, const Range &c) const |
Const index operator returning a row as an object of type C onstComplex*VectorView. | |
ConstComplexIterator2D | begin () const |
Return const iterator to first row. | |
ConstComplexIterator2D | end () const |
Return const iterator behind last row. | |
ConstComplexVectorView | diagonal () const |
ComplexMatrix diagonal as vector. | |
virtual | ~ConstComplexMatrixView ()=default |
Destructor. | |
Complex * | get_c_array () const noexcept |
Protected Member Functions | |
ComplexMatrixView () | |
Default constructor. | |
ComplexMatrixView (Complex *data, const Range &r, const Range &c) | |
Explicit constructor. | |
ComplexMatrixView (Complex *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc) | |
Recursive constructor. | |
![]() | |
ConstComplexMatrixView ()=default | |
ConstComplexMatrixView (Complex *data, const Range &r, const Range &c) | |
Explicit constructor. | |
ConstComplexMatrixView (Complex *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc) | |
Recursive constructor. | |
Friends | |
class | ComplexVectorView |
ConstComplexMatrixView | transpose (ConstComplexMatrixView m) |
Const version of transpose. | |
ComplexMatrixView | transpose (ComplexMatrixView m) |
Returns the transpose. | |
Additional Inherited Members | |
![]() | |
static constexpr bool | matpack_type {true} |
![]() | |
Range | mrr {0, 0, 1} |
The row range of mdata that is actually used. | |
Range | mcr {0, 0, 1} |
The column range of mdata that is actually used. | |
Complex * | mdata {nullptr} |
Pointer to the plain C array that holds the data. | |
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 794 of file matpack_complex.h.
Definition at line 810 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 1271 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 1278 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 1299 of file matpack_complex.cc.
ComplexIterator2D ComplexMatrixView::begin | ( | ) |
Return iterator to first row.
Definition at line 968 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 735 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 989 of file matpack_complex.cc.
References ComplexVectorView, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by lm_hitran_2017::convtp(), and lm_hitran_2017::hitran_lm_eigenvalue_approximation().
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 739 of file matpack_complex.cc.
ComplexIterator2D ComplexMatrixView::end | ( | ) |
Return iterator behind last row.
Definition at line 974 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 736 of file matpack_complex.cc.
Get element implementation without assertions.
Definition at line 826 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 710 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 835 of file matpack_complex.h.
References c, ComplexVectorView::get(), and ComplexVectorView::imag().
Get element implementation without assertions.
Definition at line 719 of file matpack_complex.h.
Get element implementation without assertions.
Definition at line 830 of file matpack_complex.h.
References c, ComplexVectorView::get(), and ComplexVectorView::real().
Get element implementation without assertions.
Definition at line 716 of file matpack_complex.h.
MatrixView ComplexMatrixView::imag | ( | ) |
Get a view of the imaginary parts of the matrix.
Definition at line 686 of file matpack_complex.cc.
References ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by lm_hitran_2017::calcw(), lm_hitran_2017::convtp(), Absorption::LineMixing::rosenkranz_approximation(), and Absorption::LineMixing::single_species_ecs_relaxation_matrix().
ConstMatrixView ConstComplexMatrixView::imag | ( | ) | const |
Get a view of the imaginary part of the matrix.
Definition at line 725 of file matpack_complex.cc.
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 938 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 947 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 959 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 816 of file matpack_complex.h.
References ARTS_ASSERT, c, GETFUN, ConstComplexMatrixView::mcr, Range::mextent, and ConstComplexMatrixView::mrr.
ComplexMatrixView & ComplexMatrixView::operator*= | ( | Complex | x | ) |
Multiplication by scalar.
Definition at line 1058 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator*= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise multiplication by another Matrix.
Definition at line 1138 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 1155 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 1068 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator+= | ( | Complex | x | ) |
Addition of scalar.
Definition at line 1098 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator+= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise addition of another Matrix.
Definition at line 1204 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 1221 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 1108 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator-= | ( | Complex | x | ) |
Subtraction of scalar.
Definition at line 1118 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator-= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise subtraction of another Matrix.
Definition at line 1237 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 1254 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 1128 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator/= | ( | Complex | x | ) |
Division by scalar.
Definition at line 1078 of file matpack_complex.cc.
ComplexMatrixView & ComplexMatrixView::operator/= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise division by another Matrix.
Definition at line 1171 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 1188 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 1088 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 1052 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 1026 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 1014 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 999 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 1039 of file matpack_complex.cc.
References ARTS_ASSERT, begin(), ConstComplexMatrixView::begin(), copy(), ConstComplexMatrixView::end(), ConstComplexMatrixView::mcr, Range::mextent, ConstComplexMatrixView::mrr, and v.
MatrixView ComplexMatrixView::real | ( | ) |
Get a view of the real part of the matrix.
Definition at line 680 of file matpack_complex.cc.
References ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by propmat_clearskyAddLines().
ConstMatrixView ConstComplexMatrixView::real | ( | ) | const |
Get a view of the real part of the matrix.
Definition at line 722 of file matpack_complex.cc.
|
friend |
Definition at line 892 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 1516 of file matpack_complex.cc.
|
friend |
Const version of transpose.
Definition at line 1510 of file matpack_complex.cc.