Package fftManager
Class Complex
java.lang.Object
fftManager.Complex
- All Implemented Interfaces:
 Serializable,Cloneable,Comparable<Complex>,ManagedParameters
public class Complex
extends Object
implements Cloneable, Serializable, Comparable<Complex>, ManagedParameters
Class definition for a Complex number type.
- Author:
 - Paul Redmond / Doug Gillespie
 - See Also:
 
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic Complex[]allocateComplexArray(int n) Allocate a new complex array in which each element has been created and it's contents set to 0 +i0;static Complex[][]allocateComplexArray(int n, int m) doubleang()Gets the angle of a complex numbervoidassign(double real, double imag) Assign new real and imaginary values to an existing Complex numbervoidAssign new real and imaginary values to an existing Complex numberclone()intconj()static voidConverts a number to it's own complex conjugatestatic Complex[]createComplexArray(double[] doubleArray) Create a complex array from a double arrayexp()A new Complex object whose value is the complex exponential of thisstatic longGet a set of data that describes all of the parameters in a classvoidinternalTimes(double b) Multiply a complex numbers real and imaginary parts by a real numbervoidMultiply a complex numbers real and imaginary parts by a complex numberbooleanReturns true if either the real or imaginary part is infinite, false otherwisebooleanisNaN()Returns true if either the real or imaginary part is a Not-a-Number (NaN) value, false otherwisedoublemag()Gets the magnitude of a complex numberdoublemagsq()Gets the squared magnitude of a complex numberminus(double b) Subtract a real number from a complex numberSubtract a real number from a complex numberdoublenorm()Deprecated.plus(double b) Add a real number to a complex numberAdds a complex numberpow(double f) Raises a complex number to a scalar power.sqrt()Gets the square root of a Complex numbertimes(double b) Multiply a complex number by a realMultiply a complex number by another complex numbertoString()toString(int decimalPlaces) static voidzeroComplexArray(Complex[] array) Sets all the elements of a complex array to zero 
- 
Field Details
- 
serialVersionUID
public static final long serialVersionUID- See Also:
 
 - 
real
public double real - 
imag
public double imag 
 - 
 - 
Constructor Details
- 
Complex
public Complex() - 
Complex
public Complex(double real, double imag) Constructor- Parameters:
 real- real partimag- imaginary part
 - 
Complex
Constructor- Parameters:
 a- Complex Number (to clone)
 
 - 
 - 
Method Details
- 
clone
 - 
ang
public double ang()Gets the angle of a complex number- Returns:
 - angle in radians
 
 - 
magsq
public double magsq()Gets the squared magnitude of a complex number- Returns:
 - squared magnitude
 
 - 
norm
Deprecated.Gets the squared magnitude of a complex number- Returns:
 - squared magnitude
 
 - 
mag
public double mag()Gets the magnitude of a complex number- Returns:
 - magnitude
 
 - 
sqrt
Gets the square root of a Complex number- Returns:
 - square root of the Complex number
 
 - 
pow
Raises a complex number to a scalar power.- Parameters:
 f- power to raise number to- Returns:
 - new Complex number
 
 - 
exp
A new Complex object whose value is the complex exponential of this- Returns:
 
 - 
plus
Adds a complex number- Parameters:
 b- Complex number to add- Returns:
 - new Complex number
 
 - 
assign
Assign new real and imaginary values to an existing Complex number- Parameters:
 b- Complex number to take values from
 - 
assign
public void assign(double real, double imag) Assign new real and imaginary values to an existing Complex number- Parameters:
 real- new real partimag- new imaginary part
 - 
plus
Add a real number to a complex number- Parameters:
 b- real number- Returns:
 - new Complex number
 
 - 
minus
Subtract a real number from a complex number- Parameters:
 b- real number- Returns:
 - new Complex number
 
 - 
minus
Subtract a real number from a complex number- Parameters:
 b- real number- Returns:
 - new Complex number
 
 - 
times
Multiply a complex number by a real- Parameters:
 b- real number- Returns:
 - new Complex number
 
 - 
times
Multiply a complex number by another complex number- Parameters:
 b- complex number- Returns:
 - new complex number
 
 - 
internalTimes
public void internalTimes(double b) Multiply a complex numbers real and imaginary parts by a real number- Parameters:
 b- real number
 - 
internalTimes
Multiply a complex numbers real and imaginary parts by a complex number- Parameters:
 b- complex number
 - 
conj
 - 
conj
Converts a number to it's own complex conjugate- Parameters:
 x-
 - 
isNaN
public boolean isNaN()Returns true if either the real or imaginary part is a Not-a-Number (NaN) value, false otherwise- Returns:
 - true if either part of the number is NaN
 
 - 
isInfinite
public boolean isInfinite()Returns true if either the real or imaginary part is infinite, false otherwise- Returns:
 - true if either part of the number is infinite
 
 - 
createComplexArray
Create a complex array from a double array- Parameters:
 doubleArray- doubel array- Returns:
 - complex array
 
 - 
allocateComplexArray
Allocate a new complex array in which each element has been created and it's contents set to 0 +i0;- Parameters:
 n- length of array- Returns:
 - Complex array of length n
 
 - 
allocateComplexArray
 - 
zeroComplexArray
Sets all the elements of a complex array to zero- Parameters:
 array- Complex Array
 - 
toString
 - 
toString
- Parameters:
 format- such as %2.2f- Returns:
 
 - 
toString
 - 
getConstructorCalls
public static long getConstructorCalls() - 
compareTo
- Specified by:
 compareToin interfaceComparable<Complex>
 - 
getParameterSet
Description copied from interface:ManagedParametersGet a set of data that describes all of the parameters in a class- Specified by:
 getParameterSetin interfaceManagedParameters- Returns:
 - description of the parameters in a class.
 
 
 -