Пример #1
0
 public void Add(double value, T data)
 {
     ++m_count;
     m_sum.Add(value);
     if ((m_options & StatsOptions.Min) != 0)
     {
         m_min.AddMin(value, data);
     }
     if ((m_options & StatsOptions.Max) != 0)
     {
         m_max.AddMax(value, data);
     }
     if ((m_options & StatsOptions.NeedsSumOfSquares) != 0)
     {
         m_sumOfSquares.Add(Fun.Square(value));
     }
 }
 public static float Dist2Squared(this Vector <float> v0, Vector <float> v1)
 => v0.InnerProduct(v1, (x0, x1) => Fun.Square(x1 - x0), 0.0f, (s, p) => s + p);
Пример #3
0
 /// <summary>
 /// Returns the Euclidean (or 2-) distance between two matrices.
 /// </summary>
 public static __ctype__ Distance2(__nmtype__ a, __nmtype__ b)
 {
     return /*# if (ctype != "double") {*/ ((__ctype__)/*# } */ Fun.Sqrt(/*# n.ForEach(i => { m.ForEach(j => { */
                                                Fun.Square(b.M__i____j__ - a.M__i____j__) /*# }, add); }, add); */));
 }
 public static double Dist2Squared(this Vector <double> v0, Vector <double> v1)
 => v0.InnerProduct(v1, (x0, x1) => Fun.Square(x1 - x0), 0.0, (s, p) => s + p);
 public static __ft__ Dist2Squared(this Vector <__ft__> v0, Vector <__ft__> v1)
 => v0.InnerProduct(v1, (x0, x1) => Fun.Square(x1 - x0), __zero__, (s, p) => s + p);