GammaLib 2.0.0
Loading...
Searching...
No Matches
GVector.cpp File Reference

Vector class implementation. More...

#include "GVector.hpp"
#include "GTools.hpp"

Go to the source code of this file.

Macros

#define G_CONSTRUCTOR   "GVector::GVector(int&)"
 
#define G_OP_ADD   "GVector::operator+=(GVector&)"
 
#define G_OP_SUB   "GVector::operator-=(GVector&)"
 
#define G_AT   "GVector::at(int&)"
 
#define G_CROSS   "cross(GVector&, GVector&)"
 
#define G_SCALAR   "operator*(GVector&, GVector&)"
 
#define G_ANGLE   "angle(GVector&, GVector&)"
 

Functions

GVector cross (const GVector &a, const GVector &b)
 Vector cross product.
 
double operator* (const GVector &a, const GVector &b)
 Vector scalar product.
 
double norm (const GVector &vector)
 Computes vector norm.
 
double min (const GVector &vector)
 Computes minimum vector element.
 
double max (const GVector &vector)
 Computes maximum vector element.
 
double sum (const GVector &vector)
 Computes vector sum.
 
double angle (const GVector &a, const GVector &b)
 Computes angle between vectors.
 
GVector perm (const GVector &vector, const int *p)
 Computes vector permutation.
 
GVector iperm (const GVector &vector, const int *p)
 Computes vector inverse permutation.
 
GVector acos (const GVector &vector)
 Computes arccos of vector elements.
 
GVector acosh (const GVector &vector)
 Computes acosh of vector elements.
 
GVector asin (const GVector &vector)
 Computes arcsin of vector elements.
 
GVector asinh (const GVector &vector)
 Computes asinh of vector elements.
 
GVector atan (const GVector &vector)
 Computes arctan of vector elements.
 
GVector atanh (const GVector &vector)
 Computes atanh of vector elements.
 
GVector cos (const GVector &vector)
 Computes cosine of vector elements.
 
GVector cosh (const GVector &vector)
 Computes cosh of vector elements.
 
GVector exp (const GVector &vector)
 Computes exponential of vector elements.
 
GVector abs (const GVector &vector)
 Computes absolute of vector elements.
 
GVector log (const GVector &vector)
 Computes natural logarithm of vector elements.
 
GVector log10 (const GVector &vector)
 Computes base10 logarithm of vector elements.
 
GVector sin (const GVector &vector)
 Computes sine of vector elements.
 
GVector sinh (const GVector &vector)
 Computes sinh of vector elements.
 
GVector sqrt (const GVector &vector)
 Computes square root of vector elements.
 
GVector tan (const GVector &vector)
 Computes tangens of vector elements.
 
GVector tanh (const GVector &vector)
 Computes tanh of vector elements.
 
GVector pow (const GVector &vector, const double &power)
 Computes tanh of vector elements.
 

Detailed Description

Vector class implementation.

Author
Juergen Knoedlseder

Definition in file GVector.cpp.

Macro Definition Documentation

◆ G_ANGLE

#define G_ANGLE   "angle(GVector&, GVector&)"

Definition at line 42 of file GVector.cpp.

◆ G_AT

#define G_AT   "GVector::at(int&)"

Definition at line 39 of file GVector.cpp.

◆ G_CONSTRUCTOR

#define G_CONSTRUCTOR   "GVector::GVector(int&)"

Definition at line 36 of file GVector.cpp.

◆ G_CROSS

#define G_CROSS   "cross(GVector&, GVector&)"

Definition at line 40 of file GVector.cpp.

◆ G_OP_ADD

#define G_OP_ADD   "GVector::operator+=(GVector&)"

Definition at line 37 of file GVector.cpp.

◆ G_OP_SUB

#define G_OP_SUB   "GVector::operator-=(GVector&)"

Definition at line 38 of file GVector.cpp.

◆ G_SCALAR

#define G_SCALAR   "operator*(GVector&, GVector&)"

Definition at line 41 of file GVector.cpp.

Function Documentation

◆ abs()

GVector abs ( const GVector & vector)

Computes absolute of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the absolute of every element.

Definition at line 1253 of file GVector.cpp.

Referenced by GIntegrals::romberg().

◆ acos()

GVector acos ( const GVector & vector)

Computes arccos of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the arccos of every element.

Definition at line 1064 of file GVector.cpp.

◆ acosh()

GVector acosh ( const GVector & vector)

Computes acosh of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the acosh of every element.

Definition at line 1085 of file GVector.cpp.

◆ angle()

double angle ( const GVector & a,
const GVector & b )

Computes angle between vectors.

Parameters
[in]aVector.
[in]bVector.
Returns
Angle between vector a and b in radians.
Exceptions
GException::invalid_argumentMismatch between vector size.

Returns the angle \(\alpha\) between vector a and b in radians. The computation is done using

\[ \alpha = \arccos{\frac{\vec{a} \cdot \vec{b}}{|\vec{a}||\vec{b}|}} \]

Definition at line 974 of file GVector.cpp.

Referenced by gammalib::cosd(), GMatrix::eulerx(), GMatrix::eulery(), GMatrix::eulerz(), GModelSpatialRadialProfileDMBurkert::jfactor(), GModelSpatialRadialProfileDMEinasto::jfactor(), GModelSpatialRadialProfileDMZhao::jfactor(), GHealpix::max_pixrad(), gammalib::sincosd(), gammalib::sind(), and gammalib::tand().

◆ asin()

GVector asin ( const GVector & vector)

Computes arcsin of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the arcsin of every element.

Definition at line 1106 of file GVector.cpp.

◆ asinh()

GVector asinh ( const GVector & vector)

Computes asinh of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the asinh of every element.

Definition at line 1127 of file GVector.cpp.

◆ atan()

GVector atan ( const GVector & vector)

Computes arctan of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the arctan of every element.

Definition at line 1148 of file GVector.cpp.

◆ atanh()

GVector atanh ( const GVector & vector)

Computes atanh of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the atanh of every element.

Definition at line 1169 of file GVector.cpp.

◆ cos()

GVector cos ( const GVector & vector)

Computes cosine of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the cosine of every element.

Definition at line 1190 of file GVector.cpp.

Referenced by GSkyDir::cos_dist(), and GHealpix::dir2pix().

◆ cosh()

GVector cosh ( const GVector & vector)

Computes cosh of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the cosh of every element.

Definition at line 1211 of file GVector.cpp.

◆ cross()

GVector cross ( const GVector & a,
const GVector & b )

Vector cross product.

Parameters
[in]aVector.
[in]bVector.
Returns
Vector cross product.
Exceptions
GException::invalid_argumentMismatch between vector size or vector not of size 3.

Computes the cross product between two 3-element vectors (note that the cross product is only defined for 3-element vectors).

Definition at line 793 of file GVector.cpp.

Referenced by GHealpix::max_pixrad(), and GWcs::solidangle().

◆ exp()

GVector exp ( const GVector & vector)

Computes exponential of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the exponential of every element.

Definition at line 1232 of file GVector.cpp.

Referenced by GModelSpectralExponential::flux_kern::eval(), GCTABackgroundPerfTable::mc(), GCTAModelRadialGauss::mc(), GCTAAeffArf::operator()(), and GLATMeanPsf::set_offsets().

◆ iperm()

GVector iperm ( const GVector & vector,
const int * p )

Computes vector inverse permutation.

Parameters
[in]vectorVector.
[in]pPermutation array.
Returns
Inversely permuted vector.

Definition at line 1038 of file GVector.cpp.

Referenced by GMatrixSparse::cholesky_solver().

◆ log()

GVector log ( const GVector & vector)

◆ log10()

GVector log10 ( const GVector & vector)

Computes base10 logarithm of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the base10 logarithm of every element.

Definition at line 1295 of file GVector.cpp.

Referenced by GCTAPsfVector::read(), GLATResponseTable::read(), and GLATEventCube::set_energies().

◆ max()

◆ min()

◆ norm()

double norm ( const GVector & vector)

Computes vector norm.

Parameters
[in]vectorVector.
Returns
Vector norm.

Definition at line 864 of file GVector.cpp.

Referenced by GFft::backward(), GModelSpatialRadialProfile::cache_index(), GCOMObservation::compute_drb_bgdlixa(), GCOMObservation::compute_drb_bgdlixe(), GCOMObservation::compute_drb_phinor(), GCOMDri::compute_drg(), GSkyMap::convolution_kernel(), GModelSpectralPlawPhotonFlux::eflux(), cta_psf_radial_kerns_phi::eval(), GCTAModelIrfBackground::eval(), GModelSpatialDiffuseConst::eval(), GCTACubeEdisp::fill(), GCTACubePsf::fill(), GModelSpatialDiffuseConst::flux(), GModelSpectralPlawEnergyFlux::flux(), gammalib::gauss_integral(), GCTAOnOffObservation::GCTAOnOffObservation(), GEphemerides::geo2ssb(), GEphemerides::geo2ssb(), GCTAResponseCube::irf_radial(), GHealpix::max_pixrad(), GCTAModelAeffBackground::mc(), GCTAModelIrfBackground::mc(), GModelSky::mc(), GModelSpectralExpInvPlaw::mc(), GModelSpectralExpPlaw::mc(), GModelSpectralSuperExpPlaw::mc(), GModelSpatialDiffuseConst::mc_norm(), GModelSpatialDiffuseMap::mc_norm(), GModelSpatialElliptical::mc_norm(), GModelSpatialPointSource::mc_norm(), GModelSpatialRadial::mc_norm(), GModelSpectralBins::mc_update(), GModelSpectralNodes::mc_update(), GCTAOnOffObservation::N_bgd(), GCOMInstChars::ne213a_mfpath(), GLATPsfV3::normalize_psf(), GLATPsfV1::psf(), GCOMModelDRM::read(), GModelSpectralConst::read(), GModelSpectralExpInvPlaw::read(), GModelSpectralExpPlaw::read(), GModelSpectralLogParabola::read(), GModelSpectralPlaw::read(), GModelSpectralSuperExpPlaw::read(), GCTAModelSkyCube::read_xml_spatial(), GCTAOnOffObservation::rmf_stacked(), GCOMBvc::tdelta(), GCOMBvcs::tdelta(), GCTAPsfKing::update(), GModelSpectralBrokenPlaw::update_mc_cache(), GCOMD2Response::update_response_vector(), GCOMModelDRM::write(), GModelSpectralBrokenPlaw::write(), GModelSpectralExpInvPlaw::write(), GModelSpectralExpPlaw::write(), GModelSpectralLogParabola::write(), GModelSpectralPlaw::write(), GModelSpectralSmoothBrokenPlaw::write(), GModelSpectralSuperExpPlaw::write(), and GCTAModelSkyCube::write_xml_spatial().

◆ operator*()

double operator* ( const GVector & a,
const GVector & b )

Vector scalar product.

Parameters
[in]aVector.
[in]bVector.
Returns
Product between vector a and b.
Exceptions
GException::invalid_argumentMismatch between vector size.

Returns the scalar product between vector a and b.

Definition at line 836 of file GVector.cpp.

◆ perm()

GVector perm ( const GVector & vector,
const int * p )

Computes vector permutation.

Parameters
[in]vectorVector.
[in]pPermutation array.
Returns
Permuted vector.

Definition at line 1011 of file GVector.cpp.

Referenced by GMatrixSparse::cholesky_solver().

◆ pow()

GVector pow ( const GVector & vector,
const double & power )

Computes tanh of vector elements.

Parameters
[in]vectorVector.
[in]powerPower.
Returns
Vector containing the power of every element.

Definition at line 1422 of file GVector.cpp.

Referenced by GLATPsfV1::psf().

◆ sin()

GVector sin ( const GVector & vector)

Computes sine of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the sine of every element.

Definition at line 1316 of file GVector.cpp.

Referenced by GSkyDir::cos_dist(), GLATMeanPsf::integral(), and GCTAModelRadialGauss::mc().

◆ sinh()

GVector sinh ( const GVector & vector)

Computes sinh of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the sinh of every element.

Definition at line 1337 of file GVector.cpp.

◆ sqrt()

GVector sqrt ( const GVector & vector)

Computes square root of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the square root of every element.

Definition at line 1358 of file GVector.cpp.

Referenced by GSparseNumeric::cholesky_numeric_analysis(), GSparseSymbolic::cs_amd(), GCTAEventBin::error(), GEventBin::error(), GLATEventBin::error(), GOptimizerLM::errors(), GObservations::errors_hessian(), GCTAModelRadialGauss::omega(), GWcsAZP::prj_s2x(), GWcsAZP::prj_x2s(), GWcs::sph_s2x(), and GWcs::sph_x2s().

◆ sum()

◆ tan()

GVector tan ( const GVector & vector)

Computes tangens of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the tangens of every element.

Definition at line 1379 of file GVector.cpp.

◆ tanh()

GVector tanh ( const GVector & vector)

Computes tanh of vector elements.

Parameters
[in]vectorVector.
Returns
Vector containing the tanh of every element.

Definition at line 1400 of file GVector.cpp.