Beispiel #1
0
 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;
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
 public Vector(Vector v)
 {
     v.x.CopyTo(this.x, 0);
 }