ARTS 2.5.4 (git: 31ce4f0e)
ConstMatrixView Class Reference

A constant view of a Matrix. More...

#include <matpackI.h>

Inheritance diagram for ConstMatrixView:
MatrixView Matrix

Public Types

using const_iterator = ConstIterator2D
 

Public Member Functions

constexpr ConstMatrixView (const ConstMatrixView &)=default
 
constexpr ConstMatrixView (ConstMatrixView &&)=default
 
ConstMatrixViewoperator= (const ConstMatrixView &)=default
 
ConstMatrixViewoperator= (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. More...
 
Numeric get (Index r, Index c) const ARTS_NOEXCEPT
 Get element implementation without assertions. More...
 
ConstMatrixView operator() (const Range &r, const Range &c) const ARTS_NOEXCEPT
 Const index operator for subrange. More...
 
ConstVectorView operator() (const Range &r, Index c) const ARTS_NOEXCEPT
 Const index operator returning a column as an object of type ConstVectorView. More...
 
ConstVectorView operator() (Index r, const Range &c) const ARTS_NOEXCEPT
 Const index operator returning a row as an object of type ConstVectorView. More...
 
ConstIterator2D begin () const ARTS_NOEXCEPT
 Return const iterator to first row. More...
 
ConstIterator2D end () const ARTS_NOEXCEPT
 Return const iterator behind last row. More...
 
ConstVectorView diagonal () const ARTS_NOEXCEPT
 Matrix diagonal as vector. More...
 
virtual ~ConstMatrixView ()=default
 Destructor. More...
 
Numericget_c_array () const noexcept
 

Protected Member Functions

 ConstMatrixView ()=default
 
 ConstMatrixView (Numeric *data, const Range &r, const Range &c) ARTS_NOEXCEPT
 Explicit constructor. More...
 
 ConstMatrixView (Numeric *data, const Range &pr, const Range &pc, const Range &nr, const Range &nc) ARTS_NOEXCEPT
 Recursive constructor. More...
 

Protected Attributes

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...
 
Numericmdata {nullptr}
 Pointer to the plain C array that holds the data. More...
 

Friends

class MatrixView
 
class ConstIterator3D
 
class ConstVectorView
 
class ConstTensor3View
 
class ConstTensor4View
 
class ConstTensor5View
 
class ConstTensor6View
 
class ConstTensor7View
 
class ConstComplexMatrixView
 
ConstMatrixView transpose (ConstMatrixView m) ARTS_NOEXCEPT
 Const version of transpose. More...
 
int poly_root_solve (Matrix &roots, Vector &coeffs)
 
void mult (VectorView, const ConstMatrixView &, const ConstVectorView &)
 Matrix-Vector Multiplication. More...
 
void mult (MatrixView, const ConstMatrixView &, const ConstMatrixView &)
 Matrix-Matrix Multiplication. More...
 
void mult (MatrixView, const Sparse &, const ConstMatrixView &)
 SparseMatrix - Matrix multiplication. More...
 
void mult (MatrixView, const ConstMatrixView &, const Sparse &)
 Matrix - SparseMatrix multiplication. More...
 
void mult_general (VectorView, const ConstMatrixView &, const ConstVectorView &) ARTS_NOEXCEPT
 Matrix Vector multiplication. More...
 
void mult_general (MatrixView, const ConstMatrixView &, const ConstMatrixView &) ARTS_NOEXCEPT
 General matrix multiplication. More...
 
void ludcmp (Matrix &, ArrayOfIndex &, ConstMatrixView)
 LU decomposition. More...
 
void lubacksub (VectorView, ConstMatrixView, ConstVectorView, const ArrayOfIndex &)
 LU backsubstitution. More...
 
void inv (MatrixView, ConstMatrixView)
 Matrix Inverse. More...
 
void diagonalize (MatrixView, VectorView, VectorView, ConstMatrixView)
 Matrix Diagonalization. More...
 
std::ostream & operator<< (std::ostream &os, const ConstMatrixView &v)
 Output operator. More...
 

Detailed Description

A constant view of a Matrix.

This, together with the derived class MatrixView, contains the main implementation of a Matrix. It defines the concepts of MatrixView. Plus additionally the recursive subrange operator, which makes it possible to create a MatrixView from a subrange of a MatrixView.

The class Matrix is just a special case of a MatrixView which also allocates storage.

Definition at line 1043 of file matpackI.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 1051 of file matpackI.h.

Constructor & Destructor Documentation

◆ ConstMatrixView() [1/5]

constexpr ConstMatrixView::ConstMatrixView ( const ConstMatrixView )
constexprdefault

◆ ConstMatrixView() [2/5]

constexpr ConstMatrixView::ConstMatrixView ( ConstMatrixView &&  )
constexprdefault

◆ ~ConstMatrixView()

virtual ConstMatrixView::~ConstMatrixView ( )
virtualdefault

Destructor.

◆ ConstMatrixView() [3/5]

ConstMatrixView::ConstMatrixView ( )
protecteddefault

◆ ConstMatrixView() [4/5]

ConstMatrixView::ConstMatrixView ( Numeric data,
const Range rr,
const Range cr 
)
protected

Explicit constructor.

This one is used by Matrix to initialize its own MatrixView part. The row range rr must have a stride to account for the length of one row.

Definition at line 477 of file matpackI.cc.

◆ ConstMatrixView() [5/5]

ConstMatrixView::ConstMatrixView ( Numeric data,
const Range pr,
const Range pc,
const Range nr,
const Range nc 
)
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.

Parameters
*dataThe actual data.
prPrevious range.
pcPrevious range.
nrNew Range.
ncNew Range.

Definition at line 499 of file matpackI.cc.

Member Function Documentation

◆ begin()

◆ dcols()

Index ConstMatrixView::dcols ( ) const
inlinenoexcept

Definition at line 1058 of file matpackI.h.

◆ diagonal()

ConstVectorView ConstMatrixView::diagonal ( ) const

Matrix diagonal as vector.

Returns a ConstMatrixView 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)
Returns
The diagonal vector v.

Definition at line 468 of file matpackI.cc.

References ConstVectorView, mcr, mdata, Range::mextent, min(), mrr, Range::mstart, and Range::mstride.

Referenced by test_diagonal().

◆ drows()

Index ConstMatrixView::drows ( ) const
inlinenoexcept

Definition at line 1057 of file matpackI.h.

◆ empty()

◆ end()

ConstIterator2D ConstMatrixView::end ( ) const

Return const iterator behind last row.

Definition at line 453 of file matpackI.cc.

References ConstVectorView, mcr, mdata, Range::mextent, mrr, Range::mstart, and Range::mstride.

Referenced by copy(), Matrix::Matrix(), MatrixView::operator=(), Matrix::operator=(), and transform().

◆ get()

Numeric ConstMatrixView::get ( Index  r,
Index  c 
) const
inline

Get element implementation without assertions.

Definition at line 1080 of file matpackI.h.

References c, and ConstVectorView::mdata.

Referenced by interp().

◆ get_c_array()

Numeric * ConstMatrixView::get_c_array ( ) const
inlinenoexcept

◆ ncols()

Index ConstMatrixView::ncols ( ) const
inlinenoexcept

Definition at line 1056 of file matpackI.h.

Referenced by abs_xsec_per_speciesAddCIA(), add_normed_phase_functions(), AddZaAa(), antenna2d_gridded_dlos(), antenna2d_interp_response(), AntennaMultiBeamsToPencilBeams(), Append(), apply_iy_unit(), apply_iy_unit2(), atm_fields_compactFromMatrix(), atmgeom_checkedCalc(), BF86_CIA_N2(), calcSingleScatteringDataProperties(), GriddedField2::checksize(), chk_atm_surface(), chk_matrix_ncols(), chk_met_mm_backend(), chk_size(), CKD24_H20(), CKD_222_foreign_h2o(), CKD_222_self_h2o(), CKD_241_co2(), CKD_242_foreign_h2o(), CKD_242_self_h2o(), CKD_mt_100_foreign_h2o(), CKD_mt_100_self_h2o(), CKD_mt_250_CIAfun_n2(), CKD_mt_250_CIArot_n2(), CKD_mt_250_co2(), CKD_mt_250_foreign_h2o(), CKD_mt_250_o2_vis(), CKD_mt_250_self_h2o(), CKD_mt_320_foreign_h2o(), CKD_mt_320_self_h2o(), CKD_mt_CIAfun_n2(), CKD_mt_CIAfun_o2(), CKD_mt_CIArot_n2(), CKD_mt_co2(), CKD_mt_v0v0_o2(), CKD_mt_v1v0_o2(), cloud_RT_surface(), complex_n_interp(), CP98H2OAbsModel(), describe(), det(), DiffZaAa(), ELL07WaterDropletAbs(), ext2trans(), ext_abs_pfun_from_tro(), ext_matFromabs_vec(), PropagationMatrix::FittingShape(), flat(), from_dpath_to_dx(), geo_posEndOfPpath(), geo_posLowestAltitudeOfPpath(), geo_posWherePpathPassesZref(), get_dtauc_ssalb(), get_gas_scattering_properties(), get_gasoptprop(), get_iy_of_background(), get_maximum_error(), get_paroptprop(), get_parZ(), get_scat_bulk_layer(), get_scattered_starsource(), get_star_background(), GriddedFieldLatLonExpand(), Ho66_CO2_foreign_continuum(), Ho66_CO2_self_continuum(), id_mat(), Interpolation::interp(), interp(), interp_atmfield_by_itw(), interp_atmsurface_by_itw(), InterpGriddedField2ToPosition(), IntersectionGeometricalWithAltitude(), is_diagonal(), is_singular(), is_size(), itw2p(), iy_transmittance_mult(), iyb_calc_body(), iyIndependentBeamApproximation(), iyInterpCloudboxField(), iyRadarSingleScat(), iySurfaceRtpropAgenda(), iySurfaceRtpropCalc(), iyTransmissionStandard(), jac_ranges_indices(), MaTipping_H2O_foreign_continuum(), Matrix::Matrix(), matrix_exp(), MatrixAdd(), MatrixDivide(), MatrixMatrixMultiply(), MatrixMultiply(), MatrixSubtract(), MCGeneral(), MCRadar(), mgd_with_derivatives(), MPM02H2OAbsModel(), MPM85O2AbsModel(), MPM87H2OAbsModel(), MPM87O2AbsModel(), MPM89H2OAbsModel(), MPM89O2AbsModel(), MPM92O2AbsModel(), MPM93_H2O_continuum(), MPM93_N2_continuum(), MPM93_O2_continuum(), MPM93H2OAbsModel(), MPM93IceCrystalAbs(), MPM93O2AbsModel(), MPM93RainExt(), MPM93WaterDropletAbs(), mult(), nca_def_Matrix(), nca_put_var_Matrix(), nca_write_to_file(), norm_inf(), ComplexMatrixView::operator*=(), ComplexMatrixView::operator+=(), ComplexMatrixView::operator-=(), ComplexMatrixView::operator/=(), Matrix::operator=(), opt_prop_1ScatElem(), opt_prop_ScatSpecBulk(), Pardo_ATM_H2O_ForeignContinuum(), Pardo_ATM_N2_dry_continuum(), particle_bulkpropRadarOnionPeeling(), pha_mat_labCalc(), pha_mat_ScatSpecBulk(), pha_matTransform(), pndFromPsd(), pndFromPsdBasic(), psd_mgd_smm_common(), psd_mono_common(), psdFieldEtAl07(), psdMcFarquaharHeymsfield97(), psdMilbrandtYau05(), psdSeifertBeheng06(), PWR93O2AbsModel(), PWR98H2OAbsModel(), random_fill_matrix(), random_fill_matrix_pos_def(), random_submatrix(), Reduce(), regrid_atmsurf_by_gp_oem(), reshape(), Rosenkranz_CO2_foreign_continuum(), Rosenkranz_CO2_self_continuum(), Rosenkranz_N2_self_continuum(), Rosenkranz_O2_continuum(), Select(), select_dims_by_size(), sensor_aux_vectors(), sensor_checkedCalc(), sensor_losGeometricFromSensorPosToOtherPositions(), sensor_losReverse(), sensor_poslosFromECEF(), sensor_poslosFromGeodetic(), sensor_responseAntenna(), sensor_responseGenericAMSU(), sensor_responseInit(), sensor_responseMetMM(), sensor_responseSimpleAMSU(), set_vmr_from_first_species(), solve(), spectral_radiance_fieldClearskyPlaneParallel(), spectral_radiance_fieldExpandCloudboxField(), Standard_H2O_foreign_continuum(), Standard_H2O_self_continuum(), Standard_N2_self_continuum(), Standard_O2_continuum(), StokesVector::StokesVector(), surface_specular_R_and_b(), surface_typeInterpTypeMask(), surfaceFlatRvRh(), surfaceMapToLinearPolarisation(), surfaceSemiSpecularBy3beams(), surfaceSplitSpecularTo3beams(), TangentPointExtract(), TangentPointPrint(), test1(), test47(), test_diagonal(), transform(), TRE05O2AbsModel(), VectorExtractFromMatrix(), write_matrix(), xml_write_to_stream(), xsec_continuum_tag(), yApplySensorPol(), yApplyUnit(), ybatchCalc(), yCalc(), yCalc_mblock_loop_body(), yCalcAppend(), and yRadar().

◆ nrows()

Index ConstMatrixView::nrows ( ) const
inlinenoexcept

Definition at line 1055 of file matpackI.h.

Referenced by abs_xsec_per_speciesAddCIA(), add_normed_phase_functions(), AddZaAa(), antenna2d_gridded_dlos(), antenna2d_interp_response(), AntennaMultiBeamsToPencilBeams(), Append(), apply_iy_unit(), apply_iy_unit2(), atm_fields_compactFromMatrix(), atmgeom_checkedCalc(), BF86_CIA_N2(), calcBaselineFit(), calcSingleScatteringDataProperties(), GriddedField2::checksize(), chk_atm_surface(), chk_matrix_nrows(), chk_met_mm_backend(), chk_size(), CKD24_H20(), CKD_222_foreign_h2o(), CKD_222_self_h2o(), CKD_241_co2(), CKD_242_foreign_h2o(), CKD_242_self_h2o(), CKD_mt_100_foreign_h2o(), CKD_mt_100_self_h2o(), CKD_mt_250_CIAfun_n2(), CKD_mt_250_CIArot_n2(), CKD_mt_250_co2(), CKD_mt_250_foreign_h2o(), CKD_mt_250_o2_vis(), CKD_mt_250_self_h2o(), CKD_mt_320_foreign_h2o(), CKD_mt_320_self_h2o(), CKD_mt_CIAfun_n2(), CKD_mt_CIAfun_o2(), CKD_mt_CIArot_n2(), CKD_mt_co2(), CKD_mt_v0v0_o2(), CKD_mt_v1v0_o2(), cloud_RT_no_background(), cloud_RT_surface(), cloudbox_checkedCalc(), cloudbox_fieldSetConstPerFreq(), complex_n_interp(), CP98H2OAbsModel(), describe(), det(), DiffZaAa(), ELL07WaterDropletAbs(), ext2trans(), ext_abs_pfun_from_tro(), ext_matFromabs_vec(), f_gridMetMM(), PropagationMatrix::FittingShape(), flat(), from_dpath_to_dx(), get_dtauc_ssalb(), get_gasoptprop(), get_iy_of_background(), get_maximum_error(), get_paroptprop(), get_scat_bulk_layer(), GriddedFieldLatLonExpand(), Ho66_CO2_foreign_continuum(), Ho66_CO2_self_continuum(), id_mat(), Interpolation::interp(), interp(), InterpGriddedField2ToPosition(), IntersectionGeometricalWithAltitude(), is_diagonal(), is_singular(), is_size(), itw2p(), iy_transmittance_mult(), iyb_calc(), iyCalc(), iyIndependentBeamApproximation(), iyInterpCloudboxField(), iyRadarSingleScat(), iySurfaceRtpropAgenda(), iySurfaceRtpropCalc(), iyTransmissionStandard(), jacobianAddPointingZa(), jacobianAddPolyfit(), jacobianAddSinefit(), jacobianCalcFreqShift(), jacobianCalcFreqStretch(), jacobianCalcPointingZaInterp(), jacobianCalcPointingZaRecalc(), jacobianCalcPolyfit(), jacobianCalcSinefit(), jacobianSetAffineTransformation(), MaTipping_H2O_foreign_continuum(), Matrix::Matrix(), MatrixAdd(), MatrixDivide(), MatrixMatrixMultiply(), MatrixMultiply(), MatrixSubtract(), MCGeneral(), mgd_with_derivatives(), MPM02H2OAbsModel(), MPM85O2AbsModel(), MPM87H2OAbsModel(), MPM87O2AbsModel(), MPM89H2OAbsModel(), MPM89O2AbsModel(), MPM92O2AbsModel(), MPM93_H2O_continuum(), MPM93_N2_continuum(), MPM93_O2_continuum(), MPM93H2OAbsModel(), MPM93IceCrystalAbs(), MPM93O2AbsModel(), MPM93RainExt(), MPM93WaterDropletAbs(), mult(), nca_def_Matrix(), nca_put_var_Matrix(), nca_write_to_file(), norm_inf(), ComplexMatrixView::operator*=(), ComplexMatrixView::operator+=(), ComplexMatrixView::operator-=(), ComplexMatrixView::operator/=(), Matrix::operator=(), opt_prop_1ScatElem(), opt_prop_NScatElems(), opt_prop_ScatSpecBulk(), Pardo_ATM_H2O_ForeignContinuum(), Pardo_ATM_N2_dry_continuum(), particle_bulkpropRadarOnionPeeling(), pha_mat_1ScatElem(), pha_mat_NScatElems(), pha_mat_ScatSpecBulk(), pndFromPsd(), pndFromPsdBasic(), ppath_end_2d(), ppath_fieldCalc(), ppath_start_2d(), PartitionFunctions::Data::print_data(), psdMilbrandtYau05(), psdSeifertBeheng06(), PWR93O2AbsModel(), PWR98H2OAbsModel(), random_fill_matrix(), random_fill_matrix_pos_def(), random_submatrix(), Reduce(), reduced_1datm(), regrid_atmsurf_by_gp_oem(), reshape(), retrievalErrorsExtract(), Rosenkranz_CO2_foreign_continuum(), Rosenkranz_CO2_self_continuum(), Rosenkranz_N2_self_continuum(), Rosenkranz_O2_continuum(), rte_pos_losMoveToStartOfPpath(), rte_poslosFromECEF(), rte_poslosFromGeodetic(), Select(), select_dims_by_size(), sensor_aux_vectors(), sensor_checkedCalc(), sensor_losGeometricFromSensorPosToOtherPositions(), sensor_losReverse(), sensor_poslosFromECEF(), sensor_poslosFromGeodetic(), sensor_responseAntenna(), sensor_responseBackend(), sensor_responseFillFgrid(), sensor_responseFrequencySwitching(), sensor_responseGenericAMSU(), sensor_responseMetMM(), sensor_responseMixer(), sensor_responseMixerBackendPrecalcWeights(), sensor_responseMultiMixerBackend(), sensor_responsePolarisation(), sensor_responseSimpleAMSU(), sensor_responseStokesRotation(), sensor_responseWMRF(), solve(), Standard_H2O_foreign_continuum(), Standard_H2O_self_continuum(), Standard_N2_self_continuum(), Standard_O2_continuum(), StokesVector::StokesVector(), surf_albedoCalc(), surf_albedoCalcSingleAngle(), surface_calc(), surface_specular_R_and_b(), surface_typeInterpTypeMask(), surfaceFlatRvRh(), surfaceMapToLinearPolarisation(), surfaceSemiSpecularBy3beams(), surfaceSplitSpecularTo3beams(), test1(), test47(), test_diagonal(), transform(), transform_jacobian(), TRE05O2AbsModel(), VectorExtractFromMatrix(), VectorZtanToZa1D(), VectorZtanToZaRefr1D(), write_matrix(), x2artsSensor(), xml_write_to_stream(), xsec_continuum_tag(), y_geoToGeodetic(), yApplySensorPol(), yApplyUnit(), ybatchCalc(), ybatchMetProfiles(), ybatchMetProfilesClear(), yCalc(), yCalcAppend(), and yRadar().

◆ operator()() [1/4]

ConstMatrixView ConstMatrixView::operator() ( const Range r,
const Range c 
) const

Const index operator for subrange.

We have to also account for the case, that *this is already a subrange of a Matrix. This allows correct recursive behavior.

Definition at line 414 of file matpackI.cc.

References c.

◆ operator()() [2/4]

ConstVectorView ConstMatrixView::operator() ( const Range r,
Index  c 
) const

Const index operator returning a column as an object of type ConstVectorView.

Parameters
rA range of rows.
cIndex of selected column

Definition at line 424 of file matpackI.cc.

References ARTS_ASSERT, and c.

◆ operator()() [3/4]

ConstVectorView ConstMatrixView::operator() ( Index  r,
const Range c 
) const

Const index operator returning a row as an object of type ConstVectorView.

Parameters
rIndex of selected row.
cRange of columns

Definition at line 438 of file matpackI.cc.

References ARTS_ASSERT, and c.

◆ operator()() [4/4]

Numeric ConstMatrixView::operator() ( Index  r,
Index  c 
) const
inline

Plain const index operator.

Definition at line 1069 of file matpackI.h.

References ARTS_ASSERT, c, and VectorView::get().

◆ operator=() [1/2]

ConstMatrixView & ConstMatrixView::operator= ( const ConstMatrixView )
default

◆ operator=() [2/2]

ConstMatrixView & ConstMatrixView::operator= ( ConstMatrixView &&  )
default

◆ selem()

Index ConstMatrixView::selem ( ) const
inlinenoexcept

Definition at line 1054 of file matpackI.h.

◆ shape()

Shape< 2 > ConstMatrixView::shape ( ) const
inline

Returns the shape as an array (to allow templates to just look for shape on different matpack objects)

Definition at line 1065 of file matpackI.h.

◆ size()

Index ConstMatrixView::size ( ) const
inlinenoexcept

Friends And Related Function Documentation

◆ ConstComplexMatrixView

friend class ConstComplexMatrixView
friend

Definition at line 1109 of file matpackI.h.

◆ ConstIterator3D

friend class ConstIterator3D
friend

Definition at line 1102 of file matpackI.h.

◆ ConstTensor3View

friend class ConstTensor3View
friend

Definition at line 1104 of file matpackI.h.

◆ ConstTensor4View

friend class ConstTensor4View
friend

Definition at line 1105 of file matpackI.h.

◆ ConstTensor5View

friend class ConstTensor5View
friend

Definition at line 1106 of file matpackI.h.

◆ ConstTensor6View

friend class ConstTensor6View
friend

Definition at line 1107 of file matpackI.h.

◆ ConstTensor7View

friend class ConstTensor7View
friend

Definition at line 1108 of file matpackI.h.

◆ ConstVectorView

friend class ConstVectorView
friend

Definition at line 1103 of file matpackI.h.

Referenced by begin(), diagonal(), and end().

◆ diagonalize

void diagonalize ( MatrixView  ,
VectorView  ,
VectorView  ,
ConstMatrixView   
)
friend

Matrix Diagonalization.

Return P and W from A in the statement diag(P^-1*A*P)-W == 0. The real function will require some manipulation if the eigenvalues are imaginary.

The real version returns WR and WI as returned by dgeev. The complex version just returns W.

The function makes many copies and is thereby not fast. There are no tests on the condition of the returned matrix, so nan and inf can occur.

Parameters
[out]PThe right eigenvectors.
[out]WRThe real eigenvalues.
[out]WIThe imaginary eigenvalues.
[in]AThe matrix to diagonalize.

Definition at line 250 of file lin_alg.cc.

◆ inv

void inv ( MatrixView  ,
ConstMatrixView   
)
friend

Matrix Inverse.

Compute the inverse of a matrix such that I = Ainv*A = A*Ainv. Both MatrixViews must be square and have the same size n. During the inversion one additional n times n Matrix is allocated and work space memory for faster inversion is allocated and freed.

Parameters
[out]AinvThe MatrixView to contain the inverse of A.
[in]AThe matrix to be inverted.

Definition at line 168 of file lin_alg.cc.

◆ lubacksub

void lubacksub ( VectorView  ,
ConstMatrixView  ,
ConstVectorView  ,
const ArrayOfIndex  
)
friend

LU backsubstitution.

Solves a set of linear equations Ax=b. It is neccessairy to do a L decomposition using the function ludcp before using this function. The backsubstitution is in-place, i.e. x and b may be the same vector.

Parameters
xOutput: Solution vector of the equation system.
LUInput: LU decomposition of the matrix (output of function ludcp).
bInput: Right-hand-side vector of equation system.
indxInput: Pivoting information (output of function ludcp).

Definition at line 92 of file lin_alg.cc.

◆ ludcmp

void ludcmp ( Matrix ,
ArrayOfIndex ,
ConstMatrixView   
)
friend

LU decomposition.

This function performes a LU Decomposition of the matrix A. (Compare Numerical Recipies in C, pages 36-48.)

Parameters
LUOutput: returns L and U in one matrix
indxOutput: Vector that records the row permutation.
AInput: Matrix for which the LU decomposition is performed

Definition at line 57 of file lin_alg.cc.

◆ MatrixView

friend class MatrixView
friend

Definition at line 1101 of file matpackI.h.

◆ mult [1/4]

void mult ( MatrixView  ,
const ConstMatrixView ,
const ConstMatrixView  
)
friend

Matrix-Matrix Multiplication.

Performs the matrix multiplication A = B * C. The dimensions must match, i.e. A must be a m times n matrix, B a m times k matrix and C a k times c matrix. No memory reallocation takes place, only the data is copied. Using this function on overlapping MatrixViews belonging to the same Matrix will lead to unpredictable results. In particular, this means that A and B must not be the same matrix!

If the memory layout allows it, the multiplication is performed using BLAS' _dgemm, which leads to a significant speed up of the operation. To be compatible with BLAS the matrix views A, B and C must satisfy:

  • A must have column or row stride 1
  • B must have column or row stride 1
  • C must have column stride 1

That means that A and B can be ConstMatrixView objects corresponding to transposed/non-transposed submatrices of a matrix, that are continuous along their first/second dimension. C must correspond to a non-transposed submatrix of a matrix, that is continuous along its second dimension.

Parameters
[in,out]AThe matrix A, that will hold the result of the multiplication.
[in]BThe matrix B
[in]CThe matrix C

Definition at line 1197 of file matpackI.cc.

◆ mult [2/4]

void mult ( MatrixView  ,
const ConstMatrixView ,
const Sparse  
)
friend

Matrix - SparseMatrix multiplication.

Calculates the matrix product:

A = B*C, where C is sparse.

Output comes first!

Dimensions of A, B, and C must match. No memory reallocation takes place, only the data is copied.

Parameters
AOutput: Result matrix (full).
BFirst matrix to multiply (sparse).
CSecond matrix to multiply (full).
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Tue Jul 15 15:05:40 2003

Definition at line 539 of file matpackII.cc.

◆ mult [3/4]

void mult ( MatrixView  ,
const Sparse ,
const ConstMatrixView  
)
friend

SparseMatrix - Matrix multiplication.

Calculates the matrix product:

A = B*C, where B is sparse.

Output comes first!

Dimensions of A, B, and C must match. No memory reallocation takes place, only the data is copied.

Parameters
AOutput: Result matrix (full).
BFirst matrix to multiply (sparse).
CSecond matrix to multiply (full).
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Tue Jul 15 15:05:40 2003

Definition at line 490 of file matpackII.cc.

◆ mult [4/4]

void mult ( VectorView  ,
const ConstMatrixView ,
const ConstVectorView  
)
friend

Matrix-Vector Multiplication.

Computes the Matrix-Vector product y = M * x, for a m times n matrix M, a length-m vector y and a length-n vector x.

The product is computed using the dgemv_ routine from the BLAS library if the matrix is contiguous in memory. If this is not the case, the mult_general method is used to compute the product.

No memory is allocated for the computation and the matrix and vector views may not overlap.

Parameters
[out]yThe length-m VectorView where the result is stored.
[in]MReference to the m-times-n ConstMatrixView holding the matrix M.
[in]xReference to the length-n ConstVectorView holding the vector x.

Definition at line 1078 of file matpackI.cc.

◆ mult_general [1/2]

void mult_general ( MatrixView  ,
const ConstMatrixView ,
const ConstMatrixView  
)
friend

General matrix multiplication.

This is the fallback matrix multiplication which works for all ConstMatrixView objects.

Parameters
[in,out]AThe matrix A, that will hold the result of the multiplication.
[in]BThe matrix B
[in]CThe matrix C

Definition at line 1301 of file matpackI.cc.

◆ mult_general [2/2]

void mult_general ( VectorView  y,
const ConstMatrixView M,
const ConstVectorView x 
)
friend

Matrix Vector multiplication.

y = M*x. Note that the order is different from MTL, output comes first! Dimensions of y, M, and x must match. No memory reallocation takes place, only the data is copied. Using this function on overlapping Matrix and VectorViews belonging to the same Matrix will lead to unpredictable results.

The implementation here is different from the other multiplication routines. It does not use iterators but a more drastic approach to gain maximum performance.

Definition at line 1136 of file matpackI.cc.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ConstMatrixView v 
)
friend

Output operator.

This demonstrates how iterators can be used to traverse the matrix. The iterators know which part of the matrix is ‘active’, and also the strides in both directions. This function is a bit more complicated than necessary to illustrate the concept, because the formating should look nice. This means that the first row, and the first element in each row, have to be treated individually.

Definition at line 516 of file matpackI.cc.

◆ poly_root_solve

int poly_root_solve ( Matrix roots,
Vector coeffs 
)
friend

Definition at line 90 of file poly_roots.cc.

◆ transpose

ConstMatrixView transpose ( ConstMatrixView  m)
friend

Const version of transpose.

Definition at line 1401 of file matpackI.cc.

Member Data Documentation

◆ mcr

Range ConstMatrixView::mcr {0, 0, 1}
protected

The column range of mdata that is actually used.

Definition at line 1150 of file matpackI.h.

Referenced by MatrixView::begin(), begin(), diagonal(), MatrixView::end(), end(), ConstIterator3D::operator!=(), Iterator3D::operator!=(), MatrixView::operator=(), and Matrix::resize().

◆ mdata

Numeric* ConstMatrixView::mdata {nullptr}
protected

◆ mrr

Range ConstMatrixView::mrr {0, 0, 1}
protected

The row range of mdata that is actually used.

Definition at line 1148 of file matpackI.h.

Referenced by MatrixView::begin(), begin(), diagonal(), MatrixView::end(), end(), ConstIterator3D::operator!=(), Iterator3D::operator!=(), MatrixView::operator=(), and Matrix::resize().


The documentation for this class was generated from the following files: