Function pecsim::distance

Function Documentation

double pecsim::distance(const std::vector<double> &p1, const std::vector<double> &p2)

Computes the Euclidean distance between two points in n-dimensional space.

Parameters:
  • p1 – the first point as a vector of doubles

  • p2 – the second point as a vector of doubles

Throws:

std::runtime_error – if the vectors are not of the same size

Returns:

double the Euclidean distance between p1 and p2