ARTS
2.2.66
|
#include <matpackI.h>
Public Member Functions | |
Matrix () | |
Default constructor. More... | |
Matrix (Index r, Index c) | |
Constructor setting size. More... | |
Matrix (Index r, Index c, Numeric fill) | |
Constructor setting size and filling with constant value. More... | |
Matrix (const ConstMatrixView &v) | |
Copy constructor from MatrixView. More... | |
Matrix (const Matrix &v) | |
Copy constructor from Matrix. More... | |
Matrix & | operator= (Matrix x) |
Assignment operator from another matrix. More... | |
Matrix & | operator= (Numeric x) |
Assignment operator from scalar. More... | |
Matrix & | operator= (const ConstVectorView &v) |
Assignment from a vector. More... | |
void | resize (Index r, Index c) |
Resize function. More... | |
virtual | ~Matrix () |
Destructor for Matrix. More... | |
Numeric * | get_raw_data () |
Public Member Functions inherited from MatrixView | |
Numeric | operator() (Index r, Index c) const |
Plain const index operator. More... | |
Numeric | get (Index r, Index c) const |
Get element implementation without assertions. More... | |
ConstMatrixView | operator() (const Range &r, const Range &c) const |
Const index operator for subrange. More... | |
ConstVectorView | operator() (const Range &r, Index c) const |
Const index operator returning a column as an object of type ConstVectorView. More... | |
ConstVectorView | operator() (Index r, const Range &c) const |
Const index operator returning a row as an object of type ConstVectorView. More... | |
Numeric & | operator() (Index r, Index c) |
Plain index operator. More... | |
Numeric & | get (Index r, Index c) |
Get element implementation without assertions. More... | |
MatrixView | operator() (const Range &r, const Range &c) |
Index operator for subrange. More... | |
VectorView | operator() (const Range &r, Index c) |
Index operator returning a column as an object of type VectorView. More... | |
VectorView | operator() (Index r, const Range &c) |
Index operator returning a row as an object of type VectorView. More... | |
ConstIterator2D | begin () const |
Return const iterator to first row. More... | |
ConstIterator2D | end () const |
Return const iterator behind last row. More... | |
Iterator2D | begin () |
Return iterator to first row. More... | |
Iterator2D | end () |
Return iterator behind last row. More... | |
MatrixView & | operator= (const ConstMatrixView &v) |
Assignment operator. More... | |
MatrixView & | operator= (const MatrixView &v) |
Assignment from MatrixView to MatrixView. More... | |
MatrixView & | operator= (const Matrix &v) |
Assignment from a Matrix. More... | |
MatrixView & | operator= (const ConstVectorView &v) |
Assignment from a vector. More... | |
MatrixView & | operator= (Numeric x) |
Assigning a scalar to a MatrixView will set all elements to this value. More... | |
MatrixView & | operator*= (Numeric x) |
Multiplication by scalar. More... | |
MatrixView & | operator/= (Numeric x) |
Division by scalar. More... | |
MatrixView & | operator+= (Numeric x) |
Addition of scalar. More... | |
MatrixView & | operator-= (Numeric x) |
Subtraction of scalar. More... | |
MatrixView & | operator*= (const ConstMatrixView &x) |
Element-vise multiplication by another Matrix. More... | |
MatrixView & | operator/= (const ConstMatrixView &x) |
Element-vise division by another Matrix. More... | |
MatrixView & | operator+= (const ConstMatrixView &x) |
Element-vise addition of another Matrix. More... | |
MatrixView & | operator-= (const ConstMatrixView &x) |
Element-vise subtraction of another Matrix. More... | |
MatrixView & | operator*= (const ConstVectorView &x) |
Element-vise multiplication by a Vector (acting like a 1-column Matrix). More... | |
MatrixView & | operator/= (const ConstVectorView &x) |
Element-vise division by a Vector (acting like a 1-column Matrix). More... | |
MatrixView & | operator+= (const ConstVectorView &x) |
Element-vise addition of a Vector (acting like a 1-column Matrix). More... | |
MatrixView & | operator-= (const ConstVectorView &x) |
Element-vise subtraction of a Vector (acting like a 1-column Matrix). More... | |
const Numeric * | get_c_array () const |
Conversion to plain C-array. More... | |
Numeric * | get_c_array () |
Conversion to plain C-array. More... | |
virtual | ~MatrixView () |
Destructor. More... | |
Public Member Functions inherited from ConstMatrixView | |
Index | nrows () const |
Returns the number of rows. More... | |
Index | ncols () const |
Returns the number of columns. More... | |
Numeric | operator() (Index r, Index c) const |
Plain const index operator. More... | |
Numeric | get (Index r, Index c) const |
Get element implementation without assertions. More... | |
ConstMatrixView | operator() (const Range &r, const Range &c) const |
Const index operator for subrange. More... | |
ConstVectorView | operator() (const Range &r, Index c) const |
Const index operator returning a column as an object of type ConstVectorView. More... | |
ConstVectorView | operator() (Index r, const Range &c) const |
Const index operator returning a row as an object of type ConstVectorView. More... | |
ConstIterator2D | begin () const |
Return const iterator to first row. More... | |
ConstIterator2D | end () const |
Return const iterator behind last row. More... | |
virtual | ~ConstMatrixView () |
Destructor. More... | |
Friends | |
void | swap (Matrix &m1, Matrix &m2) |
Swaps two objects. More... | |
Additional Inherited Members | |
Public Types inherited from MatrixView | |
typedef Iterator2D | iterator |
Public Types inherited from ConstMatrixView | |
typedef ConstIterator2D | const_iterator |
Protected Member Functions inherited from MatrixView | |
MatrixView () | |
Default constructor. More... | |
MatrixView (Numeric *data, const Range &r, const Range &c) | |
Explicit constructor. More... | |
MatrixView (Numeric *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc) | |
Recursive constructor. More... | |
Protected Member Functions inherited from ConstMatrixView | |
ConstMatrixView () | |
Default constructor. More... | |
ConstMatrixView (Numeric *data, const Range &r, const Range &c) | |
Explicit constructor. More... | |
ConstMatrixView (Numeric *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc) | |
Recursive constructor. More... | |
Protected Attributes inherited from ConstMatrixView | |
Range | mrr |
The row range of mdata that is actually used. More... | |
Range | mcr |
The column range of mdata that is actually used. More... | |
Numeric * | mdata |
Pointer to the plain C array that holds the data. More... | |
The Matrix class.
This is a MatrixView that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from MatrixView. Additionally defined here are:
Definition at line 788 of file matpackI.h.
Matrix::Matrix | ( | ) |
Default constructor.
Definition at line 1461 of file matpackI.cc.
Constructor setting size.
This constructor has to set the stride in the row range correctly!
Definition at line 1472 of file matpackI.cc.
Constructor setting size and filling with constant value.
Definition at line 1481 of file matpackI.cc.
References ConstMatrixView::mdata.
Matrix::Matrix | ( | const ConstMatrixView & | m | ) |
Copy constructor from MatrixView.
This automatically sets the size and copies the data.
Definition at line 1495 of file matpackI.cc.
References ConstMatrixView::begin(), MatrixView::begin(), copy(), and ConstMatrixView::end().
Matrix::Matrix | ( | const Matrix & | m | ) |
Copy constructor from Matrix.
This automatically sets the size and copies the data.
Definition at line 1505 of file matpackI.cc.
References MatrixView::begin(), copy(), and MatrixView::end().
|
virtual |
Destructor for Matrix.
This is important, since Matrix uses new to allocate storage.
Definition at line 1612 of file matpackI.cc.
References ConstMatrixView::mdata.
|
inline |
Definition at line 811 of file matpackI.h.
References C, copy(), cross3(), debug_matrixview_get_elem(), M, max(), mean(), min(), mult(), operator*(), operator<<(), proj(), transform(), transpose(), and vector_angle().
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 1542 of file matpackI.cc.
References swap.
Assignment operator from scalar.
Assignment operators also seem to be not inherited.
Definition at line 1550 of file matpackI.cc.
References MatrixView::begin(), copy(), and MatrixView::end().
Matrix & Matrix::operator= | ( | const ConstVectorView & | 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 1569 of file matpackI.cc.
References MatrixView::begin(), copy(), ConstVectorView::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 1580 of file matpackI.cc.
References ConstMatrixView::mcr, ConstMatrixView::mdata, Range::mextent, ConstMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by abs_coefCalcFromXsec(), abs_lookupSetup(), abs_lookupSetupBatch(), abs_lookupSetupWide(), abs_vecInit(), AbsInputFromRteScalars(), GasAbsLookup::Adapt(), ampmat_to_phamat(), AntennaConstantGaussian1D(), AntennaMultiBeamsToPencilBeams(), Append(), cloudboxOff(), complex_n_water_liebe93(), GasAbsLookup::Extract(), get_ppath_atmvars(), get_ppath_blackrad(), get_ppath_ext(), get_ppath_f(), get_refr_index_2d(), get_refr_index_3d(), GriddedFieldPRegridHelper(), GriddedFieldZToPRegridHelper(), integrate_phamat_alpha10(), integrate_phamat_alpha6(), integrate_phamat_theta0_phi10(), integrate_phamat_theta0_phi_alpha6(), interp_atmfield_gp2itw(), interp_atmsurface_gp2itw(), iy_interp_cloudbox_field(), iy_transmitterMultiplePol(), iy_transmitterSinglePol(), iyCloudRadar(), iyInterpCloudboxField2(), iyLoopFrequencies(), iyMC(), iyRadioLink(), Matrix1ColFromVector(), Matrix1RowFromVector(), Matrix2ColFromVectors(), Matrix2RowFromVectors(), Matrix3ColFromVectors(), Matrix3RowFromVectors(), MatrixAddScalar(), MatrixCBR(), MatrixExtractFromTensor3(), MatrixMatrixMultiply(), MatrixPlanck(), MatrixScale(), MatrixSetConstant(), MatrixUnitIntensity(), nca_get_data_Matrix(), nca_read_from_file(), operator=(), opt_prop_sptFromData(), opt_prop_sum_propmat_clearsky(), ArtsParser::parse_matrix(), particle_massesFromMetaDataAndPart_species(), particle_massesFromMetaDataSingleCategory(), pha_matExtractManually(), ppath_init_structure(), Reduce(), rslope_crossing2d(), rslope_crossing3d(), surfaceBlackbody(), surfaceFlatReflectivity(), surfaceFlatRefractiveIndex(), surfaceFlatScalarReflectivity(), surfaceLambertianSimple(), test29(), test30(), xml_read_from_stream(), ybatchMetProfiles(), ybatchMetProfilesClear(), yCalc(), yCalcAppend(), and za_gridOpt().