ARTS 2.5.10 (git: 2f1c442c)
|
#include <matpackI.h>
Public Member Functions | |
Matrix ()=default | |
Matrix (Index r, Index c) | |
Constructor setting size. | |
Matrix (Index r, Index c, Numeric fill) | |
Constructor setting size and filling with constant value. | |
Matrix (const ConstMatrixView &m) | |
Copy constructor from MatrixView. | |
Matrix (const Matrix &m) | |
Copy constructor from Matrix. | |
Matrix (Matrix &&v) noexcept | |
Matrix (const matpack::matrix_like_not_matrix auto &init) | |
Initialization from a vector type. | |
Matrix (Numeric *d, const Range &r0, const Range &r1) ARTS_NOEXCEPT | |
Matrix & | operator= (const Matrix &m) |
Assignment operator from another matrix. | |
Matrix & | operator= (Matrix &&m) ARTS_NOEXCEPT |
Move assignment operator from another matrix. | |
Matrix & | operator= (Numeric x) |
Assignment operator from scalar. | |
Matrix & | operator= (const ConstVectorView &v) |
Assignment from a vector. | |
Matrix & | operator= (const matpack::matrix_like_not_matrix auto &init) |
Set from a matrix type. | |
void | resize (Index r, Index c) |
Resize function. | |
~Matrix () noexcept override | |
Destructor for Matrix. | |
template<std::size_t dim0> | |
Vector | reduce_rank () &&ARTS_NOEXCEPT |
Numeric * | get_raw_data () ARTS_NOEXCEPT |
template<class F > | |
void | transform_elementwise (F &&func) |
![]() | |
constexpr | MatrixView (const MatrixView &)=default |
Numeric & | operator() (Index r, Index c) ARTS_NOEXCEPT |
Plain index operator. | |
Numeric & | get (Index r, Index c) ARTS_NOEXCEPT |
Get element implementation without assertions. | |
MatrixView | operator() (const Range &r, const Range &c) ARTS_NOEXCEPT |
Index operator for subrange. | |
VectorView | operator() (const Range &r, Index c) ARTS_NOEXCEPT |
Index operator returning a column as an object of type VectorView. | |
VectorView | operator() (Index r, const Range &c) ARTS_NOEXCEPT |
Index operator returning a row as an object of type VectorView. | |
Iterator2D | begin () ARTS_NOEXCEPT |
** Return const iterator to first row. Has to be redefined here, since it is | |
Iterator2D | end () ARTS_NOEXCEPT |
Return iterator behind last row. | |
MatrixView & | operator= (const ConstMatrixView &m) |
Assignment operator. | |
MatrixView & | operator= (const MatrixView &m) |
Assignment from MatrixView to MatrixView. | |
MatrixView & | operator= (const Matrix &m) |
Assignment from a Matrix. | |
MatrixView & | operator= (const ConstVectorView &m) |
Assignment from a vector. | |
MatrixView & | operator= (Numeric x) |
Assigning a scalar to a MatrixView will set all elements to this value. | |
MatrixView & | operator*= (Numeric x) ARTS_NOEXCEPT |
Multiplication by scalar. | |
MatrixView & | operator/= (Numeric x) ARTS_NOEXCEPT |
Division by scalar. | |
MatrixView & | operator+= (Numeric x) ARTS_NOEXCEPT |
Addition of scalar. | |
MatrixView & | operator-= (Numeric x) ARTS_NOEXCEPT |
Subtraction of scalar. | |
MatrixView & | operator*= (const ConstMatrixView &x) ARTS_NOEXCEPT |
Element-vise multiplication by another Matrix. | |
MatrixView & | operator/= (const ConstMatrixView &x) ARTS_NOEXCEPT |
Element-vise division by another Matrix. | |
MatrixView & | operator+= (const ConstMatrixView &x) ARTS_NOEXCEPT |
Element-vise addition of another Matrix. | |
MatrixView & | operator-= (const ConstMatrixView &x) ARTS_NOEXCEPT |
Element-vise subtraction of another Matrix. | |
MatrixView & | operator*= (const ConstVectorView &x) ARTS_NOEXCEPT |
Element-vise multiplication by a Vector (acting like a 1-column Matrix). | |
MatrixView & | operator/= (const ConstVectorView &x) ARTS_NOEXCEPT |
Element-vise division by a Vector (acting like a 1-column Matrix). | |
MatrixView & | operator+= (const ConstVectorView &x) ARTS_NOEXCEPT |
Element-vise addition of a Vector (acting like a 1-column Matrix). | |
MatrixView & | operator-= (const ConstVectorView &x) ARTS_NOEXCEPT |
Element-vise subtraction of a Vector (acting like a 1-column Matrix). | |
~MatrixView () override=default | |
Destructor. | |
ConstIterator2D | begin () const ARTS_NOEXCEPT |
Return const iterator to first row. | |
ConstIterator2D | end () const ARTS_NOEXCEPT |
Return const iterator behind last row. | |
Numeric | get (Index r, Index c) const ARTS_NOEXCEPT |
Get element implementation without assertions. | |
![]() | |
constexpr | ConstMatrixView (const ConstMatrixView &)=default |
constexpr | ConstMatrixView (ConstMatrixView &&)=default |
ConstMatrixView & | operator= (const ConstMatrixView &)=default |
ConstMatrixView & | operator= (ConstMatrixView &&)=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 |
Shape< 2 > | shape () const |
Numeric | operator() (Index r, Index c) const ARTS_NOEXCEPT |
Plain const index operator. | |
Numeric | get (Index r, Index c) const ARTS_NOEXCEPT |
Get element implementation without assertions. | |
ConstMatrixView | operator() (const Range &r, const Range &c) const ARTS_NOEXCEPT |
Const index operator for subrange. | |
ConstVectorView | operator() (const Range &r, Index c) const ARTS_NOEXCEPT |
Const index operator returning a column as an object of type ConstVectorView. | |
ConstVectorView | operator() (Index r, const Range &c) const ARTS_NOEXCEPT |
Const index operator returning a row as an object of type ConstVectorView. | |
ConstIterator2D | begin () const ARTS_NOEXCEPT |
Return const iterator to first row. | |
ConstIterator2D | end () const ARTS_NOEXCEPT |
Return const iterator behind last row. | |
ConstVectorView | diagonal () const ARTS_NOEXCEPT |
Matrix diagonal as vector. | |
virtual | ~ConstMatrixView ()=default |
Destructor. | |
Numeric * | get_c_array () const noexcept |
Friends | |
void | swap (Matrix &m1, Matrix &m2) noexcept |
Swaps two objects. | |
Additional Inherited Members | |
![]() | |
using | iterator = Iterator2D |
![]() | |
using | const_iterator = ConstIterator2D |
![]() | |
static constexpr bool | matpack_type {true} |
![]() | |
MatrixView ()=default | |
MatrixView (Numeric *data, const Range &rr, const Range &cr) ARTS_NOEXCEPT | |
Explicit constructor. | |
MatrixView (Numeric *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc) ARTS_NOEXCEPT | |
Recursive constructor. | |
![]() | |
ConstMatrixView ()=default | |
ConstMatrixView (Numeric *data, const Range &r, const Range &c) ARTS_NOEXCEPT | |
Explicit constructor. | |
ConstMatrixView (Numeric *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc) ARTS_NOEXCEPT | |
Recursive constructor. | |
![]() | |
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. | |
Numeric * | mdata {nullptr} |
Pointer to the plain C array that holds the data. | |
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 1285 of file matpackI.h.
|
default |
Constructor setting size.
This constructor has to set the stride in the row range correctly!
Definition at line 899 of file matpackI.cc.
Constructor setting size and filling with constant value.
Definition at line 905 of file matpackI.cc.
References c, and ConstMatrixView::mdata.
Matrix::Matrix | ( | const ConstMatrixView & | m | ) |
Copy constructor from MatrixView.
This automatically sets the size and copies the data.
Definition at line 914 of file matpackI.cc.
References MatrixView::begin(), ConstMatrixView::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 923 of file matpackI.cc.
References ConstMatrixView::mdata, ConstMatrixView::ncols(), and ConstMatrixView::nrows().
|
inlinenoexcept |
Definition at line 1293 of file matpackI.h.
References v.
|
inlineexplicit |
Initialization from a vector type.
Definition at line 1298 of file matpackI.h.
Construct from known data
Note that this will call delete on the pointer if it is still valid at the end of the lifetime of this variable
[in] | d | - A pointer to some raw data |
[in] | r0 | - The Range along the first dimension |
[in] | r1 | - The Range along the second dimension |
Definition at line 1312 of file matpackI.h.
References ARTS_ASSERT.
|
overridenoexcept |
Destructor for Matrix.
This is important, since Matrix uses new to allocate storage.
Definition at line 1039 of file matpackI.cc.
References ConstMatrixView::mdata.
|
inline |
Definition at line 1365 of file matpackI.h.
References ConstVectorView::mdata.
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 1001 of file matpackI.cc.
References MatrixView::begin(), ConstMatrixView::begin(), copy(), ConstMatrixView::end(), resize(), and v.
|
inline |
Set from a matrix type.
Definition at line 1325 of file matpackI.h.
References ConstVectorView::shape().
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 959 of file matpackI.cc.
References ConstMatrixView::mdata, ConstMatrixView::ncols(), ConstMatrixView::nrows(), and resize().
Move assignment operator from another matrix.
Definition at line 968 of file matpackI.cc.
Assignment operator from scalar.
Assignment operators also seem to be not inherited.
Definition at line 983 of file matpackI.cc.
References ConstMatrixView::mdata, ConstMatrixView::ncols(), and ConstMatrixView::nrows().
|
inline |
Reduce a Matrix to a Vector and leave this in an empty state
Definition at line 1349 of file matpackI.h.
References ARTS_ASSERT, ConstVectorView::mdata, and ConstVectorView::size().
Referenced by test48().
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 1011 of file matpackI.cc.
References ARTS_ASSERT, c, ConstMatrixView::mcr, ConstMatrixView::mdata, Range::mextent, ConstMatrixView::mrr, Range::mstart, and Range::mstride.
Referenced by AbsInputFromRteScalars(), GasAbsLookup::Adapt(), ampmat_to_phamat(), AntennaMultiBeamsToPencilBeams(), AntennaOff(), Append(), cloudboxOff(), complex_n_ice_matzler06(), complex_n_water_liebe93(), DiagonalMatrix(), dlosDiffOfLos(), dlosGauss(), GasAbsLookup::Extract(), FastemStandAlone(), get_direct_radiation(), get_ppath_atmvars(), get_ppath_cloudvars(), get_ppath_f(), get_refr_index_2d(), get_refr_index_3d(), get_sun_background(), insert_elements(), integrate_phamat_alpha10(), integrate_phamat_alpha6(), integrate_phamat_theta0_phi10(), integrate_phamat_theta0_phi_alpha6(), interp_atmfield_gp2itw(), interp_atmsurface_gp2itw(), IntersectionGeometricalWithAltitude(), iy_transmittance_mult(), iy_transmitterMultiplePol(), iy_transmitterSinglePol(), iyb_calc(), iyClearsky(), iyEmissionHybrid(), iyEmissionStandard(), iyIndependentBeamApproximation(), iyInterpCloudboxField(), iyLoopFrequencies(), iyMC(), iyRadarSingleScat(), iySurfaceInit(), iySurfaceLambertian(), iyTransmissionStandard(), jacobianFromYbatch(), Matrix1ColFromVector(), Matrix1RowFromVector(), Matrix2ColFromVectors(), Matrix2RowFromVectors(), Matrix3ColFromVectors(), Matrix3RowFromVectors(), MatrixAdd(), MatrixCBR(), MatrixCopySparse(), MatrixDivide(), MatrixExtractFromTensor3(), MatrixIdentity(), MatrixMultiply(), MatrixPlanck(), MatrixReshapeTensor3(), MatrixSetConstant(), MatrixSubtract(), MatrixUnitIntensity(), mueller_modif2stokes(), mueller_rotation(), mueller_stokes2modif(), nca_get_data(), nca_read_from_file(), operator=(), opt_prop_NScatElems(), ArtsParser::parse_matrix(), particle_bulkpropRadarOnionPeeling(), particle_massesFromMetaData(), particle_massesFromMetaDataSingleCategory(), pha_mat_NScatElems(), pndFromPsd(), pndFromPsdBasic(), ppath_init_structure(), psd_MY05(), psd_SB06(), psdMilbrandtYau05(), psdSeifertBeheng06(), TelsemAtlas::read(), Reduce(), regrid_atmsurf_by_gp(), regrid_atmsurf_by_gp_oem(), GriddedField2::resize(), rslope_crossing2d(), rslope_crossing3d(), run_cdisort_flux(), sensor_aux_vectors(), sensor_poslosFromECEF(), sensor_poslosFromGeodetic(), sensor_responseMetMM(), surface_get_incoming_direct(), surface_rtpropFromTypesAverage(), surface_rtpropInterpFreq(), surfaceBlackbody(), surfaceFastem(), surfaceFlatReflectivity(), surfaceFlatRefractiveIndex(), surfaceFlatRvRh(), surfaceFlatScalarReflectivity(), surfaceLambertianSimple(), surfaceMapToLinearPolarisation(), telsemStandalone(), tessem_read_ascii(), test_dense_sparse_multiplication(), test_identity(), test_insert_row(), test_sparse_dense_multiplication(), test_workspace_methods(), xml_read_from_stream(), y_geo_seriesFromY_geo(), y_seriesFromY(), yApplySensorPol(), ybatchMetProfiles(), ybatchMetProfilesClear(), yCalc(), yCalcAppend(), yRadar(), and za_gridOpt().
|
inline |
Definition at line 1368 of file matpackI.h.
References ConstVectorView::mdata, and ConstVectorView::size().
Swaps two objects.
Definition at line 1030 of file matpackI.cc.