public static double Norm(Vector v) { double norm = 0.0; for (int i = 0; i < v.x.Length; i++) { norm += v.x[i] * v.x[i]; } return norm; }
public static double Abs(Vector v) { double norm = 0.0; for (int i = 0; i < v.x.Length; i++) { norm += v.x[i] * v.x[i]; } return Math.Sqrt(norm); }
public static double Dot(Vector v1, Vector v2) { int D = Math.Min(v1.x.Length, v2.x.Length); double dot = 0.0; for (int i = 0; i < D; i++) { dot += v1.x[i] * v2.x[i]; } return dot; }
public Vector(Vector v) { v.x.CopyTo(this.x, 0); }