Template Function beluga::calculate_covariance(Range&&, WeightsRange&&, const Sophus::Vector2<Scalar>&)

Function Documentation

template<class Range, class WeightsRange, class Scalar>
Sophus::Matrix2<Scalar> beluga::calculate_covariance(Range &&range, WeightsRange &&normalized_weights, const Sophus::Vector2<Scalar> &mean)

Calculates the covariance of a range given its mean and the weights of each element.

Template Parameters:
  • Range – A sized range type whose value type is Sophus::Vector2<Scalar>.

  • WeightsRange – A sized range type whose value type is Scalar.

  • Scalar – A scalar type, e.g. double or float.

Parameters:
  • range – Range to be used to calculate the covariance.

  • normalized_weights – Range with the normalized (total weight 1.0) weights of the samples in ‘range’.

  • mean – The previously calculated mean of range. The value must be correct for the resulting covariance to be correct.

Returns:

The calculated covariance, as a Sophus::Matrix2<Scalar>.