Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Last active September 15, 2018 08:58
Show Gist options
  • Save NMZivkovic/7100f6dea5fd745b42af3603ecf72930 to your computer and use it in GitHub Desktop.
Save NMZivkovic/7100f6dea5fd745b42af3603ecf72930 to your computer and use it in GitHub Desktop.
public class Vector : List<double>, IVector
{
public double EuclidianDistance(IVector vector)
{
if (vector.Count != Count)
throw new ArgumentException("Not the same size");
return this.Select(x => Math.Pow(x - vector[this.IndexOf(x)], 2)).Sum();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment