mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
Vector Utilities

Utilities for working with std::vector.

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.
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.
template<typename valueT>
valueT mx::math::vectorSum (const valueT *vec, size_t sz)
 Calculate the sum of a vector.
template<typename vectorT>
vectorT::value_type mx::math::vectorSum (const vectorT &vec)
 Calculate the sum of a vector.
template<typename valueT>
valueT mx::math::vectorMean (const valueT *vec, size_t sz)
 Calculate the mean of a vector.
template<typename vectorT>
vectorT::value_type mx::math::vectorMean (const vectorT &vec)
 Calculate the mean of a vector.
template<typename vectorT>
vectorT::value_type mx::math::vectorMean (const vectorT &vec, const vectorT &w)
 Calculate the weighted mean of a vector.
template<typename vectorT>
vectorT::value_type mx::math::vectorMedianInPlace (vectorT &vec)
 Calculate median of a vector in-place, altering the vector.
template<typename vectorT>
vectorT::value_type mx::math::vectorMedian (const vectorT &vec, vectorT *work=0)
 Calculate median of a vector, leaving the vector unaltered.
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.
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.
template<typename valueT>
valueT mx::math::vectorVariance (const valueT *vec, size_t sz)
 Calculate the variance of a vector.
template<typename vectorT>
vectorT::value_type mx::math::vectorVariance (const vectorT &vec)
 Calculate the variance of a vector.
template<typename vectorT, typename sigmaT>
vectorT::value_type mx::math::vectorSigmaMean (const vectorT &vec, const vectorT *weights, const sigmaT &sigma, int &maxPasses)
 Calculate the sigma-clipped mean of a vector.
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.
template<typename vecT, typename constT>
void mx::math::vectorSub (vecT &vec, const constT &c)
 Subtract a constant value from a vector.
template<typename valueT>
void mx::math::vectorMeanSub (valueT *vec, size_t sz)
 Subtract the mean from a vector.
template<typename vecT>
void mx::math::vectorMeanSub (vecT &vec)
 Subtract the mean from a vector.
template<typename vecT>
void mx::math::vectorMedianSub (vecT &vec)
 Subtract the median from a vector.
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.
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.
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.
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.
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.
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.
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.
template<typename realT, typename fwhmT, typename winhwT>
int mx::math::vectorGaussConvolve (std::vector< realT > &dataOut, const std::vector< realT > &dataIn, const std::vector< realT > &scale, const fwhmT fwhm, const winhwT winhw)
 Convolve (smooth) a vector with a Gaussian.
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.
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.

Function Documentation

◆ vectorBinMeans()

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.

Useful mainly to calculate the variance of the mean as a function of sample size. The output is a vector of vectors, where each element is a vector which contains the means in the unique bins of size corresponding to the same index in the in put binSzs vector.

Returns
0 on success.
Parameters
[out]meansthe means in each distinct bin. Not cleared, but Will be resized with new means appended.
[in]binSzsthe bin sizes in which to calculate the means
[in]vthe input vector to bin .

Definition at line 804 of file vectorUtils.hpp.

References vectorRebin().

Referenced by mx::AO::analysis::speckleAmpPSD().

◆ vectorCumHist()

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.

Sorts the vector and sums.

Return values
0on success, -1 otherwise.
Template Parameters
floatTthe floating point type of the vector contens.
Parameters
[out]svecContains the sorted vector.
[out]sumContains the cumulative or running sum of the sorted vector
[in]vecThe vector to sort and sum.

Definition at line 893 of file vectorUtils.hpp.

◆ vectorCumHistReverse()

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.

Reverse-sorts the vector and sums.

Return values
0on success, -1 otherwise.
Template Parameters
floatTthe floating point type of the vector contens.
Parameters
[out]svecContains the reverse-sorted vector.
[out]sumContains the cumulative or running sum of the reverse-sorted vector
[in]vecThe vector to reverse-sort and sum.

Definition at line 922 of file vectorUtils.hpp.

◆ vectorGaussConvolve()

template<typename realT, typename fwhmT, typename winhwT>
int mx::math::vectorGaussConvolve ( std::vector< realT > & dataOut,
const std::vector< realT > & dataIn,
const std::vector< realT > & scale,
const fwhmT fwhm,
const winhwT winhw )

Convolve (smooth) a vector with a Gaussian.

Returns
0 on success.
-1 on error.
Template Parameters
realTis the real floating point type of the data.
Parameters
[out]dataOutThe smoothed data vector. Resized.
[in]dataInThe data vector to smooth.
[in]scaleThe scale vector used to calculate the kernel.
[in]fwhmThe FWHM of the Gaussian kernel, same units as scale.
[in]winhwThe window half-width in pixels.

Definition at line 836 of file vectorUtils.hpp.

References mx::math::func::fwhm2sigma(), and mx::math::func::gaussian().

◆ vectorMean() [1/3]

template<typename valueT>
valueT mx::math::vectorMean ( const valueT * vec,
size_t sz )

Calculate the mean of a vector.

Returns
the mean of vec
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector
[in]szthe size of the vector

Definition at line 162 of file vectorUtils.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), mx::improc::eigenCube< dataT >::mean(), mx::improc::eigenCube< dataT >::mean(), mx::improc::eigenCube< dataT >::mean(), mx::improc::sourceFinder< _realT >::operator()(), mx::improc::stddevImage(), vectorMeanSub(), vectorSigmaMean(), vectorVariance(), and vectorVariance().

◆ vectorMean() [2/3]

template<typename vectorT>
vectorT::value_type mx::math::vectorMean ( const vectorT & vec)

Calculate the mean of a vector.

Returns
the mean of vec
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector

Definition at line 187 of file vectorUtils.hpp.

◆ vectorMean() [3/3]

template<typename vectorT>
vectorT::value_type mx::math::vectorMean ( const vectorT & vec,
const vectorT & w )

Calculate the weighted mean of a vector.

Returns
the weighted mean of vec
Template Parameters
vectorTthe std::vector type of vec and w
Parameters
[in]vecthe vector *‍/
[in]wthe weights

Definition at line 209 of file vectorUtils.hpp.

◆ vectorMeanSub() [1/2]

template<typename valueT>
void mx::math::vectorMeanSub ( valueT * vec,
size_t sz )

Subtract the mean from a vector.

Parameters
vec[in/out] the vector, each element will have the mean subtracted from it
[in]szthe vector size

Definition at line 543 of file vectorUtils.hpp.

References vectorMean(), and vectorSub().

Referenced by mx::AO::analysis::fourierTemporalPSD< _realT, aosysT >::intensityPSD(), mx::AO::analysis::speckleAmpPSD(), and vectorMeanSub().

◆ vectorMeanSub() [2/2]

template<typename vecT>
void mx::math::vectorMeanSub ( vecT & vec)

Subtract the mean from a vector.

Parameters
vec[in/out] the vector, each element will have the mean subtracted from it

Definition at line 553 of file vectorUtils.hpp.

References vectorMeanSub().

◆ vectorMedian()

template<typename vectorT>
vectorT::value_type mx::math::vectorMedian ( const vectorT & vec,
vectorT * work = 0 )

Calculate median of a vector, leaving the vector unaltered.

Returns the center element if vec has an odd number of elements. Returns the mean of the center 2 elements if vec has an even number of elements.

Returns
the median of vec
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector for which the median is desired
[in]work[optional] an optional vector to use as workspace, use to avoid re-allocation

Definition at line 265 of file vectorUtils.hpp.

References vectorMedianInPlace().

Referenced by mx::improc::colEdgeMedSubtract(), mx::improc::aperturePhotometer< realT >::cumPhotWork(), mx::improc::sourceFinder< _realT >::operator()(), mx::improc::rowEdgeMedSubtract(), vectorMedianSub(), and vectorSigmaMean().

◆ vectorMedianInPlace()

template<typename vectorT>
vectorT::value_type mx::math::vectorMedianInPlace ( vectorT & vec)

Calculate median of a vector in-place, altering the vector.

Returns the center element if vec has an odd number of elements. Returns the mean of the center 2 elements if vec has an even number of elements.

Returns
the median of vec
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector, is altered by std::nth_element

Definition at line 236 of file vectorUtils.hpp.

Referenced by mx::improc::imageMedian(), mx::improc::eigenCube< dataT >::median(), mx::improc::medianFilterImage(), mx::improc::medianSmooth(), vectorMedian(), and vectorSmoothMedian().

◆ vectorMedianSub()

template<typename vecT>
void mx::math::vectorMedianSub ( vecT & vec)

Subtract the median from a vector.

Parameters
vec[in/out] the vector, each element will have the median subtracted from it

Definition at line 560 of file vectorUtils.hpp.

References vectorMedian(), and vectorSub().

◆ vectorRebin()

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.

Returns
0 on success
-1 on error
Template Parameters
vectorTis any vector-like type with resize(), size(), and the operator()[].
Parameters
[out]binvthe re-binned vector. will be resized.
[in]vthe vector to bin.
[in]nthe size of the bins, in points
[in]binMean[optional] flag controlling whether sums (false) or means (true) are calculated.

Definition at line 755 of file vectorUtils.hpp.

Referenced by vectorBinMeans().

◆ vectorScale()

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.

Fills in the vector with a 0....N-1 scale. The spacing of the points can be changed with the scale parameter, and the starting point can be changed with the offset.

Example:

std::vector vec;
mx::vectorScale(vec, 1000, 0.001, 0.001); // Produces a vector with values 0.001,0.002,.... 1.000
Template Parameters
vectorTis a std::vector type.
Parameters
[out]vecthe vector to fill in, can be pre-allocated or not
[in]N[optional] if specified > 0, then vec is resize()-ed. Default is 0, and vec is not resize()-ed.
[in]scale[optional] if specified !=0, then the points are spaced by this value. Default spacing is 1.
[in]offset[optional] if specified !=0, then the starting point of the scale is this value.

Definition at line 61 of file vectorUtils.hpp.

Referenced by mx::AO::analysis::fourierTemporalPSD< _realT, aosysT >::makePSDGrid().

◆ vectorSigmaMean() [1/4]

template<typename vectorT>
vectorT::value_type mx::math::vectorSigmaMean ( const vectorT & vec,
const vectorT & weights,
typename vectorT::value_type sigma )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]vecthe vector (unaltered)
[in]weights[optional] the weights (unaltered)
[in]sigmathe standard deviation threshold to apply.

Definition at line 511 of file vectorUtils.hpp.

References vectorSigmaMean().

◆ vectorSigmaMean() [2/4]

template<typename vectorT>
vectorT::value_type mx::math::vectorSigmaMean ( const vectorT & vec,
const vectorT & weights,
typename vectorT::value_type sigma,
int & maxPasses )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]vecthe vector (unaltered)
[in]weights[optional] the weights (unaltered)
[in]sigmathe standard deviation threshold to apply.
maxPasses[in/out] [optional] the maximum number of sigma-clipping passes. Set to actual number of passes on return.

Definition at line 495 of file vectorUtils.hpp.

References vectorSigmaMean().

◆ vectorSigmaMean() [3/4]

template<typename vectorT, typename sigmaT>
vectorT::value_type mx::math::vectorSigmaMean ( const vectorT & vec,
const vectorT * weights,
const sigmaT & sigma,
int & maxPasses )

Calculate the sigma-clipped mean of a vector.

Performas sigma-clipping relative to the median, removing any values with deviation from the median > sigma. Continues until either no values are removed, or maxPasses iterations. If maxPasses == 0, then it is ignored.

Returns
the sigma clipped mean of vec
Template Parameters
vectorTthe std::vector type of vec
sigmaTthe type of sigma, which is converted to value_type
Parameters
[in]vecthe vector (unaltered)
[in]weights[optional] the weights (unaltered)
[in]sigmathe standard deviation threshold to apply.
maxPasses[in/out] [optional] the maximum number of sigma-clipping passes. Is set to actual number of passes on return.

Definition at line 394 of file vectorUtils.hpp.

References vectorMean(), vectorMedian(), and vectorVariance().

Referenced by mx::improc::eigenCube< dataT >::sigmaMean(), mx::improc::eigenCube< dataT >::sigmaMean(), mx::improc::eigenCube< dataT >::sigmaMean(), mx::improc::eigenCube< dataT >::sigmaMean(), vectorSigmaMean(), vectorSigmaMean(), and vectorSigmaMean().

◆ vectorSigmaMean() [4/4]

template<typename vectorT>
vectorT::value_type mx::math::vectorSigmaMean ( const vectorT & vec,
typename vectorT::value_type sigma )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]vecthe vector (unaltered)
[in]sigmathe standard deviation threshold to apply.

Definition at line 481 of file vectorUtils.hpp.

References vectorSigmaMean().

◆ vectorSmoothMax()

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.

Parameters
[out]smVecthe smoothed version of the vector
[in]vecthe input vector, unaltered.
[in]winthe full-width of the smoothing window

Definition at line 717 of file vectorUtils.hpp.

◆ vectorSmoothMean() [1/3]

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.

Parameters
[out]smVecthe smoothed version of the vector. At least as large as vec.
[in]vecthe input vector, unaltered.
[in]vecSizethe size of vec
[in]winthe full-width of the smoothing window. Should be even. 0 results in a slow memcpy.

Definition at line 568 of file vectorUtils.hpp.

Referenced by vectorSmoothMean().

◆ vectorSmoothMean() [2/3]

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[out]smVecthe smoothed version of the vector. Will be resize()-ed.
[in]vecthe input vector, unaltered.
[in]winthe full-width of the smoothing window. Should be even. 0 results in a slow memcpy.

Definition at line 604 of file vectorUtils.hpp.

References vectorSmoothMean().

◆ vectorSmoothMean() [3/3]

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.

You supply a window width for each point. This is useful for, say, logarithmically growing bin sizes in a PSD.

Returns
0 on success
-1 but who are we kidding it we don't check for errors
Parameters
[out]smVecthe smoothed version of the vector
[in]vecthe input vector, unaltered.
[in]winsthe full-widths of the smoothing windows, same size as vec.
[in]normif true the output will normalized to have the same integral as the input.

Definition at line 623 of file vectorUtils.hpp.

◆ vectorSmoothMedian()

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.

For even widths, the window is associated with the higher-index member of the central pair: it contains win/2 samples before the output sample and one fewer after it. Windows are truncated at the vector boundaries.

Returns
0 on success
-1 if win is not positive
Parameters
[out]smVecthe smoothed version of the vector
[in]vecthe input vector, unaltered
[in]winthe full width of the smoothing window

Definition at line 681 of file vectorUtils.hpp.

References vectorMedianInPlace().

Referenced by unitTest::improcTest::imageFiltersTest::TEST_CASE().

◆ vectorSortOrder()

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.

Example:

std::vector<double> x;
// -> fill in x with values
std::vector<size_t> idx;
idx = mx::sortOrder(x);
//Print x to stdout in sorted order
for(int i=0; i< x.size(); ++i) std::cout << x[idx[i]] << "\n";
Template Parameters
memberTis the member type of the vector. Must have < comparison defined.
Returns
the indices of the vector in sorted order.
Parameters
[in]valuesthe vector to sort

Definition at line 98 of file vectorUtils.hpp.

Referenced by mx::astro::rewritePhoenixSpectrum().

◆ vectorSub() [1/2]

template<typename valueT, typename constT>
void mx::math::vectorSub ( valueT * vec,
size_t sz,
const constT & c )

Subtract a constant value from a vector.

Parameters
vec[in/out] the vector, each element will have the constant subtracted from it
[in]szthe size of the vector
[in]cthe constant to subtract from each element

Definition at line 523 of file vectorUtils.hpp.

Referenced by vectorMeanSub(), vectorMedianSub(), and vectorSub().

◆ vectorSub() [2/2]

template<typename vecT, typename constT>
void mx::math::vectorSub ( vecT & vec,
const constT & c )

Subtract a constant value from a vector.

Parameters
vec[in/out] the vector, each element will have the constant subtracted from it
[in]cthe constant to subtract from each element

Definition at line 534 of file vectorUtils.hpp.

References vectorSub().

◆ vectorSum() [1/2]

template<typename valueT>
valueT mx::math::vectorSum ( const valueT * vec,
size_t sz )

Calculate the sum of a vector.

Returns
the sum of vec
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector
[in]szthe size of the vector

Definition at line 118 of file vectorUtils.hpp.

◆ vectorSum() [2/2]

template<typename vectorT>
vectorT::value_type mx::math::vectorSum ( const vectorT & vec)

Calculate the sum of a vector.

Returns
the sum of vec
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector

Definition at line 141 of file vectorUtils.hpp.

◆ vectorVariance() [1/4]

template<typename valueT>
valueT mx::math::vectorVariance ( const valueT * vec,
size_t sz )

Calculate the variance of a vector.

Returns
the variance of vec
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector
[in]szthe size of the vector

Definition at line 356 of file vectorUtils.hpp.

References vectorMean(), and vectorVariance().

◆ vectorVariance() [2/4]

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.

Returns
the variance of vec w.r.t. mean
Template Parameters
valueTthe data type
Parameters
[in]vecthe vector
[in]szthe size of the vector
[in]meanthe mean value with which to calculate the variance

Definition at line 304 of file vectorUtils.hpp.

Referenced by mx::improc::imCenterCircleSym< realT >::center(), mx::AO::analysis::fourierTemporalPSD< _realT, aosysT >::intensityPSD(), mx::improc::sourceFinder< _realT >::operator()(), mx::sigproc::averagePeriodogram< realT >::operator()(), mx::AO::analysis::speckleAmpPSD(), mx::improc::stddevImage(), TEST_CASE(), unitTest::math_vectorUtils_test::TEST_CASE(), vectorSigmaMean(), vectorVariance(), and vectorVariance().

◆ vectorVariance() [3/4]

template<typename vectorT>
vectorT::value_type mx::math::vectorVariance ( const vectorT & vec)

Calculate the variance of a vector.

Returns
the variance of vec
Template Parameters
vectorTthe std::vector type of vec

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]vecthe vector

Definition at line 375 of file vectorUtils.hpp.

References vectorMean(), and vectorVariance().

◆ vectorVariance() [4/4]

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.

Returns
the variance of vec w.r.t. mean
Template Parameters
vectorTthe std::vector type of vec
Parameters
[in]vecthe vector
[in]meanthe mean value with which to calculate the variance

Definition at line 331 of file vectorUtils.hpp.