Last active
September 15, 2018 08:58
-
-
Save NMZivkovic/7100f6dea5fd745b42af3603ecf72930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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