ARTS  2.0.49
ConstVectorView Class Reference

A constant view of a Vector. More...

#include <matpackI.h>

Inheritance diagram for ConstVectorView:
VectorView Vector MakeVector

Public Types

typedef ConstIterator1D const_iterator
 

Public Member Functions

Index nelem () const
 Returns the number of elements. More...
 
Numeric sum () const
 The sum of all elements of a Vector. More...
 
Numeric operator[] (Index n) const
 Plain const index operator. More...
 
ConstVectorView operator[] (const Range &r) const
 Const index operator for subrange. More...
 
ConstIterator1D begin () const
 Return const iterator to first element. More...
 
ConstIterator1D end () const
 Return const iterator behind last element. More...
 
 operator ConstMatrixView () const
 Conversion to const 1 column matrix. More...
 
virtual ~ConstVectorView ()
 Destructor. More...
 
 ConstVectorView (const Numeric &a)
 A special constructor, which allows to make a ConstVectorView from a scalar. More...
 

Protected Member Functions

 ConstVectorView ()
 Default constructor. More...
 
 ConstVectorView (Numeric *data, const Range &range)
 Explicit constructor. More...
 
 ConstVectorView (Numeric *data, const Range &p, const Range &n)
 Recursive constructor. More...
 

Protected Attributes

Range mrange
 The range of mdata that is actually used. More...
 
Numericmdata
 Pointer to the plain C array that holds the data. More...
 

Friends

class VectorView
 
class ConstIterator2D
 
class ConstMatrixView
 
class ConstTensor3View
 
class ConstTensor4View
 
class ConstTensor5View
 
class ConstTensor6View
 
class ConstTensor7View
 
int poly_root_solve (Matrix &roots, Vector &coeffs)
 
void mult (VectorView, const ConstMatrixView &, const ConstVectorView &)
 Matrix Vector multiplication. More...
 

Detailed Description

A constant view of a Vector.

Together with the derived class VectorView this contains the main implementation of a Vector. The class Vector is just a special case of a VectorView which also allocates storage.

Definition at line 300 of file matpackI.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 303 of file matpackI.h.

Constructor & Destructor Documentation

◆ ~ConstVectorView()

virtual ConstVectorView::~ConstVectorView ( )
inlinevirtual

Destructor.

Definition at line 330 of file matpackI.h.

◆ ConstVectorView() [1/4]

ConstVectorView::ConstVectorView ( const Numeric a)

A special constructor, which allows to make a ConstVectorView from a scalar.

This one is a bit tricky: We have to cast away the arguments const qualifier, because mdata is not const. This should be safe, since there are no non-const methods for ConstVectorView.

Definition at line 229 of file matpackI.cc.

◆ ConstVectorView() [2/4]

ConstVectorView::ConstVectorView ( )
protected

Default constructor.

This is necessary, so that we can have a default constructor for the derived class Vector.

Definition at line 237 of file matpackI.cc.

Referenced by operator[]().

◆ ConstVectorView() [3/4]

ConstVectorView::ConstVectorView ( Numeric data,
const Range range 
)
protected

Explicit constructor.

This one is used by Vector to initialize its own VectorView part.

Definition at line 245 of file matpackI.cc.

◆ ConstVectorView() [4/4]

ConstVectorView::ConstVectorView ( Numeric data,
const Range p,
const Range n 
)
protected

Recursive constructor.

This is used to construct sub ranges from sub ranges. That means that the new range has to be interpreted relative to the original range. The new range 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.
pPrevious range.
nNew Range.

Definition at line 263 of file matpackI.cc.

Member Function Documentation

◆ begin()

◆ end()

ConstIterator1D ConstVectorView::end ( ) const

Return const iterator behind last element.

Definition at line 208 of file matpackI.cc.

References mdata, Range::mextent, mrange, Range::mstart, and Range::mstride.

Referenced by copy(), VectorView::end(), max(), mean(), min(), operator*(), operator<<(), VectorView::operator=(), sum(), transform(), and Vector::Vector().

◆ nelem()

Index ConstVectorView::nelem ( ) const

Returns the number of elements.

The names ‘size’ and ‘length’ are already used by STL functions returning size_t. To avoid confusion we choose the name ‘nelem’. This is also more consistent with ‘nrow’ and ‘ncol’ for matrices.

The value range of long, which is used to store the index is on a PC from -2147483648 to 2147483647. This means that a 15GB large array of float can be addressed with this index. So the extra bit that size_t has compared to long is not needed.

Definition at line 175 of file matpackI.cc.

References Range::mextent, and mrange.

Referenced by abs_coefCalcSaveMemory(), abs_fieldCalc(), abs_lines_per_speciesCompact(), abs_lines_per_speciesReadFromCatalogues(), abs_lineshape_per_tgDefine(), abs_lookupSetup(), abs_lookupSetupBatch(), abs_lookupTestAccuracy(), abs_scalar_gasExtractFromLookup(), abs_vecInit(), abs_vecTransform(), abs_xsec_per_speciesAddConts(), abs_xsec_per_speciesInit(), AbsInputFromRteScalars(), GasAbsLookup::Adapt(), AngIntegrate_trapezoid(), AngIntegrate_trapezoid_fixedstep(), AngIntegrate_trapezoid_fixedstep_opt(), AngIntegrate_trapezoid_fixedstep_opt2(), AngIntegrate_trapezoid_opt(), AngIntegrate_trapezoid_opti(), AngIntegrate_trapezoid_original(), antenna1d_matrix(), antenna2d_simplified(), antenna_responseGaussian(), AntennaConstantGaussian1D(), Append(), apply_y_unit(), apply_y_unit2(), atm_fields_compactAddSpecies(), AtmFieldsCalc(), AtmFieldsCalcExpand1D(), AtmFieldsExpand1D(), AtmFieldsRefinePgrid(), backend_channel_responseGaussian(), basics_checkedCalc(), batch_atm_fields_compactFromArrayOfMatrix(), batch_atm_fields_compactFromArrayOfMatrixChevalAll(), BF86_CIA_N2(), calc_lookup_error(), calc_nd_field(), check_retrieval_grids(), GriddedField1::checksize(), chk_atm_field(), chk_atm_grids(), chk_atm_surface(), chk_if_equal(), chk_if_pnd_zero_lat(), chk_if_pnd_zero_lon(), chk_if_pnd_zero_p(), chk_interpolation_grids(), chk_massdensity_field(), chk_pnd_data(), chk_pndsum(), chk_single_scattering_data(), chk_size(), chk_vector_length(), choose_abs_nls_pert(), choose_abs_t_pert(), 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_CIAfun_n2(), CKD_mt_CIAfun_o2(), CKD_mt_CIArot_n2(), CKD_mt_co2(), CKD_mt_v0v0_o2(), CKD_mt_v1v0_o2(), cloud_atm_vars_by_gp(), cloud_ppath_update3D(), cloud_RT_surface(), cloudbox_checkedCalc(), CloudboxGetIncoming(), CloudboxGetIncoming1DAtm(), cloudboxSetAutomatically(), cloudboxSetDisort(), cloudboxSetManually(), cloudboxSetManuallyAltitude(), complex_nWaterLiebe93(), CP98H2OAbsModel(), describe(), diy_from_path_to_rgrids(), do_gridcell_2d(), do_gridrange_1d(), doit_conv_flagAbs(), doit_conv_flagAbsBT(), doit_conv_flagLsq(), doit_i_fieldSetClearsky(), doit_i_fieldUpdate1D(), doit_i_fieldUpdateSeq1D(), doit_i_fieldUpdateSeq1DPP(), doit_i_fieldUpdateSeq3D(), doit_scat_fieldCalc(), doit_scat_fieldCalcLimb(), doit_za_grid_optCalc(), DoitCloudboxFieldPut(), DoitInit(), DoitScatteringDataPrepare(), dtauc_ssalbCalc(), emissionPlanck(), ext_matInit(), GasAbsLookup::Extract(), Extract(), f_gridFromGasAbsLookup(), f_gridFromSensorAMSU(), f_gridFromSensorHIRS(), f_gridSelectFIndex(), find_effective_channel_boundaries(), find_new_grid_in_old_grid(), fos_yStandard(), FrequencyFromWavelength(), gaussian_response(), get_iy_of_background(), get_perturbation_gridpos(), get_perturbation_limit(), get_ppath_cloudrtvars(), get_ppath_rtvars(), get_refr_index_2d(), get_refr_index_3d(), gridpos(), gridpos_poly(), init_x(), init_xy(), Sparse::insert_row(), interp(), interp_atmfield_by_itw(), interp_atmsurface_by_itw(), interp_cloud_coeff1D(), interp_poly(), interp_scat_angle_temperature(), interpolate_raytracing_points(), InterpSurfaceEmissivityFieldIncLatLon(), interpTArray(), interpweights(), is_decreasing(), is_increasing(), is_size(), is_sorted(), itw2p(), iwp_cloud_opt_pathCalc(), iy_interp_cloudbox_field(), iy_transmission_for_scalar_tau(), iy_transmission_mult_scalar_tau(), iyb_calc(), iyBeerLambertStandardClearsky(), iyBeerLambertStandardCloudbox(), iyEmissionStandardClearsky(), iyEmissionStandardClearskyBasic(), iyFOS(), iyInterpCloudboxField(), iyInterpPolyCloudboxField(), iyMC(), jacobianAddFreqShiftAndStretch(), jacobianAddPointingZa(), jacobianAddPolyfit(), jacobianCalcFreqShiftAndStretchInterp(), jacobianCalcPointingZaInterp(), jacobianCalcPolyfit(), LagrangeInterpol4(), last(), lineshape_CO2_lorentz(), lineshape_doppler(), lineshape_lorentz(), lineshape_norm_linear(), lineshape_norm_no_norm(), lineshape_norm_quadratic(), lineshape_norm_VVH(), lineshape_rosenkranz_voigt_drayson(), lineshape_rosenkranz_voigt_kuntz6(), lineshape_voigt_drayson(), lineshape_voigt_kuntz3(), lineshape_voigt_kuntz4(), lineshape_voigt_kuntz6(), MaTipping_H2O_foreign_continuum(), Matrix1ColFromVector(), Matrix1RowFromVector(), Matrix2ColFromVectors(), Matrix2RowFromVectors(), Matrix3ColFromVectors(), Matrix3RowFromVectors(), MatrixCBR(), MatrixPlanck(), MatrixUnitIntensity(), MCGeneral(), MCIPA(), mcPathTraceGeneral(), mcPathTraceIPA(), mean(), mixer_matrix(), MPM02H2OAbsModel(), MPM85O2AbsModel(), MPM87H2OAbsModel(), MPM87O2AbsModel(), MPM89H2OAbsModel(), MPM89O2AbsModel(), MPM92O2AbsModel(), MPM93_H2O_continuum(), MPM93_N2_continuum(), MPM93_O2_continuum(), MPM93H2OAbsModel(), MPM93IceCrystalAbs(), MPM93O2AbsModel(), MPM93RainExt(), MPM93WaterDropletAbs(), mult(), operator*(), VectorView::operator*=(), MatrixView::operator*=(), VectorView::operator+=(), MatrixView::operator+=(), VectorView::operator-=(), MatrixView::operator-=(), VectorView::operator/=(), MatrixView::operator/=(), operator<<(), MatrixView::operator=(), Matrix::operator=(), Vector::operator=(), opt_prop_sptFromMonoData(), opt_propCalc(), opt_propExtract(), p2gridpos(), p2gridpos_poly(), p_gridFromAtmRaw(), p_gridFromGasAbsLookup(), Pardo_ATM_H2O_ForeignContinuum(), Pardo_ATM_N2_dry_continuum(), ParticleTypeAdd(), ParticleTypeAddAll(), perturbation_field_1d(), pha_mat_singleCalc(), pha_mat_singleExtract(), pha_mat_sptFromData(), pha_mat_sptFromDataDOITOpt(), pha_mat_sptFromMonoData(), pmomCalc(), pnd_fieldSetup(), pnd_fieldZero(), poly_root_solve(), polynomial_basis_func(), ppath_calc(), ppath_copy(), ppath_end_1d(), ppath_end_2d(), ppath_end_3d(), ppath_fill_1d(), ppath_fill_2d(), ppath_fill_3d(), ppath_start_3d(), ppath_start_stepping(), Print(), PWR93O2AbsModel(), PWR98H2OAbsModel(), r_geoidSpherical(), r_geoidWGS84(), raytrace_1d_linear_euler(), raytrace_2d_linear_euler(), raytrace_3d_linear_euler(), refr_index_Boudouris(), refr_index_BoudourisDryAir(), refr_indexIR(), refr_indexThayer(), Rosenkranz_CO2_foreign_continuum(), Rosenkranz_CO2_self_continuum(), Rosenkranz_N2_self_continuum(), Rosenkranz_O2_continuum(), rotationmat3D(), rte_posAddRgeoid(), rte_step_std(), Sample_los(), scale_H11(), scale_pnd(), ScatteringDoit(), Select(), sensor_aux_vectors(), sensor_integration_vector(), sensor_responseAntenna(), sensor_responseBackend(), sensor_responseBeamSwitching(), sensor_responseFillFgrid(), sensor_responseFrequencySwitching(), sensor_responseInit(), sensor_responseMixer(), sensor_responseMultiMixerBackend(), sensor_responsePolarisation(), sensor_responseWMRF(), sensor_summation_vector(), spectrometer_matrix(), Standard_H2O_foreign_continuum(), Standard_H2O_self_continuum(), Standard_N2_self_continuum(), Standard_O2_continuum(), surface_specular_los(), surface_specular_R_and_b(), surfaceBlackbody(), surfaceFlatReflectivity(), surfaceFlatRefractiveIndex(), surfaceFlatSingleEmissivity(), surfaceFlatVaryingEmissivity(), surfaceLambertianSimple(), Test(), test02(), test04(), test07(), test1(), test11(), test2(), test4(), test7(), test8(), test_and_merge_two_channels(), test_x_fixedstep(), testVector(), transform(), VectorAddScalar(), VectorFlip(), VectorInsertGridPoints(), VectorLinSpace(), VectorLogSpace(), VectorMatrixMultiply(), VectorScale(), VectorZtanToZa1D(), VectorZtanToZaRefr1D(), WMRFSelectChannels(), xml_read_from_stream(), xml_write_to_stream(), xsec_continuum_tag(), xsec_species(), y_unitApply(), ybatchMetProfiles(), ybatchMetProfilesClear(), yCalc(), yCalc2(), z_at_lat_2d(), z_at_latlon(), z_fieldFromHSE(), and za_gridOpt().

◆ operator ConstMatrixView()

ConstVectorView::operator ConstMatrixView ( ) const

Conversion to const 1 column matrix.

Definition at line 217 of file matpackI.cc.

◆ operator[]() [1/2]

ConstVectorView ConstVectorView::operator[] ( const Range r) const

Const index operator for subrange.

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

Definition at line 196 of file matpackI.cc.

References ConstVectorView(), mdata, and mrange.

◆ operator[]() [2/2]

Numeric ConstVectorView::operator[] ( Index  n) const
inline

Plain const index operator.

Definition at line 311 of file matpackI.h.

References mdata, Range::mextent, mrange, Range::mstart, and Range::mstride.

Referenced by VectorView::operator[]().

◆ sum()

Numeric ConstVectorView::sum ( ) const

The sum of all elements of a Vector.

Definition at line 181 of file matpackI.cc.

References begin(), and end().

Referenced by antenna1d_matrix(), interp(), interpolate_raytracing_points(), mixer_matrix(), scale_H11(), spectrometer_matrix(), and test17().

Friends And Related Function Documentation

◆ ConstIterator2D

friend class ConstIterator2D
friend

Definition at line 334 of file matpackI.h.

◆ ConstMatrixView

friend class ConstMatrixView
friend

Definition at line 335 of file matpackI.h.

◆ ConstTensor3View

friend class ConstTensor3View
friend

Definition at line 336 of file matpackI.h.

◆ ConstTensor4View

friend class ConstTensor4View
friend

Definition at line 337 of file matpackI.h.

◆ ConstTensor5View

friend class ConstTensor5View
friend

Definition at line 338 of file matpackI.h.

◆ ConstTensor6View

friend class ConstTensor6View
friend

Definition at line 339 of file matpackI.h.

◆ ConstTensor7View

friend class ConstTensor7View
friend

Definition at line 340 of file matpackI.h.

◆ mult

void mult ( VectorView  ,
const ConstMatrixView ,
const ConstVectorView  
)
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 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! 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 1607 of file matpackI.cc.

◆ poly_root_solve

int poly_root_solve ( Matrix roots,
Vector coeffs 
)
friend

Definition at line 100 of file poly_roots.cc.

◆ VectorView

friend class VectorView
friend

Definition at line 333 of file matpackI.h.

Member Data Documentation

◆ mdata

◆ mrange


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