ARTS
2.4.0(git:4fb77825)
|
The ComplexMatrixView class. More...
#include <complex.h>
Public Types | |
typedef ComplexIterator2D | iterator |
Public Types inherited from ConstComplexMatrixView | |
typedef ConstComplexIterator2D | const_iterator |
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 |
Conversion to plain C-array. More... | |
Complex * | get_c_array () |
Conversion to plain C-array. More... | |
virtual | ~ComplexMatrixView ()=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 |
ConstComplexMatrixView & | operator= (const ConstComplexMatrixView &)=default |
ConstComplexMatrixView & | operator= (ConstComplexMatrixView &&)=default |
bool | empty () const |
Index | nrows () const |
Index | ncols () const |
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... | |
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... | |
Friends | |
class | ComplexVectorView |
ConstComplexMatrixView | transpose (ConstComplexMatrixView m) |
Const version of transpose. More... | |
ComplexMatrixView | transpose (ComplexMatrixView m) |
Returns the transpose. More... | |
Additional Inherited Members | |
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... | |
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.
|
constexprdefault |
|
virtualdefault |
Destructor.
|
protected |
Default constructor.
This is necessary, so that we can have a default constructor for the derived class Matrix.
Definition at line 1270 of file complex.cc.
|
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 1277 of file 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 1298 of file complex.cc.
ComplexIterator2D ComplexMatrixView::begin | ( | ) |
Return iterator to first row.
Definition at line 937 of file 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 |
Return const iterator to first row.
Definition at line 672 of file 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 958 of file complex.cc.
References ComplexVectorView, ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, min, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
ConstComplexVectorView ConstComplexMatrixView::diagonal |
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 676 of file complex.cc.
ComplexIterator2D ComplexMatrixView::end | ( | ) |
Return iterator behind last row.
Definition at line 943 of file 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 |
Return const iterator behind last row.
Definition at line 673 of file complex.cc.
|
inline |
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 1127 of file complex.cc.
References 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 1112 of file complex.cc.
References ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by diagonalize(), and inv().
|
inline |
|
inline |
|
inline |
Get a view of the imaginary parts of the matrix.
Definition at line 781 of file complex.h.
References ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
|
inline |
Get a view of the imaginary part of the matrix.
Definition at line 661 of file complex.h.
References ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
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 907 of file complex.cc.
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 916 of file complex.cc.
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 928 of file complex.cc.
ComplexMatrixView & ComplexMatrixView::operator*= | ( | Complex | x | ) |
Multiplication by scalar.
Definition at line 1027 of file complex.cc.
ComplexMatrixView & ComplexMatrixView::operator*= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise multiplication by another Matrix.
Definition at line 1137 of file complex.cc.
References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView& ComplexMatrixView::operator*= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator*= | ( | const ConstMatrixView & | x | ) |
Element-vise multiplication by another Matrix.
Definition at line 1154 of file complex.cc.
References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView & ComplexMatrixView::operator*= | ( | Numeric | x | ) |
Multiplication by scalar.
Definition at line 1037 of file complex.cc.
ComplexMatrixView & ComplexMatrixView::operator+= | ( | Complex | x | ) |
ComplexMatrixView & ComplexMatrixView::operator+= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise addition of another Matrix.
Definition at line 1203 of file complex.cc.
References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView& ComplexMatrixView::operator+= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator+= | ( | const ConstMatrixView & | x | ) |
Element-vise addition of another Matrix.
Definition at line 1220 of file complex.cc.
References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView & ComplexMatrixView::operator+= | ( | Numeric | x | ) |
ComplexMatrixView & ComplexMatrixView::operator-= | ( | Complex | x | ) |
ComplexMatrixView & ComplexMatrixView::operator-= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise subtraction of another Matrix.
Definition at line 1236 of file complex.cc.
References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView& ComplexMatrixView::operator-= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator-= | ( | const ConstMatrixView & | x | ) |
Element-vise subtraction of another Matrix.
Definition at line 1253 of file complex.cc.
References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView & ComplexMatrixView::operator-= | ( | Numeric | x | ) |
ComplexMatrixView & ComplexMatrixView::operator/= | ( | Complex | x | ) |
ComplexMatrixView & ComplexMatrixView::operator/= | ( | const ConstComplexMatrixView & | x | ) |
Element-vise division by another Matrix.
Definition at line 1170 of file complex.cc.
References begin(), ConstComplexVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView& ComplexMatrixView::operator/= | ( | const ConstComplexVectorView & | x | ) |
ComplexMatrixView & ComplexMatrixView::operator/= | ( | const ConstMatrixView & | x | ) |
Element-vise division by another Matrix.
Definition at line 1187 of file complex.cc.
References begin(), ConstVectorView::begin(), end(), ConstComplexMatrixView::ncols(), ConstComplexMatrixView::nrows(), and ARTS::Var::x().
ComplexMatrixView & ComplexMatrixView::operator/= | ( | Numeric | x | ) |
ComplexMatrixView & ComplexMatrixView::operator= | ( | Complex | x | ) |
Assigning a scalar to a MatrixView will set all elements to this value.
Definition at line 1021 of file complex.cc.
References begin(), copy(), end(), and ARTS::Var::x().
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 995 of file complex.cc.
References 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 983 of file complex.cc.
References 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 968 of file complex.cc.
References 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 1008 of file complex.cc.
References begin(), ConstComplexMatrixView::begin(), copy(), ConstComplexMatrixView::end(), ConstComplexMatrixView::mcr, Range::mextent, ConstComplexMatrixView::mrr, and ConstComplexVectorView::nelem().
|
inline |
Get a view of the real part of the matrix.
Definition at line 777 of file complex.h.
References ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
|
inline |
Get a view of the real part of the matrix.
Definition at line 657 of file complex.h.
References ConstComplexMatrixView::mcr, ConstComplexMatrixView::mdata, Range::mextent, ConstComplexMatrixView::mrr, Range::mstart, and Range::mstride.
|
friend |
Definition at line 835 of file complex.h.
Referenced by begin(), diagonal(), and end().
|
friend |
Returns the transpose.
This creates a special MatrixView for the transpose. The original is not changed!
Definition at line 1515 of file complex.cc.
|
friend |
Const version of transpose.
Definition at line 1509 of file complex.cc.