Class ComplexUtils


  • public class ComplexUtils
    extends java.lang.Object
    Static implementations of common Complex utilities functions.
    • Method Summary

      Modifier and Type Method Description
      static double[] abs​(Complex[] c)
      Returns double[] containing absolute values (magnitudes) of a Complex[] array.
      static double[] arg​(Complex[] c)
      Returns double[] containing arguments (phase angles) of a Complex[] array.
      static double[] complex2Imaginary​(Complex[] c)
      Converts imaginary part of a Complex[] array to a double[] array.
      static double[][] complex2Imaginary​(Complex[][] c)
      Converts imaginary component of a 2D Complex[][] array to a 2D double[][] array.
      static double[][][] complex2Imaginary​(Complex[][][] c)
      Converts imaginary component of a 3D Complex[][][] array to a 3D double[][][] array.
      static double[][][][] complex2Imaginary​(Complex[][][][] c)
      Converts imaginary component of a 4D Complex[][][][] array to a 4D double[][][][] array.
      static float[] complex2ImaginaryFloat​(Complex[] c)
      Converts imaginary component of a Complex[] array to a float[] array.
      static float[][] complex2ImaginaryFloat​(Complex[][] c)
      Converts imaginary component of a 2D Complex[][] array to a 2D float[][] array.
      static float[][][] complex2ImaginaryFloat​(Complex[][][] c)
      Converts imaginary component of a 3D Complex[][][] array to a 3D float[][][] array.
      static float[][][][] complex2ImaginaryFloat​(Complex[][][][] c)
      Converts imaginary component of a 4D Complex[][][][] array to a 4D float[][][][] array.
      static double[] complex2Interleaved​(Complex[] c)
      Converts a Complex[] array to an interleaved complex double[] array
      static double[][] complex2Interleaved​(Complex[][] c)
      Converts a 2D Complex[][] array to an interleaved complex double[][] array.
      static double[][][] complex2Interleaved​(Complex[][][] c)
      Converts a 3D Complex[][][] array to an interleaved complex double[][][] array.
      static double[][][][] complex2Interleaved​(Complex[][][][] c)
      Converts a 4D Complex[][][][] array to an interleaved complex double[][][][] array.
      static double[][][][] complex2Interleaved​(Complex[][][][] c, int interleavedDim)
      Converts a 4D Complex[][][][] array to an interleaved complex double[][][][] array.
      static double[][][] complex2Interleaved​(Complex[][][] c, int interleavedDim)
      Converts a 3D Complex[][][] array to an interleaved complex double[][][] array.
      static double[][] complex2Interleaved​(Complex[][] c, int interleavedDim)
      Converts a 2D Complex[][] array to an interleaved complex double[][] array.
      static float[] complex2InterleavedFloat​(Complex[] c)
      Converts a Complex[] array to an interleaved complex float[] array
      static float[][] complex2InterleavedFloat​(Complex[][] c)
      Converts a 2D Complex[][] array to an interleaved complex float[][] array.
      static float[][][] complex2InterleavedFloat​(Complex[][][] c)
      Converts a 3D Complex[][][] array to an interleaved complex float[][][] array.
      static float[][][] complex2InterleavedFloat​(Complex[][][] c, int interleavedDim)
      Converts a 3D Complex[][][] array to an interleaved complex float[][][] array.
      static float[][] complex2InterleavedFloat​(Complex[][] c, int interleavedDim)
      Converts a 2D Complex[][] array to an interleaved complex float[][] array.
      static double[] complex2Real​(Complex[] c)
      Converts real component of Complex[] array to a double[] array.
      static double[][] complex2Real​(Complex[][] c)
      Converts real component of a 2D Complex[][] array to a 2D double[][] array.
      static double[][][] complex2Real​(Complex[][][] c)
      Converts real component of a 3D Complex[][][] array to a 3D double[][][] array.
      static double[][][][] complex2Real​(Complex[][][][] c)
      Converts real component of a 4D Complex[][][][] array to a 4D double[][][][] array.
      static float[] complex2RealFloat​(Complex[] c)
      Converts real component of Complex[] array to a float[] array.
      static float[][] complex2RealFloat​(Complex[][] c)
      Converts real component of a 2D Complex[][] array to a 2D float[][] array.
      static float[][][] complex2RealFloat​(Complex[][][] c)
      Converts real component of a 3D Complex[][][] array to a 3D float[][][] array.
      static float[][][][] complex2RealFloat​(Complex[][][][] c)
      Converts real component of a 4D Complex[][][][] array to a 4D float[][][][] array.
      static Complex extractComplexFromImaginaryArray​(double[] imaginary, int index)
      Returns double from array imaginary[] at entry index as a Complex.
      static Complex extractComplexFromImaginaryArray​(float[] imaginary, int index)
      Returns float from array imaginary[] at entry index as a Complex.
      static Complex extractComplexFromInterleavedArray​(double[] d, int index)
      Returns a Complex object from interleaved double[] array at entry index.
      static Complex extractComplexFromInterleavedArray​(float[] f, int index)
      Returns a Complex object from interleaved float[] array at entry index.
      static Complex extractComplexFromRealArray​(double[] real, int index)
      Returns double from array real[] at entry index as a Complex.
      static Complex extractComplexFromRealArray​(float[] real, int index)
      Returns float from array real[] at entry index as a Complex.
      static float extractImaginaryFloatFromComplexArray​(Complex[] complex, int index)
      Returns imaginary component of array Complex[] at entry index as a float.
      static double extractImaginaryFromComplexArray​(Complex[] complex, int index)
      Returns imaginary component of Complex from array Complex[] at entry index as a double.
      static float[] extractInterleavedFloatFromComplexArray​(Complex[] complex, int index)
      Returns Complex object from array Complex[] at entry index as a size 2 float of the form {real, imag}.
      static double[] extractInterleavedFromComplexArray​(Complex[] complex, int index)
      Returns values of Complex object from array Complex[] at entry index as a size 2 double of the form {real, imag}.
      static float extractRealFloatFromComplexArray​(Complex[] complex, int index)
      Returns real component of array Complex[] at entry index as a float.
      static double extractRealFromComplexArray​(Complex[] complex, int index)
      Returns real component of Complex from array Complex[] at entry index as a double.
      static Complex[] imaginary2Complex​(double[] imaginary)
      Converts a double[] array to an imaginary Complex[] array.
      static Complex[][] imaginary2Complex​(double[][] i)
      Converts a 2D imaginary array double[][] to a 2D Complex[][] array.
      static Complex[][][] imaginary2Complex​(double[][][] i)
      Converts a 3D imaginary array double[][][] to a Complex[] array.
      static Complex[][][][] imaginary2Complex​(double[][][][] i)
      Converts a 4D imaginary array double[][][][] to a 4D Complex[][][][] array.
      static Complex[] imaginary2Complex​(float[] imaginary)
      Converts a float[] array to an imaginary Complex[] array.
      static Complex[] initialize​(Complex[] c)
      Initializes a Complex[] array to zero, to avoid NullPointerExceptions.
      static Complex[][] initialize​(Complex[][] c)
      Initializes a Complex[][] array to zero, to avoid NullPointerExceptions.
      static Complex[][][] initialize​(Complex[][][] c)
      Initializes a Complex[][][] array to zero, to avoid NullPointerExceptions.
      static Complex[] interleaved2Complex​(double[] interleaved)
      Converts a complex interleaved double[] array to a Complex[] array
      static Complex[][] interleaved2Complex​(double[][] d)
      Converts a 2D interleaved complex double[][] array to a Complex[][] array.
      static Complex[][][] interleaved2Complex​(double[][][] d)
      Converts a 3D interleaved complex double[][][] array to a Complex[][][] array.
      static Complex[][][][] interleaved2Complex​(double[][][][] i, int interleavedDim)
      Converts a 4D interleaved complex double[][][][] array to a Complex[][][][] array.
      static Complex[][][] interleaved2Complex​(double[][][] i, int interleavedDim)
      Converts a 3D interleaved complex double[][][] array to a Complex[][][] array.
      static Complex[][] interleaved2Complex​(double[][] i, int interleavedDim)
      Converts a 2D interleaved complex double[][] array to a Complex[][] array.
      static Complex[] interleaved2Complex​(float[] interleaved)
      Converts a complex interleaved float[] array to a Complex[] array
      static Complex[][] interleaved2Complex​(float[][] d)
      Converts a 2D interleaved complex float[][] array to a Complex[][] array.
      static Complex[][][] interleaved2Complex​(float[][][] d)
      Converts a 3D interleaved complex float[][][] array to a Complex[] array.
      static Complex[][][] interleaved2Complex​(float[][][] i, int interleavedDim)
      Converts a 3D interleaved complex float[][][] array to a Complex[][][] array.
      static Complex[][] interleaved2Complex​(float[][] i, int interleavedDim)
      Converts a 2D interleaved complex float[][] array to a Complex[][] array.
      static Complex[][][] polar2Complex​(double[][][] r, double[][][] theta)
      Creates Complex[][][] array given double[][][] arrays of r and theta.
      static Complex[][] polar2Complex​(double[][] r, double[][] theta)
      Creates Complex[][] array given double[][] arrays of r and theta.
      static Complex[] polar2Complex​(double[] r, double[] theta)
      Creates Complex[] array given double[] arrays of r and theta.
      static Complex polar2Complex​(double r, double theta)
      Creates a complex number from the given polar representation.
      static Complex[] real2Complex​(double[] real)
      Converts a double[] array to a Complex[] array.
      static Complex[][] real2Complex​(double[][] d)
      Converts a 2D real double[][] array to a 2D Complex[][] array.
      static Complex[][][] real2Complex​(double[][][] d)
      Converts a 3D real double[][][] array to a Complex [][][] array.
      static Complex[][][][] real2Complex​(double[][][][] d)
      Converts a 4D real double[][][][] array to a Complex [][][][] array.
      static Complex[] real2Complex​(float[] real)
      Converts a float[] array to a Complex[] array.
      static Complex[][] real2Complex​(float[][] d)
      Converts a 2D real float[][] array to a 2D Complex[][] array.
      static Complex[][][] real2Complex​(float[][][] d)
      Converts a 3D real float[][][] array to a Complex [][][] array.
      static Complex[][][][] split2Complex​(double[][][][] real, double[][][][] imag)
      Converts a 4D split complex array double[][][][] r, double[][][][] i to a 4D Complex[][][][] array.
      static Complex[][][] split2Complex​(double[][][] real, double[][][] imag)
      Converts a 3D split complex array double[][][] r, double[][][] i to a 3D Complex[][][] array.
      static Complex[][] split2Complex​(double[][] real, double[][] imag)
      Converts a 2D split complex array double[][] r, double[][] i to a 2D Complex[][] array.
      static Complex[] split2Complex​(double[] real, double[] imag)
      Converts a split complex array double[] r, double[] i to a Complex[] array.
      static Complex[][][] split2Complex​(float[][][] real, float[][][] imag)
      Converts a 3D split complex array float[][][] r, float[][][] i to a 3D Complex[][][] array.
      static Complex[][] split2Complex​(float[][] real, float[][] imag)
      Converts a 2D split complex array float[][] r, float[][] i to a 2D Complex[][] array.
      static Complex[] split2Complex​(float[] real, float[] imag)
      Converts a split complex array float[] r, float[] i to a Complex[] array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • polar2Complex

        public static Complex polar2Complex​(double r,
                                            double theta)
        Creates a complex number from the given polar representation.

        If either r or theta is NaN, or theta is infinite, Complex.NAN is returned.

        If r is infinite and theta is finite, infinite or NaN values may be returned in parts of the result, following the rules for double arithmetic. Examples:

         
         polar2Complex(INFINITY, \(\pi\)) = INFINITY + INFINITY i
         polar2Complex(INFINITY, 0) = INFINITY + NaN i
         polar2Complex(INFINITY, \(-\frac{\pi}{4}\)) = INFINITY - INFINITY i
         polar2Complex(INFINITY, \(5\frac{\pi}{4}\)) = -INFINITY - INFINITY i 
         
        Parameters:
        r - the modulus of the complex number to create
        theta - the argument of the complex number to create
        Returns:
        Complex
      • polar2Complex

        public static Complex[] polar2Complex​(double[] r,
                                              double[] theta)
        Creates Complex[] array given double[] arrays of r and theta.
        Parameters:
        r - double[] of moduli
        theta - double[] of arguments
        Returns:
        Complex[]
      • polar2Complex

        public static Complex[][] polar2Complex​(double[][] r,
                                                double[][] theta)
        Creates Complex[][] array given double[][] arrays of r and theta.
        Parameters:
        r - double[] of moduli
        theta - double[] of arguments
        Returns:
        Complex[][]
      • polar2Complex

        public static Complex[][][] polar2Complex​(double[][][] r,
                                                  double[][][] theta)
        Creates Complex[][][] array given double[][][] arrays of r and theta.
        Parameters:
        r - array of moduli
        theta - array of arguments
        Returns:
        Complex
      • extractComplexFromRealArray

        public static Complex extractComplexFromRealArray​(double[] real,
                                                          int index)
        Returns double from array real[] at entry index as a Complex.
        Parameters:
        real - array of real numbers
        index - location in the array
        Returns:
        Complex.
      • extractComplexFromRealArray

        public static Complex extractComplexFromRealArray​(float[] real,
                                                          int index)
        Returns float from array real[] at entry index as a Complex.
        Parameters:
        real - array of real numbers
        index - location in the array
        Returns:
        Complex array
      • extractComplexFromImaginaryArray

        public static Complex extractComplexFromImaginaryArray​(double[] imaginary,
                                                               int index)
        Returns double from array imaginary[] at entry index as a Complex.
        Parameters:
        imaginary - array of imaginary numbers
        index - location in the array
        Returns:
        Complex array
      • extractComplexFromImaginaryArray

        public static Complex extractComplexFromImaginaryArray​(float[] imaginary,
                                                               int index)
        Returns float from array imaginary[] at entry index as a Complex.
        Parameters:
        imaginary - array of imaginary numbers
        index - location in the array
        Returns:
        Complex array
      • extractRealFromComplexArray

        public static double extractRealFromComplexArray​(Complex[] complex,
                                                         int index)
        Returns real component of Complex from array Complex[] at entry index as a double.
        Parameters:
        complex - array of complex numbers
        index - location in the array
        Returns:
        double.
      • extractRealFloatFromComplexArray

        public static float extractRealFloatFromComplexArray​(Complex[] complex,
                                                             int index)
        Returns real component of array Complex[] at entry index as a float.
        Parameters:
        complex - array of complex numbers
        index - location in the array
        Returns:
        float.
      • extractImaginaryFromComplexArray

        public static double extractImaginaryFromComplexArray​(Complex[] complex,
                                                              int index)
        Returns imaginary component of Complex from array Complex[] at entry index as a double.
        Parameters:
        complex - array of complex numbers
        index - location in the array
        Returns:
        double.
      • extractImaginaryFloatFromComplexArray

        public static float extractImaginaryFloatFromComplexArray​(Complex[] complex,
                                                                  int index)
        Returns imaginary component of array Complex[] at entry index as a float.
        Parameters:
        complex - array of complex numbers
        index - location in the array
        Returns:
        float.
      • extractComplexFromInterleavedArray

        public static Complex extractComplexFromInterleavedArray​(double[] d,
                                                                 int index)
        Returns a Complex object from interleaved double[] array at entry index.
        Parameters:
        d - array of interleaved complex numbers alternating real and imaginary values
        index - location in the array This is the location by complex number, e.g. index number 5 in the array will return Complex.ofCartesian(d[10], d[11])
        Returns:
        Complex.
      • extractComplexFromInterleavedArray

        public static Complex extractComplexFromInterleavedArray​(float[] f,
                                                                 int index)
        Returns a Complex object from interleaved float[] array at entry index.
        Parameters:
        f - float array of interleaved complex numbers alternating real and imaginary values
        index - location in the array This is the location by complex number, e.g. index number 5 in the float[] array will return new Complex(d[10], d[11])
        Returns:
        Complex.
      • extractInterleavedFromComplexArray

        public static double[] extractInterleavedFromComplexArray​(Complex[] complex,
                                                                  int index)
        Returns values of Complex object from array Complex[] at entry index as a size 2 double of the form {real, imag}.
        Parameters:
        complex - array of complex numbers
        index - location in the array
        Returns:
        size 2 array.
      • extractInterleavedFloatFromComplexArray

        public static float[] extractInterleavedFloatFromComplexArray​(Complex[] complex,
                                                                      int index)
        Returns Complex object from array Complex[] at entry index as a size 2 float of the form {real, imag}.
        Parameters:
        complex - Complex array
        index - location in the array
        Returns:
        size 2 float[].
      • real2Complex

        public static Complex[] real2Complex​(double[] real)
        Converts a double[] array to a Complex[] array.
        Parameters:
        real - array of numbers to be converted to their Complex equivalent
        Returns:
        Complex array
      • real2Complex

        public static Complex[] real2Complex​(float[] real)
        Converts a float[] array to a Complex[] array.
        Parameters:
        real - array of numbers to be converted to their Complex equivalent
        Returns:
        Complex array
      • real2Complex

        public static Complex[][] real2Complex​(double[][] d)
        Converts a 2D real double[][] array to a 2D Complex[][] array.
        Parameters:
        d - 2D array
        Returns:
        2D Complex array
      • real2Complex

        public static Complex[][] real2Complex​(float[][] d)
        Converts a 2D real float[][] array to a 2D Complex[][] array.
        Parameters:
        d - 2D array
        Returns:
        2D Complex array
      • real2Complex

        public static Complex[][][] real2Complex​(double[][][] d)
        Converts a 3D real double[][][] array to a Complex [][][] array.
        Parameters:
        d - 3D complex interleaved array
        Returns:
        3D Complex array
      • real2Complex

        public static Complex[][][] real2Complex​(float[][][] d)
        Converts a 3D real float[][][] array to a Complex [][][] array.
        Parameters:
        d - 3D complex interleaved array
        Returns:
        3D Complex array
      • real2Complex

        public static Complex[][][][] real2Complex​(double[][][][] d)
        Converts a 4D real double[][][][] array to a Complex [][][][] array.
        Parameters:
        d - 4D complex interleaved array
        Returns:
        4D Complex array
      • complex2Real

        public static double[] complex2Real​(Complex[] c)
        Converts real component of Complex[] array to a double[] array.
        Parameters:
        c - Complex array
        Returns:
        array of the real component
      • complex2RealFloat

        public static float[] complex2RealFloat​(Complex[] c)
        Converts real component of Complex[] array to a float[] array.
        Parameters:
        c - Complex array
        Returns:
        float[] array of the real component
      • complex2Real

        public static double[][] complex2Real​(Complex[][] c)
        Converts real component of a 2D Complex[][] array to a 2D double[][] array.
        Parameters:
        c - 2D Complex array
        Returns:
        double[][] of real component
      • complex2RealFloat

        public static float[][] complex2RealFloat​(Complex[][] c)
        Converts real component of a 2D Complex[][] array to a 2D float[][] array.
        Parameters:
        c - 2D Complex array
        Returns:
        float[][] of real component
      • complex2Real

        public static double[][][] complex2Real​(Complex[][][] c)
        Converts real component of a 3D Complex[][][] array to a 3D double[][][] array.
        Parameters:
        c - 3D complex interleaved array
        Returns:
        array of real component
      • complex2RealFloat

        public static float[][][] complex2RealFloat​(Complex[][][] c)
        Converts real component of a 3D Complex[][][] array to a 3D float[][][] array.
        Parameters:
        c - 3D Complex array
        Returns:
        float[][][] of real component
      • complex2Real

        public static double[][][][] complex2Real​(Complex[][][][] c)
        Converts real component of a 4D Complex[][][][] array to a 4D double[][][][] array.
        Parameters:
        c - 4D complex interleaved array
        Returns:
        array of real component
      • complex2RealFloat

        public static float[][][][] complex2RealFloat​(Complex[][][][] c)
        Converts real component of a 4D Complex[][][][] array to a 4D float[][][][] array.
        Parameters:
        c - 4D Complex array
        Returns:
        float[][][][] of real component
      • imaginary2Complex

        public static Complex[] imaginary2Complex​(double[] imaginary)
        Converts a double[] array to an imaginary Complex[] array.
        Parameters:
        imaginary - array of numbers to be converted to their Complex equivalent
        Returns:
        Complex array
      • imaginary2Complex

        public static Complex[] imaginary2Complex​(float[] imaginary)
        Converts a float[] array to an imaginary Complex[] array.
        Parameters:
        imaginary - array of numbers to be converted to their Complex equivalent
        Returns:
        Complex array
      • imaginary2Complex

        public static Complex[][] imaginary2Complex​(double[][] i)
        Converts a 2D imaginary array double[][] to a 2D Complex[][] array.
        Parameters:
        i - 2D array
        Returns:
        2D Complex array
      • imaginary2Complex

        public static Complex[][][] imaginary2Complex​(double[][][] i)
        Converts a 3D imaginary array double[][][] to a Complex[] array.
        Parameters:
        i - 3D complex imaginary array
        Returns:
        3D Complex array
      • imaginary2Complex

        public static Complex[][][][] imaginary2Complex​(double[][][][] i)
        Converts a 4D imaginary array double[][][][] to a 4D Complex[][][][] array.
        Parameters:
        i - 4D complex imaginary array
        Returns:
        4D Complex array
      • complex2Imaginary

        public static double[] complex2Imaginary​(Complex[] c)
        Converts imaginary part of a Complex[] array to a double[] array.
        Parameters:
        c - Complex array.
        Returns:
        array of the imaginary component
      • complex2ImaginaryFloat

        public static float[] complex2ImaginaryFloat​(Complex[] c)
        Converts imaginary component of a Complex[] array to a float[] array.
        Parameters:
        c - Complex array.
        Returns:
        float[] array of the imaginary component
      • complex2Imaginary

        public static double[][] complex2Imaginary​(Complex[][] c)
        Converts imaginary component of a 2D Complex[][] array to a 2D double[][] array.
        Parameters:
        c - 2D Complex array
        Returns:
        double[][] of imaginary component
      • complex2ImaginaryFloat

        public static float[][] complex2ImaginaryFloat​(Complex[][] c)
        Converts imaginary component of a 2D Complex[][] array to a 2D float[][] array.
        Parameters:
        c - 2D Complex array
        Returns:
        float[][] of imaginary component
      • complex2Imaginary

        public static double[][][] complex2Imaginary​(Complex[][][] c)
        Converts imaginary component of a 3D Complex[][][] array to a 3D double[][][] array.
        Parameters:
        c - 3D complex interleaved array
        Returns:
        3D Complex array
      • complex2ImaginaryFloat

        public static float[][][] complex2ImaginaryFloat​(Complex[][][] c)
        Converts imaginary component of a 3D Complex[][][] array to a 3D float[][][] array.
        Parameters:
        c - 3D Complex array
        Returns:
        float[][][] of imaginary component
      • complex2Imaginary

        public static double[][][][] complex2Imaginary​(Complex[][][][] c)
        Converts imaginary component of a 4D Complex[][][][] array to a 4D double[][][][] array.
        Parameters:
        c - 4D complex interleaved array
        Returns:
        4D Complex array
      • complex2ImaginaryFloat

        public static float[][][][] complex2ImaginaryFloat​(Complex[][][][] c)
        Converts imaginary component of a 4D Complex[][][][] array to a 4D float[][][][] array.
        Parameters:
        c - 4D Complex array
        Returns:
        float[][][][] of imaginary component
      • interleaved2Complex

        public static Complex[] interleaved2Complex​(double[] interleaved)
        Converts a complex interleaved double[] array to a Complex[] array
        Parameters:
        interleaved - array of numbers to be converted to their Complex equivalent
        Returns:
        Complex array
      • interleaved2Complex

        public static Complex[] interleaved2Complex​(float[] interleaved)
        Converts a complex interleaved float[] array to a Complex[] array
        Parameters:
        interleaved - float[] array of numbers to be converted to their Complex equivalent
        Returns:
        Complex array
      • complex2Interleaved

        public static double[] complex2Interleaved​(Complex[] c)
        Converts a Complex[] array to an interleaved complex double[] array
        Parameters:
        c - Complex array
        Returns:
        complex interleaved array alternating real and imaginary values
      • complex2InterleavedFloat

        public static float[] complex2InterleavedFloat​(Complex[] c)
        Converts a Complex[] array to an interleaved complex float[] array
        Parameters:
        c - Complex array
        Returns:
        complex interleaved float[] alternating real and imaginary values
      • complex2Interleaved

        public static double[][] complex2Interleaved​(Complex[][] c,
                                                     int interleavedDim)
        Converts a 2D Complex[][] array to an interleaved complex double[][] array.
        Parameters:
        c - 2D Complex array
        interleavedDim - Depth level of the array to interleave
        Returns:
        complex interleaved array alternating real and imaginary values
      • complex2Interleaved

        public static double[][] complex2Interleaved​(Complex[][] c)
        Converts a 2D Complex[][] array to an interleaved complex double[][] array. The second d level of the array is assumed to be interleaved.
        Parameters:
        c - 2D Complex array
        Returns:
        complex interleaved array alternating real and imaginary values
      • complex2Interleaved

        public static double[][][] complex2Interleaved​(Complex[][][] c,
                                                       int interleavedDim)
        Converts a 3D Complex[][][] array to an interleaved complex double[][][] array.
        Parameters:
        c - 3D Complex array
        interleavedDim - Depth level of the array to interleave
        Returns:
        complex interleaved array alternating real and imaginary values
      • complex2Interleaved

        public static double[][][][] complex2Interleaved​(Complex[][][][] c,
                                                         int interleavedDim)
        Converts a 4D Complex[][][][] array to an interleaved complex double[][][][] array.
        Parameters:
        c - 4D Complex array
        interleavedDim - Depth level of the array to interleave
        Returns:
        complex interleaved array alternating real and imaginary values
      • complex2Interleaved

        public static double[][][] complex2Interleaved​(Complex[][][] c)
        Converts a 3D Complex[][][] array to an interleaved complex double[][][] array. The third level of the array is interleaved.
        Parameters:
        c - 3D Complex array
        Returns:
        complex interleaved array alternating real and imaginary values
      • complex2Interleaved

        public static double[][][][] complex2Interleaved​(Complex[][][][] c)
        Converts a 4D Complex[][][][] array to an interleaved complex double[][][][] array. The fourth level of the array is interleaved.
        Parameters:
        c - 4D Complex array
        Returns:
        complex interleaved array alternating real and imaginary values
      • complex2InterleavedFloat

        public static float[][] complex2InterleavedFloat​(Complex[][] c,
                                                         int interleavedDim)
        Converts a 2D Complex[][] array to an interleaved complex float[][] array.
        Parameters:
        c - 2D Complex array
        interleavedDim - Depth level of the array to interleave
        Returns:
        complex interleaved float[][] alternating real and imaginary values
      • complex2InterleavedFloat

        public static float[][] complex2InterleavedFloat​(Complex[][] c)
        Converts a 2D Complex[][] array to an interleaved complex float[][] array. The second d level of the array is assumed to be interleaved.
        Parameters:
        c - 2D Complex array
        Returns:
        complex interleaved float[][] alternating real and imaginary values
      • complex2InterleavedFloat

        public static float[][][] complex2InterleavedFloat​(Complex[][][] c,
                                                           int interleavedDim)
        Converts a 3D Complex[][][] array to an interleaved complex float[][][] array.
        Parameters:
        c - 3D Complex array
        interleavedDim - Depth level of the array to interleave
        Returns:
        complex interleaved float[][][] alternating real and imaginary values
      • complex2InterleavedFloat

        public static float[][][] complex2InterleavedFloat​(Complex[][][] c)
        Converts a 3D Complex[][][] array to an interleaved complex float[][][] array. The third d level of the array is interleaved.
        Parameters:
        c - 2D Complex array
        Returns:
        complex interleaved float[][][] alternating real and imaginary values
      • interleaved2Complex

        public static Complex[][] interleaved2Complex​(double[][] i,
                                                      int interleavedDim)
        Converts a 2D interleaved complex double[][] array to a Complex[][] array.
        Parameters:
        i - 2D complex interleaved array
        interleavedDim - Depth level of the array to interleave
        Returns:
        2D Complex array
      • interleaved2Complex

        public static Complex[][] interleaved2Complex​(double[][] d)
        Converts a 2D interleaved complex double[][] array to a Complex[][] array. The second d level of the array is assumed to be interleaved.
        Parameters:
        d - 2D complex interleaved array
        Returns:
        2D Complex array
      • interleaved2Complex

        public static Complex[][][] interleaved2Complex​(double[][][] i,
                                                        int interleavedDim)
        Converts a 3D interleaved complex double[][][] array to a Complex[][][] array.
        Parameters:
        i - 3D complex interleaved array
        interleavedDim - Depth level of the array to interleave
        Returns:
        3D Complex array
      • interleaved2Complex

        public static Complex[][][][] interleaved2Complex​(double[][][][] i,
                                                          int interleavedDim)
        Converts a 4D interleaved complex double[][][][] array to a Complex[][][][] array.
        Parameters:
        i - 4D complex interleaved array
        interleavedDim - Depth level of the array to interleave
        Returns:
        4D Complex array
      • interleaved2Complex

        public static Complex[][][] interleaved2Complex​(double[][][] d)
        Converts a 3D interleaved complex double[][][] array to a Complex[][][] array. The third d level is assumed to be interleaved.
        Parameters:
        d - 3D complex interleaved array
        Returns:
        3D Complex array
      • interleaved2Complex

        public static Complex[][] interleaved2Complex​(float[][] i,
                                                      int interleavedDim)
        Converts a 2D interleaved complex float[][] array to a Complex[][] array.
        Parameters:
        i - 2D complex interleaved float array
        interleavedDim - Depth level of the array to interleave
        Returns:
        2D Complex array
      • interleaved2Complex

        public static Complex[][] interleaved2Complex​(float[][] d)
        Converts a 2D interleaved complex float[][] array to a Complex[][] array. The second d level of the array is assumed to be interleaved.
        Parameters:
        d - 2D complex interleaved float array
        Returns:
        2D Complex array
      • interleaved2Complex

        public static Complex[][][] interleaved2Complex​(float[][][] i,
                                                        int interleavedDim)
        Converts a 3D interleaved complex float[][][] array to a Complex[][][] array.
        Parameters:
        i - 3D complex interleaved float array
        interleavedDim - Depth level of the array to interleave
        Returns:
        3D Complex array
      • interleaved2Complex

        public static Complex[][][] interleaved2Complex​(float[][][] d)
        Converts a 3D interleaved complex float[][][] array to a Complex[] array. The third level of the array is assumed to be interleaved.
        Parameters:
        d - 3D complex interleaved float array
        Returns:
        3D Complex array
      • split2Complex

        public static Complex[] split2Complex​(double[] real,
                                              double[] imag)
        Converts a split complex array double[] r, double[] i to a Complex[] array.
        Parameters:
        real - real component
        imag - imaginary component
        Returns:
        Complex array
      • split2Complex

        public static Complex[][] split2Complex​(double[][] real,
                                                double[][] imag)
        Converts a 2D split complex array double[][] r, double[][] i to a 2D Complex[][] array.
        Parameters:
        real - real component
        imag - imaginary component
        Returns:
        2D Complex array
      • split2Complex

        public static Complex[][][] split2Complex​(double[][][] real,
                                                  double[][][] imag)
        Converts a 3D split complex array double[][][] r, double[][][] i to a 3D Complex[][][] array.
        Parameters:
        real - real component
        imag - imaginary component
        Returns:
        3D Complex array
      • split2Complex

        public static Complex[][][][] split2Complex​(double[][][][] real,
                                                    double[][][][] imag)
        Converts a 4D split complex array double[][][][] r, double[][][][] i to a 4D Complex[][][][] array.
        Parameters:
        real - real component
        imag - imaginary component
        Returns:
        4D Complex array
      • split2Complex

        public static Complex[] split2Complex​(float[] real,
                                              float[] imag)
        Converts a split complex array float[] r, float[] i to a Complex[] array.
        Parameters:
        real - real component
        imag - imaginary component
        Returns:
        Complex array
      • split2Complex

        public static Complex[][] split2Complex​(float[][] real,
                                                float[][] imag)
        Converts a 2D split complex array float[][] r, float[][] i to a 2D Complex[][] array.
        Parameters:
        real - real component
        imag - imaginary component
        Returns:
        2D Complex array
      • split2Complex

        public static Complex[][][] split2Complex​(float[][][] real,
                                                  float[][][] imag)
        Converts a 3D split complex array float[][][] r, float[][][] i to a 3D Complex[][][] array.
        Parameters:
        real - real component
        imag - imaginary component
        Returns:
        3D Complex array
      • initialize

        public static Complex[] initialize​(Complex[] c)
        Initializes a Complex[] array to zero, to avoid NullPointerExceptions.
        Parameters:
        c - Complex array
        Returns:
        c
      • initialize

        public static Complex[][] initialize​(Complex[][] c)
        Initializes a Complex[][] array to zero, to avoid NullPointerExceptions.
        Parameters:
        c - Complex array
        Returns:
        c
      • initialize

        public static Complex[][][] initialize​(Complex[][][] c)
        Initializes a Complex[][][] array to zero, to avoid NullPointerExceptions.
        Parameters:
        c - Complex array
        Returns:
        c
      • abs

        public static double[] abs​(Complex[] c)
        Returns double[] containing absolute values (magnitudes) of a Complex[] array.
        Parameters:
        c - Complex array
        Returns:
        double[]
      • arg

        public static double[] arg​(Complex[] c)
        Returns double[] containing arguments (phase angles) of a Complex[] array.
        Parameters:
        c - Complex array
        Returns:
        double[] array