mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
vectorUtils.hpp File Reference

Header for the std::vector utilities. More...

Header for the std::vector utilities.

Author
Jared R. Males

Definition in file vectorUtils.hpp.

Go to the source code of this file.

Namespaces

 mx
 The mxlib c++ namespace.
 

Functions

template<typename vectorT >
void mx::math::vectorScale (vectorT &vec, size_t N=0, typename vectorT::value_type scale=0, typename vectorT::value_type offset=0)
 Fill in a vector with a regularly spaced scale. More...
 
template<typename memberT >
std::vector< size_t > mx::math::vectorSortOrder (std::vector< memberT > const &values)
 Return the indices of the vector in sorted order, without altering the vector itself. More...
 
template<typename valueT >
valueT mx::math::vectorSum (const valueT *vec, size_t sz)
 Calculate the sum of a vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorSum (const vectorT &vec)
 Calculate the sum of a vector. More...
 
template<typename valueT >
valueT mx::math::vectorMean (const valueT *vec, size_t sz)
 Calculate the mean of a vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorMean (const vectorT &vec)
 Calculate the mean of a vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorMean (const vectorT &vec, const vectorT &w)
 Calculate the weighted mean of a vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorMedianInPlace (vectorT &vec)
 Calculate median of a vector in-place, altering the vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorMedian (const vectorT &vec, vectorT *work=0)
 Calculate median of a vector, leaving the vector unaltered. More...
 
template<typename valueT >
valueT mx::math::vectorVariance (const valueT *vec, size_t sz, valueT mean)
 Calculate the variance of a vector relative to a supplied mean value. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorVariance (const vectorT &vec, const typename vectorT::value_type &mean)
 Calculate the variance of a vector relative to a supplied mean value. More...
 
template<typename valueT >
valueT mx::math::vectorVariance (const valueT *vec, size_t sz)
 Calculate the variance of a vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorVariance (const vectorT &vec)
 Calculate the variance of a vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorSigmaMean (const vectorT &vec, const vectorT *weights, typename vectorT::value_type sigma, int &maxPasses)
 Calculate the sigma-clipped mean of a vector. More...
 
template<typename vectorT >
vectorT::value_type mx::math::vectorSigmaMean (const vectorT &vec, typename vectorT::value_type sigma)
 
template<typename vectorT >
vectorT::value_type mx::math::vectorSigmaMean (const vectorT &vec, const vectorT &weights, typename vectorT::value_type sigma, int &maxPasses)
 
template<typename vectorT >
vectorT::value_type mx::math::vectorSigmaMean (const vectorT &vec, const vectorT &weights, typename vectorT::value_type sigma)
 
template<typename valueT , typename constT >
void mx::math::vectorSub (valueT *vec, size_t sz, const constT &c)
 Subtract a constant value from a vector. More...
 
template<typename vecT , typename constT >
void mx::math::vectorSub (vecT &vec, const constT &c)
 Subtract a constant value from a vector. More...
 
template<typename valueT >
void mx::math::vectorMeanSub (valueT *vec, size_t sz)
 Subtract the mean from a vector. More...
 
template<typename vecT >
void mx::math::vectorMeanSub (vecT &vec)
 Subtract the mean from a vector. More...
 
template<typename vecT >
void mx::math::vectorMedianSub (vecT &vec)
 Subtract the median from a vector. More...
 
template<typename realT >
int mx::math::vectorSmoothMean (realT *smVec, realT *vec, size_t vecSize, int win)
 Smooth a vector using the mean in a window specified by its full-width. More...
 
template<typename realT >
int mx::math::vectorSmoothMean (std::vector< realT > &smVec, std::vector< realT > &vec, int win)
 Smooth a vector using the mean in a window specified by its full-width. More...
 
template<typename realT >
int mx::math::vectorSmoothMean (std::vector< realT > &smVec, std::vector< realT > &vec, std::vector< int > &wins, bool norm=false)
 Smooth a vector using the mean in windows specified by their full-widths. More...
 
template<typename realT >
int mx::math::vectorSmoothMedian (std::vector< realT > &smVec, std::vector< realT > &vec, int win)
 Smooth a vector using the median in a window specified by its full-width. More...
 
template<typename realT >
int mx::math::vectorSmoothMax (std::vector< realT > &smVec, std::vector< realT > &vec, int win)
 Smooth a vector using the max in a window specified by its full-width. More...
 
template<typename vectorT >
int mx::math::vectorRebin (vectorT &binv, const vectorT &v, unsigned n, bool binMean=false)
 Re-bin a vector by summing (or averaging) in bins of size n points. More...
 
template<typename vectorT , typename binVectorT >
int mx::math::vectorBinMeans (std::vector< vectorT > &means, binVectorT &binSzs, const vectorT &v)
 Calculate and accumulate the means of a timeseries in bins of various sizes. More...
 
template<typename realT >
int mx::math::vectorGaussConvolve (std::vector< realT > &dataOut, const std::vector< realT > &dataIn, const std::vector< realT > &scale, const realT fwhm, const int winhw)
 Convolve (smooth) a vector with a Gaussian. More...
 
template<typename floatT >
int mx::math::vectorCumHist (std::vector< floatT > &svec, std::vector< floatT > &sum, std::vector< floatT > &vec)
 Calculate a cumulative histogram of a vector. More...
 
template<typename floatT >
int mx::math::vectorCumHistReverse (std::vector< floatT > &svec, std::vector< floatT > &sum, std::vector< floatT > &vec)
 Calculate a reverse cumulative histogram of a vector. More...