Static class Norm. Defines a set of extension methods defining norms measures.
Пример #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);
        }
Пример #2
0
        /// <summary>
        ///   Gets the Euclidean norm for a matrix.
        /// </summary>
        ///
        public static float[] Euclidean(this float[][] a, int dimension)
        {
            var norm = Norm.SquareEuclidean(a, dimension);

            for (int i = 0; i < norm.Length; i++)
            {
                norm[i] = (float)System.Math.Sqrt(norm[i]);
            }
            return(norm);
        }
Пример #3
0
        /// <summary>
        ///   Gets the Euclidean norm for a matrix.
        /// </summary>
        ///
        public static double[] Euclidean(this double[,] a, int dimension)
        {
            double[] norm = Norm.SquareEuclidean(a, dimension);

            for (int i = 0; i < norm.Length; i++)
            {
                norm[i] = System.Math.Sqrt(norm[i]);
            }

            return(norm);
        }