ARTS  2.2.66
ConstVectorView Class Reference

A constant view of a Vector. More...

#include <matpackI.h>

Inheritance diagram for ConstVectorView:
Collaboration diagram for ConstVectorView:

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...
 
Numeric get (Index n) const
 Get element implementation without assertions. 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
 
Numeric operator* (const ConstVectorView &a, const ConstVectorView &b)
 Scalar product. More...
 
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 292 of file matpackI.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 295 of file matpackI.h.

Constructor & Destructor Documentation

◆ ~ConstVectorView()

virtual ConstVectorView::~ConstVectorView ( )
inlinevirtual

Destructor.

Definition at line 329 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 239 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 247 of file matpackI.cc.

Referenced by ConstMatrixView::begin(), ConstMatrixView::end(), and ConstMatrixView::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 255 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 273 of file matpackI.cc.

Member Function Documentation

◆ begin()

◆ end()

◆ get()

Numeric ConstVectorView::get ( Index  n) const
inline

Get element implementation without assertions.

Definition at line 311 of file matpackI.h.

References operator*().

Referenced by VectorView::get(), and interp().

◆ 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 180 of file matpackI.cc.

Referenced by abs_lines_per_speciesCompact(), abs_lines_per_speciesReadFromCatalogues(), abs_lineshape_per_tgDefine(), abs_lookupCalc(), abs_lookupSetup(), abs_lookupSetupBatch(), abs_lookupTestAccMC(), abs_lookupTestAccuracy(), abs_vecInit(), abs_vecTransform(), abs_xsec_per_speciesAddCIA(), 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(), antenna_responseVaryingGaussian(), AntennaConstantGaussian1D(), Append(), CIARecord::AppendDataset(), apply_iy_unit(), apply_iy_unit2(), atm_fields_compactAddSpecies(), AtmFieldsCalc(), AtmFieldsCalcExpand1D(), AtmFieldsExpand1D(), AtmFieldsRefinePgrid(), atmgeom_checkedCalc(), backend_channel_responseGaussian(), batch_atm_fields_compactFromArrayOfMatrix(), BF86_CIA_N2(), blackbody_radiationPlanck(), calc_lookup_error(), calc_nd_field(), calc_ssp_fixed_test(), calc_ssp_random_test(), calcSingleScatteringDataProperties(), check_retrieval_grids(), 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_interpolation_grids_loose_check_data(), chk_interpolation_grids_loose_no_data_check(), chk_interpolation_pgrids(), chk_interpolation_pgrids_loose_no_data_check(), chk_latlon_true(), chk_massdensity_field(), chk_pnd_data(), chk_pndsum(), chk_rte_los(), chk_rte_pos(), chk_scat_data(), chk_size(), chk_vector_length(), choose_abs_nls_pert(), choose_abs_t_pert(), cia_interpolation(), 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_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(), CloudboxGetIncoming2(), cloudboxSetAutomatically(), cloudboxSetFullAtm(), cloudboxSetManually(), cloudboxSetManuallyAltitude(), Compare(), complex_n_interp(), complex_n_water_liebe93(), complex_refr_indexWaterLiebe93(), CP98H2OAbsModel(), cross3(), describe(), dN_Ar_H13(), dN_F07ML(), dN_F07TR(), dN_H11(), dN_H98(), dN_MGD_IWC(), dN_MGD_LWC(), dN_MH97(), dN_MP48(), do_gridcell_2d(), doit_conv_flagAbs(), doit_conv_flagAbsBT(), doit_conv_flagLsq(), doit_i_fieldSetClearsky(), doit_i_fieldSetFromdoit_i_field1D_spectrum(), doit_i_fieldUpdate1D(), doit_i_fieldUpdateSeq1D(), doit_i_fieldUpdateSeq1DPP(), doit_i_fieldUpdateSeq3D(), doit_scat_fieldCalc(), doit_scat_fieldCalcLimb(), doit_scat_fieldNormalize(), doit_za_grid_optCalc(), DoitCloudboxFieldPut(), DoitInit(), DoitScatteringDataPrepare(), dtauc_ssalbCalc(), emission_rtstep(), ext_matFromabs_vec(), ext_matInit(), GasAbsLookup::Extract(), Extract(), f_gridFromGasAbsLookup(), f_gridFromSensorAMSU(), f_gridFromSensorAMSUgeneric(), f_gridFromSensorHIRS(), faddeeva_algorithm_916(), FieldFromGriddedField(), FieldFromGriddedFieldCheckLatLonHelper(), find_effective_channel_boundaries(), find_new_grid_in_old_grid(), fos(), FrequencyFromWavelength(), gaussian_response(), get_iy_of_background(), get_perturbation_gridpos(), get_perturbation_limit(), get_ppath_abs(), get_ppath_f(), get_ppath_trans(), get_ppath_trans2(), get_refr_index_2d(), get_refr_index_3d(), GriddedFieldLatLonRegrid(), GriddedFieldLatLonRegridHelper(), GriddedFieldPRegrid(), GriddedFieldPRegridHelper(), GriddedFieldZToPRegrid(), GriddedFieldZToPRegridHelper(), gridpos(), gridpos_1to1(), gridpos_poly(), gridpos_poly_cyclic_longitudinal(), gridpos_poly_longitudinal(), Ho66_CO2_foreign_continuum(), Ho66_CO2_self_continuum(), hui_etal_1978_lineshape(), init_x(), init_xy(), Sparse::insert_row(), interp(), interp_atmfield_by_itw(), interp_atmsurface_by_itw(), interp_cloud_coeff1D(), interp_cloudfield_gp2itw(), interp_poly(), interp_scat_angle_temperature(), interpTArray(), interpweights(), is_decreasing(), is_increasing(), is_lon_cyclic(), is_size(), is_sorted(), itw2p(), iwp_cloud_opt_pathCalc(), iy_interp_cloudbox_field(), iy_transmitterMultiplePol(), iy_transmitterSinglePol(), iyb_calc(), iyCloudRadar(), iyEmissionStandard(), iyFOS(), iyInterpCloudboxField2(), iyLoopFrequencies(), iyMC(), iyRadioLink(), iySurfaceRtpropAgenda(), iyTransmissionStandard(), jacobianAddFreqShift(), jacobianAddFreqStretch(), jacobianAddPointingZa(), jacobianAddPolyfit(), jacobianAddSinefit(), jacobianCalcFreqShift(), jacobianCalcFreqStretch(), jacobianCalcPointingZaInterp(), jacobianCalcPolyfit(), jacobianCalcSinefit(), LagrangeInterpol4(), last(), lineshape_CO2_drayson(), lineshape_CO2_lorentz(), lineshape_doppler(), lineshape_lorentz(), lineshape_norm_linear(), lineshape_norm_quadratic(), lineshape_norm_VVH(), lineshape_voigt_drayson(), lineshape_voigt_kuntz3(), lineshape_voigt_kuntz4(), lineshape_voigt_kuntz6(), linreg(), lon_shiftgrid(), 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(), nca_def_Vector(), nca_put_var_Vector(), nca_write_to_file(), operator*(), VectorView::operator*=(), MatrixView::operator*=(), VectorView::operator+=(), MatrixView::operator+=(), VectorView::operator-=(), MatrixView::operator-=(), VectorView::operator/=(), MatrixView::operator/=(), operator<<(), MatrixView::operator=(), Matrix::operator=(), opt_prop_sptFromMonoData(), opt_propCalc(), opt_propExtract(), p2gridpos(), p2gridpos_poly(), p_gridDensify(), p_gridFromGasAbsLookup(), Pardo_ATM_H2O_ForeignContinuum(), Pardo_ATM_N2_dry_continuum(), ParticleType2abs_speciesAdd(), ParticleTypeAdd(), ParticleTypeAddAll(), perturbation_field_1d(), pha_mat_singleCalc(), pha_mat_singleExtract(), pha_mat_sptFromData(), pha_mat_sptFromDataDOITOpt(), pha_mat_sptFromMonoData(), plevel_slope_3d(), pmomCalc(), pnd_fieldF07ML(), pnd_fieldF07TR(), pnd_fieldGM58(), pnd_fieldH11(), pnd_fieldH13(), pnd_fieldH13Shape(), pnd_fieldH98(), pnd_fieldMGD_IWC(), pnd_fieldMGD_LWC(), pnd_fieldMH97(), pnd_fieldMP48(), pnd_fieldSS70(), pnd_fieldZero(), pndFromdN(), poly_root_solve(), polynomial_basis_func(), pos2refell_r(), pos2true_latlon(), ppath_calc(), ppath_end_1d(), ppath_end_2d(), ppath_end_3d(), ppath_start_3d(), ppath_start_stepping(), ppath_step_geom_1d(), ppath_step_geom_2d(), ppath_step_geom_3d(), Print(), proj(), propmat_clearsky_fieldCalc(), propmat_clearskyAddFaraday(), propmat_clearskyAddParticles(), propmat_clearskyAddZeeman(), propmat_clearskyInit(), propmat_clearskyZero(), PWR93O2AbsModel(), PWR98H2OAbsModel(), raytrace_1d_linear_basic(), raytrace_2d_linear_basic(), raytrace_3d_linear_basic(), Reduce(), refell2r(), refellipsoidForAzimuth(), refellipsoidOrbitPlane(), refr_index_airMWgeneral(), refr_index_airThayer(), Rosenkranz_CO2_foreign_continuum(), Rosenkranz_CO2_self_continuum(), Rosenkranz_N2_self_continuum(), Rosenkranz_O2_continuum(), rotationmat3D(), rte_pos2gridpos(), rte_step_doit(), Sample_los(), scale_H11(), scale_H13(), scale_pnd(), scat_meta_arrayAddTmatrix(), scat_meta_arrayAddTmatrixOldVersion(), ScatteringDoit(), ScatteringMergeParticles1D(), Select(), select_dims_by_size(), sensor_aux_vectors(), sensor_checkedCalc(), sensor_integration_vector(), sensor_integration_vector2(), sensor_responseAntenna(), sensor_responseBackend(), sensor_responseBeamSwitching(), sensor_responseFillFgrid(), sensor_responseFrequencySwitching(), sensor_responseGenericAMSU(), sensor_responseInit(), sensor_responseMixer(), sensor_responseMultiMixerBackend(), sensor_responsePolarisation(), sensor_responseStokesRotation(), sensor_responseWMRF(), sensor_summation_vector(), spectrometer_matrix(), Standard_H2O_foreign_continuum(), Standard_H2O_self_continuum(), Standard_N2_self_continuum(), Standard_O2_continuum(), surface_reflectivityFromGriddedField6(), surface_scalar_reflectivityFromGriddedField4(), surface_specular_R_and_b(), surfaceBlackbody(), surfaceFlatReflectivity(), surfaceFlatRefractiveIndex(), surfaceFlatScalarReflectivity(), surfaceLambertianSimple(), Test(), test02(), test04(), test07(), test1(), test11(), test2(), test4(), test7(), test8(), test_and_merge_two_channels(), test_x_fixedstep(), testVector(), transform(), TRE05O2AbsModel(), unitl(), vector_angle(), VectorAddScalar(), VectorCrop(), VectorFlip(), VectorInsertGridPoints(), VectorLinSpace(), VectorLogSpace(), VectorMatrixMultiply(), VectorScale(), VectorZtanToZa1D(), VectorZtanToZaRefr1D(), wind_u_fieldIncludePlanetRotation(), WMRFSelectChannels(), WriteMolTau(), xml_read_from_stream(), xml_write_to_stream(), xsec_continuum_tag(), xsec_species(), xsec_species_line_mixing_2nd_order(), xsec_species_line_mixing_wrapper_with_zeeman(), yApplyUnit(), ybatchCalc(), ybatchMetProfiles(), ybatchMetProfilesClear(), yCalc(), yCalc_mblock_loop_body(), yCalcAppend(), yCloudRadar(), ySimpleSpectrometer(), 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 222 of file matpackI.cc.

References Range::ConstMatrixView, and Range::Range().

◆ operator[]() [1/2]

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

Plain const index operator.

Definition at line 303 of file matpackI.h.

Referenced by VectorView::operator[]().

◆ operator[]() [2/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 201 of file matpackI.cc.

References Range::ConstVectorView.

◆ sum()

Numeric ConstVectorView::sum ( ) const

Friends And Related Function Documentation

◆ ConstIterator2D

friend class ConstIterator2D
friend

Definition at line 333 of file matpackI.h.

◆ ConstMatrixView

friend class ConstMatrixView
friend

Definition at line 334 of file matpackI.h.

Referenced by ConstMatrixView::operator()().

◆ ConstTensor3View

friend class ConstTensor3View
friend

Definition at line 335 of file matpackI.h.

◆ ConstTensor4View

friend class ConstTensor4View
friend

Definition at line 336 of file matpackI.h.

◆ ConstTensor5View

friend class ConstTensor5View
friend

Definition at line 337 of file matpackI.h.

◆ ConstTensor6View

friend class ConstTensor6View
friend

Definition at line 338 of file matpackI.h.

◆ ConstTensor7View

friend class ConstTensor7View
friend

Definition at line 339 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 1648 of file matpackI.cc.

◆ operator*

Numeric operator* ( const ConstVectorView a,
const ConstVectorView b 
)
friend

Scalar product.

The two vectors may be identical.

Definition at line 1623 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 332 of file matpackI.h.

Referenced by VectorView::operator[]().

Member Data Documentation

◆ mdata

◆ mrange


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