ARTS
2.4.0(git:4fb77825)
|
The ComplexMatrix class. More...
#include <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... | |
virtual | ~ComplexMatrix () |
Destructor for Matrix. More... | |
Complex * | get_raw_data () |
Public Member Functions inherited from ComplexMatrixView | |
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... | |
Friends | |
void | swap (ComplexMatrix &m1, ComplexMatrix &m2) |
Swaps two objects. More... | |
Additional Inherited Members | |
Public Types inherited from ComplexMatrixView | |
typedef ComplexIterator2D | iterator |
Public Types inherited from ConstComplexMatrixView | |
typedef ConstComplexIterator2D | const_iterator |
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... | |
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:
|
default |
Constructor setting size.
This constructor has to set the stride in the row range correctly!
Definition at line 1350 of file complex.cc.
Constructor setting size and filling with constant value.
Definition at line 1356 of file complex.cc.
Constructor setting size and filling with constant value.
Definition at line 1365 of file complex.cc.
ComplexMatrix::ComplexMatrix | ( | const ConstComplexMatrixView & | m | ) |
Copy constructor from MatrixView.
This automatically sets the size and copies the data.
Definition at line 1375 of file 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 1384 of file complex.cc.
References ComplexMatrixView::begin(), copy(), and ComplexMatrixView::end().
|
virtual |
Destructor for Matrix.
This is important, since Matrix uses new to allocate storage.
Definition at line 1482 of file complex.cc.
References ConstComplexMatrixView::mdata.
|
inline |
Definition at line 885 of file complex.h.
References ConstComplexMatrixView::mdata.
ComplexMatrix & ComplexMatrix::inv | ( | const lapack_help::Inverse< Complex > & | help = lapack_help::Inverse<Complex>{0} | ) |
Definition at line 1488 of file complex.cc.
References 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_().
ComplexMatrix & ComplexMatrix::operator= | ( | Complex | x | ) |
Assignment operator from scalar.
Assignment operators also seem to be not inherited.
Definition at line 1427 of file complex.cc.
References ComplexMatrixView::begin(), copy(), ComplexMatrixView::end(), and ARTS::Var::x().
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 1420 of file 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 1445 of file complex.cc.
References ComplexMatrixView::begin(), ConstComplexMatrixView::begin(), copy(), ConstComplexMatrixView::end(), ConstComplexVectorView::nelem(), and resize().
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 1455 of file complex.cc.
Referenced by operator=().
|
friend |