public class Complex
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
Complex.Array
Packed array of complex numbers for better memory efficiency.
|
| Modifier and Type | Field and Description |
|---|---|
double |
im
The imaginary part.
|
double |
re
The real part.
|
| Constructor and Description |
|---|
Complex(double real,
double imag)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
abs()
Returns abs/modulus/magnitude.
|
Complex |
add(Complex b)
Returns this + b.
|
Complex |
conjugate()
Returns the conjugate.
|
Complex |
cos()
Returns the complex cosine.
|
Complex |
div(Complex b)
Returns a / b.
|
boolean |
equals(java.lang.Object o) |
Complex |
exp()
Returns the complex exponential.
|
int |
hashCode() |
Complex |
mul(Complex b)
Returns this * b.
|
static Complex |
of(double real)
Returns a Complex instance representing the specified value.
|
static Complex |
of(double real,
double imag)
Returns a Complex instance representing the specified value.
|
double |
phase()
Returns angle/phase/argument between -pi and pi.
|
Complex |
reciprocal()
Returns the reciprocal.
|
Complex |
scale(double b)
Scalar multiplication.
|
Complex |
sin()
Returns the complex sine.
|
Complex |
sub(Complex b)
Returns this - b.
|
Complex |
tan()
Returns the complex tangent.
|
java.lang.String |
toString() |
public Complex(double real,
double imag)
real - real partimag - imaginary partpublic static Complex of(double real)
public static Complex of(double real, double imag)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic Complex scale(double b)
public double abs()
public double phase()
public Complex conjugate()
public Complex reciprocal()
public Complex exp()
public Complex sin()
public Complex cos()
public Complex tan()