public class Complex
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
double |
imag |
double |
real |
static long |
serialVersionUID |
Constructor and Description |
---|
Complex() |
Complex(Complex a)
Constructor
|
Complex(double real,
double imag)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static 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) |
double |
ang()
Gets the angle of a complex number
|
void |
assign(Complex b)
Assign new real and imaginary values to an existing Complex number
|
void |
assign(double real,
double imag)
Assign new real and imaginary values to an existing Complex number
|
Complex |
clone() |
Complex |
conj() |
static void |
conj(Complex x)
Converts a number to it's own complex conjugate
|
static Complex[] |
createComplexArray(double[] doubleArray)
Create a complex array from a double array
|
void |
internalTimes(Complex b)
Multiply a complex numbers real and imaginary parts by a complex number
|
void |
internalTimes(double b)
Multiply a complex numbers real and imaginary parts by a real number
|
boolean |
isInfinite()
Returns true if either the real or imaginary part
is infinite, false otherwise
|
boolean |
isNaN()
Returns true if either the real or imaginary part
is a Not-a-Number (NaN) value, false otherwise
|
double |
mag()
Gets the magnitude of a complex number
|
double |
magsq()
Gets the squared magnitude of a complex number
|
Complex |
minus(Complex b)
Subtract a real number from a complex number
|
Complex |
minus(double b)
Subtract a real number from a complex number
|
double |
norm()
Deprecated.
|
Complex |
plus(Complex b)
Adds a complex number
|
Complex |
plus(double b)
Add a real number to a complex number
|
Complex |
pow(double f)
Raises a complex number to a scalar power.
|
Complex |
sqrt()
Gets the square root of a Complex number
|
Complex |
times(Complex b)
Multiply a complex number by another complex number
|
Complex |
times(double b)
Multiply a complex number by a real
|
java.lang.String |
toString() |
java.lang.String |
toString(int decimalPlaces) |
java.lang.String |
toString(java.lang.String format) |
static void |
zeroComplexArray(Complex[] array)
Sets all the elements of a complex array to zero
|
public static final long serialVersionUID
public double real
public double imag
public Complex()
public Complex(double real, double imag)
real
- real partimag
- imaginary partpublic Complex(Complex a)
a
- Complex Number (to clone)public Complex clone()
clone
in class java.lang.Object
public double ang()
public double magsq()
@Deprecated public double norm()
public double mag()
public Complex sqrt()
public Complex pow(double f)
f
- power to raise number topublic Complex plus(Complex b)
b
- Complex number to addpublic void assign(Complex b)
b
- Complex number to take values frompublic void assign(double real, double imag)
real
- new real partimag
- new imaginary partpublic Complex plus(double b)
b
- real numberpublic Complex minus(Complex b)
b
- real numberpublic Complex minus(double b)
b
- real numberpublic Complex times(double b)
b
- real numberpublic Complex times(Complex b)
b
- complex numberpublic void internalTimes(double b)
b
- real numberpublic void internalTimes(Complex b)
b
- complex numberpublic Complex conj()
public static void conj(Complex x)
x
- public boolean isNaN()
public boolean isInfinite()
public static Complex[] createComplexArray(double[] doubleArray)
doubleArray
- doubel arraypublic static Complex[] allocateComplexArray(int n)
n
- length of arraypublic static Complex[][] allocateComplexArray(int n, int m)
public static void zeroComplexArray(Complex[] array)
array
- Complex Arraypublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String format)
format
- such as %2.2fpublic java.lang.String toString(int decimalPlaces)