|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjjil.core.Complex
public class Complex
A simple implementation of complex numbers for use in FFT, etc.
Constructor Summary | |
---|---|
Complex()
Default constructor. |
|
Complex(Complex cx)
Copy constructor. |
|
Complex(int nReal)
Create a new Complex number from a real number. |
|
Complex(int nReal,
int nImag)
Creates a new instance of Complex from real and imaginary arguments. |
Method Summary | |
---|---|
Complex |
conjugate()
Complex conjugate |
Complex |
div(Complex cx)
Divides one complex number by another |
Complex |
div(int n)
Divide the complex number by a real ineger. |
boolean |
equals(Complex cx)
Equality test. |
int |
imag()
The imaginary component of the complex number. |
Complex |
lsh(int n)
Shifts a complex number left a certain number of bits. |
int |
magnitude()
Complex magnitude. |
Complex |
minus(Complex cx)
Subtracts one complex number from another. |
Complex |
plus(Complex cx)
Adds two complex numbers. |
int |
real()
The real component of the complex number. |
Complex |
rsh(int n)
Shifts a complex number right a certain number of bits. |
int |
square()
Computes the absolute square. |
Complex |
times(Complex cx)
Multiplies two complex numbers. |
Complex |
times(int nX)
Multiplies a complex number by a real number. |
java.lang.String |
toString()
Returns a String representation of the complex number |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Complex()
public Complex(Complex cx)
cx
- the complex number to copy.public Complex(int nReal, int nImag)
nReal
- Real component.nImag
- Imaginary component.public Complex(int nReal)
nReal
- The real component.Method Detail |
---|
public Complex conjugate()
public Complex div(int n) throws Error
n
- the divisor.
Error
- if n = 0public Complex div(Complex cx) throws Error
cx
- The complex number to divide by.
Error
- If division by 0 is attempted, i.e., cx.square() is 0.public boolean equals(Complex cx)
cx
- the Complex number to compare with.
public int imag()
public Complex lsh(int n)
n
- The number of bits to shift by.
public int magnitude() throws Error
Error
- if the square value computed is too large.public Complex minus(Complex cx)
cx
- the complex number to subtract.
public Complex plus(Complex cx)
cx
- the complex number to add.
public int real()
public Complex rsh(int n)
n
- The number of bits to shift by.
public int square() throws Error
Error
- if Complex value is too large.public Complex times(Complex cx)
cx
- The complex number to multiply by.
public Complex times(int nX)
nX
- The complex number to multiply by.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |