|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjfftw.Complex
public class Complex
Class to handle Complex numbers and arithmetic. The complex is held a two double, and all arithmetic is in double format. Much of the internal coding does not use methods for efficiency reasons.
Field Summary | |
---|---|
static int |
BOTH
Static to specify both parts of a Complex number |
double |
i
The imaginary part |
static int |
IMAG
Static to specify imaginary part of Complex number |
static int |
LOG_POWER
Static to specify Log Power of a Complex |
static int |
MODULUS
Static to specify the modulus of a Complex number |
static int |
MODULUS_SQUARED
Static to specify the modulus squared of a Complex number |
static int |
PHASE
Static to specify the phase of a Complex number |
double |
r
The real part |
static int |
REAL
Static to specify real part of Complex number |
Constructor Summary | |
---|---|
Complex()
Default constructor for Complex with both real and imaginary zero |
|
Complex(Complex c)
Constructor for Complex with Complex parameter |
|
Complex(double a)
Constructor for Complex with real part only |
|
Complex(double a,
double b)
Constructor for Complex with two doubles |
Method Summary | |
---|---|
static Complex |
add(Complex a,
Complex b)
Static add method with two parameters |
void |
addTo(Complex c)
Method to add to the current Complex |
void |
addTo(double r,
double i)
Void method to add to the current Complex |
Complex |
clone()
Method to clone the current Complex |
Complex |
conj()
The Complex conjugate of the current Complex |
Complex |
from(Complex c)
Subtract the current Complex FROM specified value returning a new Complex |
Complex |
from(double a)
Subtract the current Complex from a scalar returning a new Complex |
Complex |
from(double a,
double b)
Subtract the current Complex FROM specified value retuning a new Complex |
double |
getDouble(int flag)
Method to get double, converted from current Complex as specified by the conversion flag. |
double |
getImag()
Get the imag part |
double |
getReal()
Get the real part |
boolean |
isNaN()
Test of either components set to NaN |
double |
logPower()
Get the log power, being defines at log(r*r + i*i + 1.0) |
Complex |
minus(Complex c)
Subtract a complex from the current retuning a new Complex |
Complex |
minus(double a)
Subtract a real number from the current retuning a new Complex |
Complex |
minus(double a,
double b)
Subtract a complex from the current returning a new Complex |
double |
modulus()
Get the modulus of the Complex |
double |
modulusSq()
Get the modulus squared of the Complex |
Complex |
mult(Complex c)
Multiply the current by a specified Complex, returning a new Complex. |
static Complex |
mult(Complex a,
Complex b)
Static mult method with two parameters |
Complex |
mult(double a)
Multiply the current by a scalar returning a new Complex |
Complex |
mult(double a,
double b)
Multiply the current by a specified Complex, returning a new Complex. |
void |
multBy(Complex c)
Method to mult the current Complex by specified Complex |
void |
multBy(double a)
Method to mult the current Complex by specified real |
void |
multBy(double a,
double b)
Method to mult the current Complex by specified Complex |
Complex |
multConj(Complex c)
Multiply the current by the conjugate of the specified Complex retuning a new Complex |
Complex |
over(Complex c)
Divide the current by specified Complex returning new Complex |
Complex |
over(double a)
Divide the current Complex by a scalar returning a new Complex |
Complex |
over(double a,
double b)
Divide the current by specified Complex returning new Complex |
double |
phase()
Get the phase from atan2(i,r) method. |
Complex |
plus(Complex c)
Add a complex to the current returning a new Complex. |
Complex |
plus(double a)
Add a real number to the current returning a new Complex. |
Complex |
plus(double a,
double b)
Add a complex to the current returning a new Complex |
Complex |
scale(double mod)
Form a scaled Complex from the current Complex with specified modulus, while retaining phase. |
void |
set(Complex c)
Method to reset the Complex value |
void |
set(double a,
double b)
Method reset Complex value |
void |
setExpi(double theta)
Method to set Complex value to expi(theta) |
void |
setFormatString(String fmt)
Change the default format, by default set to "%g" |
void |
setImag(double b)
Set the imaginary part, real part unchanged |
void |
setInvalid()
Method to set the current Complex to be invalid, with both real and imaginary set to NaN |
void |
setPolar(double rho,
double theta)
Method to set the Complex value with polar parameters |
void |
setRandomPhase(double m)
Method to set a Complex to a specified modulus, but the phase set randomly between 0 to 2pi |
void |
setReal(double a)
Set the real part, imaginary part unchanged |
String |
toString()
Format the current Complex as a String |
Complex |
under(Complex c)
Divide the specified Complex BY the current Complex |
Complex |
under(double a)
Divide the specified scalar BY the current Complex returning a new Complex |
Complex |
unity()
Form a unit modulus version current Complex retaining the phase |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int REAL
public static final int IMAG
public static final int BOTH
public static final int MODULUS
public static final int PHASE
public static final int MODULUS_SQUARED
public static final int LOG_POWER
public double r
public double i
Constructor Detail |
---|
public Complex(double a, double b)
a
- real partb
- imaginary partpublic Complex(double a)
a
- real partpublic Complex()
public Complex(Complex c)
c
- the Complex valueMethod Detail |
---|
public Complex clone()
clone
in class Object
Complex
clone of the current Complexpublic void set(double a, double b)
a
- the real partb
- the imaginary valuepublic void set(Complex c)
c
- the Complex valuepublic void setPolar(double rho, double theta)
rho
- the radial parametertheta
- the angular parameterpublic void setExpi(double theta)
theta
- the angular parameterpublic void setRandomPhase(double m)
m
- the moduluspublic void setInvalid()
public boolean isNaN()
boolean
true if NaN]public void setReal(double a)
a
- the real valuepublic void setImag(double b)
b
- the imaginary partpublic double getReal()
double
the real partpublic double getImag()
double
the imaginary partpublic double modulusSq()
double
the modulus squaredpublic double modulus()
double
the moduluspublic double phase()
double
the phase in range -pi -> pipublic double logPower()
double
the log powerpublic double getDouble(int flag)
flag
- the conversion flagpublic Complex plus(Complex c)
c
- the complex
Complex
the sumpublic Complex plus(double a, double b)
a
- the real partb
- the imaginary part
Complex
the sumpublic Complex plus(double a)
a
- the real part
Complex
the sumpublic Complex minus(Complex c)
c
- the complex
Complex
the resultpublic Complex minus(double a, double b)
a
- the real partb
- the imaginary part
Complex
the resultpublic Complex minus(double a)
a
- the real part
Complex
the resultpublic Complex from(Complex c)
c
- the complex
Complex
the resultpublic Complex from(double a, double b)
a
- the real partb
- the imaginary part
Complex
the resultpublic Complex from(double a)
a
- the real part
Complex
the resultpublic Complex mult(double a)
a
- the scalar
Complex
the multiplicationpublic Complex mult(double a, double b)
a
- the real partb
- the imaginary part
Complex
the multiplicationpublic Complex mult(Complex c)
c
- the Complex
Complex
the multiplicationpublic Complex multConj(Complex c)
c
- the Complex
Complex
the multiplicationpublic Complex over(double a)
a
- the scalar
Complex
the resultpublic Complex over(double a, double b)
a
- the real partb
- the imaginary part
Complex
the resultpublic Complex over(Complex c)
c
- the Complex
Complex
the resultpublic Complex under(double a)
a
- the scalar
Complex
The resultpublic Complex under(Complex c)
c
- the Complex
Complex
The resultpublic Complex conj()
Complex
the conjugatepublic Complex unity()
Complex
Unit modulus Complexpublic Complex scale(double mod)
mod
- the specified modulus
Complex
the scaled Complex.public String toString()
toString
in class Object
String
formatted Complexpublic void setFormatString(String fmt)
fmt
- the new format Stringpublic void addTo(Complex c)
c
- the Complex to be addedpublic void addTo(double r, double i)
r
- real part to be addedi
- imaginary part of be addedpublic void multBy(double a, double b)
a
- real partb
- imaginary partpublic void multBy(Complex c)
c
- the specified Complexpublic void multBy(double a)
a
- the multiplierpublic static Complex add(Complex a, Complex b)
a
- first Complexb
- second Complex
Complex
the additionpublic static Complex mult(Complex a, Complex b)
a
- first Complexb
- second Complex
Complex
the multiplication
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |