Accord.Math.Norm.SquareEuclidean C# (CSharp) Метод

SquareEuclidean() публичный статический Метод

Gets the Squared Euclidean norm for a matrix.
public static SquareEuclidean ( this a ) : double
a this
Результат double
        public static double SquareEuclidean(this double[,] a)
        {
            double sum = 0;
            foreach (var v in a)
                sum += v * v;
            return sum;
        }

Same methods

Norm::SquareEuclidean ( this a, int dimension ) : double[]
Norm::SquareEuclidean ( this a ) : float
Norm::SquareEuclidean ( this a, int dimension ) : float[]

Usage Example

Пример #1
0
        /// <summary>
        ///   Gets the Euclidean norm for a matrix.
        /// </summary>
        ///
        public static double[] Euclidean(this Sparse <double>[] a, int dimension)
        {
            var norm = Norm.SquareEuclidean(a, dimension);

            for (int i = 0; i < norm.Length; i++)
            {
                norm[i] = (double)System.Math.Sqrt(norm[i]);
            }
            return(norm);
        }
All Usage Examples Of Accord.Math.Norm::SquareEuclidean