Accord.Math.ComplexMatrix.Range C# (CSharp) Method

Range() public static method

Gets the range of the magnitude values in a complex number vector.
public static Range ( this array ) : DoubleRange
array this A complex number vector.
return AForge.DoubleRange
        public static DoubleRange Range(this Complex[] array)
        {
            if (array == null)
                throw new ArgumentNullException("array");

            double min = array[0].Magnitude;
            double max = array[0].Magnitude;

            for (int i = 1; i < array.Length; i++)
            {
                double value = array[i].Magnitude;

                if (min > value)
                    min = value;
                if (max < value)
                    max = value;
            }

            return new DoubleRange(
                System.Math.Sqrt(min),
                System.Math.Sqrt(max));
        }