コード例 #1
0
        public static void Reciprocal(IList <double> target)
        {
            if (target == null || target.Count == 0)
            {
                return;
            }

            for (int i = 0; i < target.Count; i++)
            {
                target[i] = Mathematics.Reciprocal(target[i]);
            }
        }
コード例 #2
0
        public static double GetNorm(IList <double> source, int level)
        {
            if (source == null || source.Count == 0 || level < 0)
            {
                return(double.NaN);
            }

            double powerSum = 0.0;

            foreach (double value in source)
            {
                powerSum += Math.Pow(value, level);
            }

            return(Mathematics.Root(powerSum, level));
        }