Class ComplexUtils
- java.lang.Object
-
- org.apache.commons.numbers.complex.streams.ComplexUtils
-
public class ComplexUtils extends java.lang.ObjectStatic implementations of commonComplexutilities functions.
-
-
Method Summary
Modifier and Type Method Description static double[]abs(Complex[] c)Returnsdouble[]containing absolute values (magnitudes) of aComplex[]array.static double[]arg(Complex[] c)Returnsdouble[]containing arguments (phase angles) of aComplex[]array.static double[]complex2Imaginary(Complex[] c)Converts imaginary part of aComplex[]array to adouble[]array.static double[][]complex2Imaginary(Complex[][] c)Converts imaginary component of a 2DComplex[][]array to a 2Ddouble[][]array.static double[][][]complex2Imaginary(Complex[][][] c)Converts imaginary component of a 3DComplex[][][]array to a 3Ddouble[][][]array.static double[][][][]complex2Imaginary(Complex[][][][] c)Converts imaginary component of a 4DComplex[][][][]array to a 4Ddouble[][][][]array.static float[]complex2ImaginaryFloat(Complex[] c)Converts imaginary component of aComplex[]array to afloat[]array.static float[][]complex2ImaginaryFloat(Complex[][] c)Converts imaginary component of a 2DComplex[][]array to a 2Dfloat[][]array.static float[][][]complex2ImaginaryFloat(Complex[][][] c)Converts imaginary component of a 3DComplex[][][]array to a 3Dfloat[][][]array.static float[][][][]complex2ImaginaryFloat(Complex[][][][] c)Converts imaginary component of a 4DComplex[][][][]array to a 4Dfloat[][][][]array.static double[]complex2Interleaved(Complex[] c)Converts aComplex[]array to an interleaved complexdouble[]arraystatic double[][]complex2Interleaved(Complex[][] c)Converts a 2DComplex[][]array to an interleaved complexdouble[][]array.static double[][][]complex2Interleaved(Complex[][][] c)Converts a 3DComplex[][][]array to an interleaved complexdouble[][][]array.static double[][][][]complex2Interleaved(Complex[][][][] c)Converts a 4DComplex[][][][]array to an interleaved complexdouble[][][][]array.static double[][][][]complex2Interleaved(Complex[][][][] c, int interleavedDim)Converts a 4DComplex[][][][]array to an interleaved complexdouble[][][][]array.static double[][][]complex2Interleaved(Complex[][][] c, int interleavedDim)Converts a 3DComplex[][][]array to an interleaved complexdouble[][][]array.static double[][]complex2Interleaved(Complex[][] c, int interleavedDim)Converts a 2DComplex[][]array to an interleaved complexdouble[][]array.static float[]complex2InterleavedFloat(Complex[] c)Converts aComplex[]array to an interleaved complexfloat[]arraystatic float[][]complex2InterleavedFloat(Complex[][] c)Converts a 2DComplex[][]array to an interleaved complexfloat[][]array.static float[][][]complex2InterleavedFloat(Complex[][][] c)Converts a 3DComplex[][][]array to an interleaved complexfloat[][][]array.static float[][][]complex2InterleavedFloat(Complex[][][] c, int interleavedDim)Converts a 3DComplex[][][]array to an interleaved complexfloat[][][]array.static float[][]complex2InterleavedFloat(Complex[][] c, int interleavedDim)Converts a 2DComplex[][]array to an interleaved complexfloat[][]array.static double[]complex2Real(Complex[] c)Converts real component ofComplex[]array to adouble[]array.static double[][]complex2Real(Complex[][] c)Converts real component of a 2DComplex[][]array to a 2Ddouble[][]array.static double[][][]complex2Real(Complex[][][] c)Converts real component of a 3DComplex[][][]array to a 3Ddouble[][][]array.static double[][][][]complex2Real(Complex[][][][] c)Converts real component of a 4DComplex[][][][]array to a 4Ddouble[][][][]array.static float[]complex2RealFloat(Complex[] c)Converts real component ofComplex[]array to afloat[]array.static float[][]complex2RealFloat(Complex[][] c)Converts real component of a 2DComplex[][]array to a 2Dfloat[][]array.static float[][][]complex2RealFloat(Complex[][][] c)Converts real component of a 3DComplex[][][]array to a 3Dfloat[][][]array.static float[][][][]complex2RealFloat(Complex[][][][] c)Converts real component of a 4DComplex[][][][]array to a 4Dfloat[][][][]array.static ComplexextractComplexFromImaginaryArray(double[] imaginary, int index)Returns double from arrayimaginary[]at entryindexas aComplex.static ComplexextractComplexFromImaginaryArray(float[] imaginary, int index)Returns float from arrayimaginary[]at entryindexas aComplex.static ComplexextractComplexFromInterleavedArray(double[] d, int index)Returns a Complex object from interleaveddouble[]array at entryindex.static ComplexextractComplexFromInterleavedArray(float[] f, int index)Returns a Complex object from interleavedfloat[]array at entryindex.static ComplexextractComplexFromRealArray(double[] real, int index)Returns double from arrayreal[]at entryindexas aComplex.static ComplexextractComplexFromRealArray(float[] real, int index)Returns float from arrayreal[]at entryindexas aComplex.static floatextractImaginaryFloatFromComplexArray(Complex[] complex, int index)Returns imaginary component of arrayComplex[]at entryindexas afloat.static doubleextractImaginaryFromComplexArray(Complex[] complex, int index)Returns imaginary component of Complex from arrayComplex[]at entryindexas adouble.static float[]extractInterleavedFloatFromComplexArray(Complex[] complex, int index)Returns Complex object from arrayComplex[]at entryindexas a size 2floatof the form {real, imag}.static double[]extractInterleavedFromComplexArray(Complex[] complex, int index)Returns values of Complex object from arrayComplex[]at entryindexas a size 2doubleof the form {real, imag}.static floatextractRealFloatFromComplexArray(Complex[] complex, int index)Returns real component of arrayComplex[]at entryindexas afloat.static doubleextractRealFromComplexArray(Complex[] complex, int index)Returns real component of Complex from arrayComplex[]at entryindexas adouble.static Complex[]imaginary2Complex(double[] imaginary)Converts adouble[]array to an imaginaryComplex[]array.static Complex[][]imaginary2Complex(double[][] i)Converts a 2D imaginary arraydouble[][]to a 2DComplex[][]array.static Complex[][][]imaginary2Complex(double[][][] i)Converts a 3D imaginary arraydouble[][][]to aComplex[]array.static Complex[][][][]imaginary2Complex(double[][][][] i)Converts a 4D imaginary arraydouble[][][][]to a 4DComplex[][][][]array.static Complex[]imaginary2Complex(float[] imaginary)Converts afloat[]array to an imaginaryComplex[]array.static Complex[]initialize(Complex[] c)Initializes aComplex[]array to zero, to avoid NullPointerExceptions.static Complex[][]initialize(Complex[][] c)Initializes aComplex[][]array to zero, to avoid NullPointerExceptions.static Complex[][][]initialize(Complex[][][] c)Initializes aComplex[][][]array to zero, to avoid NullPointerExceptions.static Complex[]interleaved2Complex(double[] interleaved)Converts a complex interleaveddouble[]array to aComplex[]arraystatic Complex[][]interleaved2Complex(double[][] d)Converts a 2D interleaved complexdouble[][]array to aComplex[][]array.static Complex[][][]interleaved2Complex(double[][][] d)Converts a 3D interleaved complexdouble[][][]array to aComplex[][][]array.static Complex[][][][]interleaved2Complex(double[][][][] i, int interleavedDim)Converts a 4D interleaved complexdouble[][][][]array to aComplex[][][][]array.static Complex[][][]interleaved2Complex(double[][][] i, int interleavedDim)Converts a 3D interleaved complexdouble[][][]array to aComplex[][][]array.static Complex[][]interleaved2Complex(double[][] i, int interleavedDim)Converts a 2D interleaved complexdouble[][]array to aComplex[][]array.static Complex[]interleaved2Complex(float[] interleaved)Converts a complex interleavedfloat[]array to aComplex[]arraystatic Complex[][]interleaved2Complex(float[][] d)Converts a 2D interleaved complexfloat[][]array to aComplex[][]array.static Complex[][][]interleaved2Complex(float[][][] d)Converts a 3D interleaved complexfloat[][][]array to aComplex[]array.static Complex[][][]interleaved2Complex(float[][][] i, int interleavedDim)Converts a 3D interleaved complexfloat[][][]array to aComplex[][][]array.static Complex[][]interleaved2Complex(float[][] i, int interleavedDim)Converts a 2D interleaved complexfloat[][]array to aComplex[][]array.static Complex[][][]polar2Complex(double[][][] r, double[][][] theta)CreatesComplex[][][]array givendouble[][][]arrays of r and theta.static Complex[][]polar2Complex(double[][] r, double[][] theta)CreatesComplex[][]array givendouble[][]arrays of r and theta.static Complex[]polar2Complex(double[] r, double[] theta)CreatesComplex[]array givendouble[]arrays of r and theta.static Complexpolar2Complex(double r, double theta)Creates a complex number from the given polar representation.static Complex[]real2Complex(double[] real)Converts adouble[]array to aComplex[]array.static Complex[][]real2Complex(double[][] d)Converts a 2D realdouble[][]array to a 2DComplex[][]array.static Complex[][][]real2Complex(double[][][] d)Converts a 3D realdouble[][][]array to aComplex [][][]array.static Complex[][][][]real2Complex(double[][][][] d)Converts a 4D realdouble[][][][]array to aComplex [][][][]array.static Complex[]real2Complex(float[] real)Converts afloat[]array to aComplex[]array.static Complex[][]real2Complex(float[][] d)Converts a 2D realfloat[][]array to a 2DComplex[][]array.static Complex[][][]real2Complex(float[][][] d)Converts a 3D realfloat[][][]array to aComplex [][][]array.static Complex[][][][]split2Complex(double[][][][] real, double[][][][] imag)Converts a 4D split complex arraydouble[][][][] r, double[][][][] ito a 4DComplex[][][][]array.static Complex[][][]split2Complex(double[][][] real, double[][][] imag)Converts a 3D split complex arraydouble[][][] r, double[][][] ito a 3DComplex[][][]array.static Complex[][]split2Complex(double[][] real, double[][] imag)Converts a 2D split complex arraydouble[][] r, double[][] ito a 2DComplex[][]array.static Complex[]split2Complex(double[] real, double[] imag)Converts a split complex arraydouble[] r, double[] ito aComplex[]array.static Complex[][][]split2Complex(float[][][] real, float[][][] imag)Converts a 3D split complex arrayfloat[][][] r, float[][][] ito a 3DComplex[][][]array.static Complex[][]split2Complex(float[][] real, float[][] imag)Converts a 2D split complex arrayfloat[][] r, float[][] ito a 2DComplex[][]array.static Complex[]split2Complex(float[] real, float[] imag)Converts a split complex arrayfloat[] r, float[] ito aComplex[]array.
-
-
-
Method Detail
-
polar2Complex
public static Complex polar2Complex(double r, double theta)
Creates a complex number from the given polar representation.If either
rorthetais NaN, orthetais infinite,Complex.NANis returned.If
ris infinite andthetais 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 createtheta- the argument of the complex number to create- Returns:
Complex
-
polar2Complex
public static Complex[] polar2Complex(double[] r, double[] theta)
CreatesComplex[]array givendouble[]arrays of r and theta.- Parameters:
r-double[]of modulitheta-double[]of arguments- Returns:
Complex[]
-
polar2Complex
public static Complex[][] polar2Complex(double[][] r, double[][] theta)
CreatesComplex[][]array givendouble[][]arrays of r and theta.- Parameters:
r-double[]of modulitheta-double[]of arguments- Returns:
Complex[][]
-
polar2Complex
public static Complex[][][] polar2Complex(double[][][] r, double[][][] theta)
CreatesComplex[][][]array givendouble[][][]arrays of r and theta.- Parameters:
r- array of modulitheta- array of arguments- Returns:
Complex
-
extractComplexFromRealArray
public static Complex extractComplexFromRealArray(double[] real, int index)
Returns double from arrayreal[]at entryindexas aComplex.- Parameters:
real- array of real numbersindex- location in the array- Returns:
Complex.
-
extractComplexFromRealArray
public static Complex extractComplexFromRealArray(float[] real, int index)
Returns float from arrayreal[]at entryindexas aComplex.- Parameters:
real- array of real numbersindex- location in the array- Returns:
Complexarray
-
extractComplexFromImaginaryArray
public static Complex extractComplexFromImaginaryArray(double[] imaginary, int index)
Returns double from arrayimaginary[]at entryindexas aComplex.- Parameters:
imaginary- array of imaginary numbersindex- location in the array- Returns:
Complexarray
-
extractComplexFromImaginaryArray
public static Complex extractComplexFromImaginaryArray(float[] imaginary, int index)
Returns float from arrayimaginary[]at entryindexas aComplex.- Parameters:
imaginary- array of imaginary numbersindex- location in the array- Returns:
Complexarray
-
extractRealFromComplexArray
public static double extractRealFromComplexArray(Complex[] complex, int index)
Returns real component of Complex from arrayComplex[]at entryindexas adouble.- Parameters:
complex- array of complex numbersindex- location in the array- Returns:
double.
-
extractRealFloatFromComplexArray
public static float extractRealFloatFromComplexArray(Complex[] complex, int index)
Returns real component of arrayComplex[]at entryindexas afloat.- Parameters:
complex- array of complex numbersindex- location in the array- Returns:
float.
-
extractImaginaryFromComplexArray
public static double extractImaginaryFromComplexArray(Complex[] complex, int index)
Returns imaginary component of Complex from arrayComplex[]at entryindexas adouble.- Parameters:
complex- array of complex numbersindex- location in the array- Returns:
double.
-
extractImaginaryFloatFromComplexArray
public static float extractImaginaryFloatFromComplexArray(Complex[] complex, int index)
Returns imaginary component of arrayComplex[]at entryindexas afloat.- Parameters:
complex- array of complex numbersindex- location in the array- Returns:
float.
-
extractComplexFromInterleavedArray
public static Complex extractComplexFromInterleavedArray(double[] d, int index)
Returns a Complex object from interleaveddouble[]array at entryindex.- Parameters:
d- array of interleaved complex numbers alternating real and imaginary valuesindex- location in the array This is the location by complex number, e.g. index number 5 in the array will returnComplex.ofCartesian(d[10], d[11])- Returns:
Complex.
-
extractComplexFromInterleavedArray
public static Complex extractComplexFromInterleavedArray(float[] f, int index)
Returns a Complex object from interleavedfloat[]array at entryindex.- Parameters:
f- float array of interleaved complex numbers alternating real and imaginary valuesindex- location in the array This is the location by complex number, e.g. index number 5 in thefloat[]array will return newComplex(d[10], d[11])- Returns:
Complex.
-
extractInterleavedFromComplexArray
public static double[] extractInterleavedFromComplexArray(Complex[] complex, int index)
Returns values of Complex object from arrayComplex[]at entryindexas a size 2doubleof the form {real, imag}.- Parameters:
complex- array of complex numbersindex- location in the array- Returns:
- size 2 array.
-
extractInterleavedFloatFromComplexArray
public static float[] extractInterleavedFloatFromComplexArray(Complex[] complex, int index)
Returns Complex object from arrayComplex[]at entryindexas a size 2floatof the form {real, imag}.- Parameters:
complex-Complexarrayindex- location in the array- Returns:
- size 2
float[].
-
real2Complex
public static Complex[] real2Complex(double[] real)
Converts adouble[]array to aComplex[]array.- Parameters:
real- array of numbers to be converted to theirComplexequivalent- Returns:
Complexarray
-
real2Complex
public static Complex[] real2Complex(float[] real)
Converts afloat[]array to aComplex[]array.- Parameters:
real- array of numbers to be converted to theirComplexequivalent- Returns:
Complexarray
-
real2Complex
public static Complex[][] real2Complex(double[][] d)
Converts a 2D realdouble[][]array to a 2DComplex[][]array.- Parameters:
d- 2D array- Returns:
- 2D
Complexarray
-
real2Complex
public static Complex[][] real2Complex(float[][] d)
Converts a 2D realfloat[][]array to a 2DComplex[][]array.- Parameters:
d- 2D array- Returns:
- 2D
Complexarray
-
real2Complex
public static Complex[][][] real2Complex(double[][][] d)
Converts a 3D realdouble[][][]array to aComplex [][][]array.- Parameters:
d- 3D complex interleaved array- Returns:
- 3D
Complexarray
-
real2Complex
public static Complex[][][] real2Complex(float[][][] d)
Converts a 3D realfloat[][][]array to aComplex [][][]array.- Parameters:
d- 3D complex interleaved array- Returns:
- 3D
Complexarray
-
real2Complex
public static Complex[][][][] real2Complex(double[][][][] d)
Converts a 4D realdouble[][][][]array to aComplex [][][][]array.- Parameters:
d- 4D complex interleaved array- Returns:
- 4D
Complexarray
-
complex2Real
public static double[] complex2Real(Complex[] c)
Converts real component ofComplex[]array to adouble[]array.- Parameters:
c-Complexarray- Returns:
- array of the real component
-
complex2RealFloat
public static float[] complex2RealFloat(Complex[] c)
Converts real component ofComplex[]array to afloat[]array.- Parameters:
c-Complexarray- Returns:
float[]array of the real component
-
complex2Real
public static double[][] complex2Real(Complex[][] c)
Converts real component of a 2DComplex[][]array to a 2Ddouble[][]array.- Parameters:
c- 2DComplexarray- Returns:
double[][]of real component
-
complex2RealFloat
public static float[][] complex2RealFloat(Complex[][] c)
Converts real component of a 2DComplex[][]array to a 2Dfloat[][]array.- Parameters:
c- 2DComplexarray- Returns:
float[][]of real component
-
complex2Real
public static double[][][] complex2Real(Complex[][][] c)
Converts real component of a 3DComplex[][][]array to a 3Ddouble[][][]array.- Parameters:
c- 3D complex interleaved array- Returns:
- array of real component
-
complex2RealFloat
public static float[][][] complex2RealFloat(Complex[][][] c)
Converts real component of a 3DComplex[][][]array to a 3Dfloat[][][]array.- Parameters:
c- 3DComplexarray- Returns:
float[][][]of real component
-
complex2Real
public static double[][][][] complex2Real(Complex[][][][] c)
Converts real component of a 4DComplex[][][][]array to a 4Ddouble[][][][]array.- Parameters:
c- 4D complex interleaved array- Returns:
- array of real component
-
complex2RealFloat
public static float[][][][] complex2RealFloat(Complex[][][][] c)
Converts real component of a 4DComplex[][][][]array to a 4Dfloat[][][][]array.- Parameters:
c- 4DComplexarray- Returns:
float[][][][]of real component
-
imaginary2Complex
public static Complex[] imaginary2Complex(double[] imaginary)
Converts adouble[]array to an imaginaryComplex[]array.- Parameters:
imaginary- array of numbers to be converted to theirComplexequivalent- Returns:
Complexarray
-
imaginary2Complex
public static Complex[] imaginary2Complex(float[] imaginary)
Converts afloat[]array to an imaginaryComplex[]array.- Parameters:
imaginary- array of numbers to be converted to theirComplexequivalent- Returns:
Complexarray
-
imaginary2Complex
public static Complex[][] imaginary2Complex(double[][] i)
Converts a 2D imaginary arraydouble[][]to a 2DComplex[][]array.- Parameters:
i- 2D array- Returns:
- 2D
Complexarray
-
imaginary2Complex
public static Complex[][][] imaginary2Complex(double[][][] i)
Converts a 3D imaginary arraydouble[][][]to aComplex[]array.- Parameters:
i- 3D complex imaginary array- Returns:
- 3D
Complexarray
-
imaginary2Complex
public static Complex[][][][] imaginary2Complex(double[][][][] i)
Converts a 4D imaginary arraydouble[][][][]to a 4DComplex[][][][]array.- Parameters:
i- 4D complex imaginary array- Returns:
- 4D
Complexarray
-
complex2Imaginary
public static double[] complex2Imaginary(Complex[] c)
Converts imaginary part of aComplex[]array to adouble[]array.- Parameters:
c-Complexarray.- Returns:
- array of the imaginary component
-
complex2ImaginaryFloat
public static float[] complex2ImaginaryFloat(Complex[] c)
Converts imaginary component of aComplex[]array to afloat[]array.- Parameters:
c-Complexarray.- Returns:
float[]array of the imaginary component
-
complex2Imaginary
public static double[][] complex2Imaginary(Complex[][] c)
Converts imaginary component of a 2DComplex[][]array to a 2Ddouble[][]array.- Parameters:
c- 2DComplexarray- Returns:
double[][]of imaginary component
-
complex2ImaginaryFloat
public static float[][] complex2ImaginaryFloat(Complex[][] c)
Converts imaginary component of a 2DComplex[][]array to a 2Dfloat[][]array.- Parameters:
c- 2DComplexarray- Returns:
float[][]of imaginary component
-
complex2Imaginary
public static double[][][] complex2Imaginary(Complex[][][] c)
Converts imaginary component of a 3DComplex[][][]array to a 3Ddouble[][][]array.- Parameters:
c- 3D complex interleaved array- Returns:
- 3D
Complexarray
-
complex2ImaginaryFloat
public static float[][][] complex2ImaginaryFloat(Complex[][][] c)
Converts imaginary component of a 3DComplex[][][]array to a 3Dfloat[][][]array.- Parameters:
c- 3DComplexarray- Returns:
float[][][]of imaginary component
-
complex2Imaginary
public static double[][][][] complex2Imaginary(Complex[][][][] c)
Converts imaginary component of a 4DComplex[][][][]array to a 4Ddouble[][][][]array.- Parameters:
c- 4D complex interleaved array- Returns:
- 4D
Complexarray
-
complex2ImaginaryFloat
public static float[][][][] complex2ImaginaryFloat(Complex[][][][] c)
Converts imaginary component of a 4DComplex[][][][]array to a 4Dfloat[][][][]array.- Parameters:
c- 4DComplexarray- Returns:
float[][][][]of imaginary component
-
interleaved2Complex
public static Complex[] interleaved2Complex(double[] interleaved)
Converts a complex interleaveddouble[]array to aComplex[]array- Parameters:
interleaved- array of numbers to be converted to theirComplexequivalent- Returns:
Complexarray
-
interleaved2Complex
public static Complex[] interleaved2Complex(float[] interleaved)
Converts a complex interleavedfloat[]array to aComplex[]array- Parameters:
interleaved- float[] array of numbers to be converted to theirComplexequivalent- Returns:
Complexarray
-
complex2Interleaved
public static double[] complex2Interleaved(Complex[] c)
Converts aComplex[]array to an interleaved complexdouble[]array- Parameters:
c- Complex array- Returns:
- complex interleaved array alternating real and imaginary values
-
complex2InterleavedFloat
public static float[] complex2InterleavedFloat(Complex[] c)
Converts aComplex[]array to an interleaved complexfloat[]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 2DComplex[][]array to an interleaved complexdouble[][]array.- Parameters:
c- 2D Complex arrayinterleavedDim- 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 2DComplex[][]array to an interleaved complexdouble[][]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 3DComplex[][][]array to an interleaved complexdouble[][][]array.- Parameters:
c- 3D Complex arrayinterleavedDim- 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 4DComplex[][][][]array to an interleaved complexdouble[][][][]array.- Parameters:
c- 4D Complex arrayinterleavedDim- 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 3DComplex[][][]array to an interleaved complexdouble[][][]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 4DComplex[][][][]array to an interleaved complexdouble[][][][]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 2DComplex[][]array to an interleaved complexfloat[][]array.- Parameters:
c- 2D Complex arrayinterleavedDim- 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 2DComplex[][]array to an interleaved complexfloat[][]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 3DComplex[][][]array to an interleaved complexfloat[][][]array.- Parameters:
c- 3D Complex arrayinterleavedDim- 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 3DComplex[][][]array to an interleaved complexfloat[][][]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 complexdouble[][]array to aComplex[][]array.- Parameters:
i- 2D complex interleaved arrayinterleavedDim- Depth level of the array to interleave- Returns:
- 2D
Complexarray
-
interleaved2Complex
public static Complex[][] interleaved2Complex(double[][] d)
Converts a 2D interleaved complexdouble[][]array to aComplex[][]array. The second d level of the array is assumed to be interleaved.- Parameters:
d- 2D complex interleaved array- Returns:
- 2D
Complexarray
-
interleaved2Complex
public static Complex[][][] interleaved2Complex(double[][][] i, int interleavedDim)
Converts a 3D interleaved complexdouble[][][]array to aComplex[][][]array.- Parameters:
i- 3D complex interleaved arrayinterleavedDim- Depth level of the array to interleave- Returns:
- 3D
Complexarray
-
interleaved2Complex
public static Complex[][][][] interleaved2Complex(double[][][][] i, int interleavedDim)
Converts a 4D interleaved complexdouble[][][][]array to aComplex[][][][]array.- Parameters:
i- 4D complex interleaved arrayinterleavedDim- Depth level of the array to interleave- Returns:
- 4D
Complexarray
-
interleaved2Complex
public static Complex[][][] interleaved2Complex(double[][][] d)
Converts a 3D interleaved complexdouble[][][]array to aComplex[][][]array. The third d level is assumed to be interleaved.- Parameters:
d- 3D complex interleaved array- Returns:
- 3D
Complexarray
-
interleaved2Complex
public static Complex[][] interleaved2Complex(float[][] i, int interleavedDim)
Converts a 2D interleaved complexfloat[][]array to aComplex[][]array.- Parameters:
i- 2D complex interleaved float arrayinterleavedDim- Depth level of the array to interleave- Returns:
- 2D
Complexarray
-
interleaved2Complex
public static Complex[][] interleaved2Complex(float[][] d)
Converts a 2D interleaved complexfloat[][]array to aComplex[][]array. The second d level of the array is assumed to be interleaved.- Parameters:
d- 2D complex interleaved float array- Returns:
- 2D
Complexarray
-
interleaved2Complex
public static Complex[][][] interleaved2Complex(float[][][] i, int interleavedDim)
Converts a 3D interleaved complexfloat[][][]array to aComplex[][][]array.- Parameters:
i- 3D complex interleaved float arrayinterleavedDim- Depth level of the array to interleave- Returns:
- 3D
Complexarray
-
interleaved2Complex
public static Complex[][][] interleaved2Complex(float[][][] d)
Converts a 3D interleaved complexfloat[][][]array to aComplex[]array. The third level of the array is assumed to be interleaved.- Parameters:
d- 3D complex interleaved float array- Returns:
- 3D
Complexarray
-
split2Complex
public static Complex[] split2Complex(double[] real, double[] imag)
Converts a split complex arraydouble[] r, double[] ito aComplex[]array.- Parameters:
real- real componentimag- imaginary component- Returns:
Complexarray
-
split2Complex
public static Complex[][] split2Complex(double[][] real, double[][] imag)
Converts a 2D split complex arraydouble[][] r, double[][] ito a 2DComplex[][]array.- Parameters:
real- real componentimag- imaginary component- Returns:
- 2D
Complexarray
-
split2Complex
public static Complex[][][] split2Complex(double[][][] real, double[][][] imag)
Converts a 3D split complex arraydouble[][][] r, double[][][] ito a 3DComplex[][][]array.- Parameters:
real- real componentimag- imaginary component- Returns:
- 3D
Complexarray
-
split2Complex
public static Complex[][][][] split2Complex(double[][][][] real, double[][][][] imag)
Converts a 4D split complex arraydouble[][][][] r, double[][][][] ito a 4DComplex[][][][]array.- Parameters:
real- real componentimag- imaginary component- Returns:
- 4D
Complexarray
-
split2Complex
public static Complex[] split2Complex(float[] real, float[] imag)
Converts a split complex arrayfloat[] r, float[] ito aComplex[]array.- Parameters:
real- real componentimag- imaginary component- Returns:
Complexarray
-
split2Complex
public static Complex[][] split2Complex(float[][] real, float[][] imag)
Converts a 2D split complex arrayfloat[][] r, float[][] ito a 2DComplex[][]array.- Parameters:
real- real componentimag- imaginary component- Returns:
- 2D
Complexarray
-
split2Complex
public static Complex[][][] split2Complex(float[][][] real, float[][][] imag)
Converts a 3D split complex arrayfloat[][][] r, float[][][] ito a 3DComplex[][][]array.- Parameters:
real- real componentimag- imaginary component- Returns:
- 3D
Complexarray
-
initialize
public static Complex[] initialize(Complex[] c)
Initializes aComplex[]array to zero, to avoid NullPointerExceptions.- Parameters:
c- Complex array- Returns:
- c
-
initialize
public static Complex[][] initialize(Complex[][] c)
Initializes aComplex[][]array to zero, to avoid NullPointerExceptions.- Parameters:
c-Complexarray- Returns:
- c
-
initialize
public static Complex[][][] initialize(Complex[][][] c)
Initializes aComplex[][][]array to zero, to avoid NullPointerExceptions.- Parameters:
c-Complexarray- Returns:
- c
-
abs
public static double[] abs(Complex[] c)
Returnsdouble[]containing absolute values (magnitudes) of aComplex[]array.- Parameters:
c-Complexarray- Returns:
double[]
-
arg
public static double[] arg(Complex[] c)
Returnsdouble[]containing arguments (phase angles) of aComplex[]array.- Parameters:
c-Complexarray- Returns:
double[]array
-
-