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

ToArray() public static method

Converts a complex number to a matrix of scalar values in which the first column contains the real values and the second column contains the imaginary values.
public static ToArray ( this c ) : ].double[
c this An array of complex numbers.
return ].double[
        public static double[,] ToArray(this Complex[] c)
        {
            if (c == null)
                throw new ArgumentNullException("c");

            double[,] arr = new double[c.Length, 2];
            for (int i = 0; i < c.GetLength(0); i++)
            {
                arr[i, 0] = c[i].Real;
                arr[i, 1] = c[i].Imaginary;
            }

            return arr;
        }