Package fi.iki.jmtilli.javafastcomplex
Interface ComplexNumberArray
- All Known Implementing Classes:
ComplexBufferArray
public interface ComplexNumberArray
A common interface to complex number arrays.
-
Method Summary
Modifier and Type Method Description doubleabs(int i)Returns the absolute value of the complex number.doublearg(int i)Returns the argument of the complex number.doublegetImag(int i)Returns the imaginary part of the complex number.doublegetReal(int i)Returns the real part of the complex number.booleanisInfinite(int i)Checks whether the complex number is infinite.booleanisNaN(int i)Checks whether the complex number is NaN.intsize()Returns the size of the array.java.lang.StringtoString(int i)Returns a String representation of the complex number.
-
Method Details
-
size
int size()Returns the size of the array.- Returns:
- The size
-
getReal
double getReal(int i)Returns the real part of the complex number.- Parameters:
i- The array index- Returns:
- The real part
-
getImag
double getImag(int i)Returns the imaginary part of the complex number.- Parameters:
i- The array index- Returns:
- The imaginary part
-
abs
double abs(int i)Returns the absolute value of the complex number.- Parameters:
i- The array index- Returns:
- Double.NaN if isNaN()
Double.POSITIVE_INFINITY if isInfinite()
x≥0 absolute value otherwise
-
arg
double arg(int i)Returns the argument of the complex number.- Parameters:
i- The array index- Returns:
- Double.NaN if isNaN()
-pi≤x≤pi argument otherwise
-
isNaN
boolean isNaN(int i)Checks whether the complex number is NaN.- Parameters:
i- The array index- Returns:
- true if either the real or imaginary part is NaN
false otherwise
-
isInfinite
boolean isInfinite(int i)Checks whether the complex number is infinite.- Parameters:
i- The array index- Returns:
- true if the real or imaginary part is infinite and !isNaN()
false otherwise
-
toString
java.lang.String toString(int i)Returns a String representation of the complex number.- Parameters:
i- The array index- Returns:
- "NaN" if NaN
re if purely real
im + "i" if purely imaginary
re " + " + im + "i" if imaginary part positive
re " - " + (-im) + "i" if imaginary part negative
-