|
@@ -104,9 +104,13 @@ namespace bbiwarg.Utility
|
|
|
}
|
|
|
}
|
|
|
public T norm()
|
|
|
+ {
|
|
|
+ return subNorm(elements.Length);
|
|
|
+ }
|
|
|
+ public T subNorm(int subLength)
|
|
|
{
|
|
|
T result = (dynamic)0;
|
|
|
- for (int i = 0; i < elements.Length; i++)
|
|
|
+ for (int i = 0; i < subLength; i++)
|
|
|
{
|
|
|
result += (dynamic)elements[i] * elements[i];
|
|
|
}
|
|
@@ -117,6 +121,11 @@ namespace bbiwarg.Utility
|
|
|
return (vector - this).norm();
|
|
|
}
|
|
|
|
|
|
+ public T subDistance(Vector<T> vector, int subLength) {
|
|
|
+ return (vector - this).subNorm(subLength);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private static void checkLength(Vector<T> vector1, Vector<T> vector2)
|
|
|
{
|
|
|
if (vector1.length() != vector2.length())
|