|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.sir.statespace.ComplexNumber
public class ComplexNumber
This class represents a complex number in the Linear filter
extraction framework. It seems as though this should eventually be a
first class citizen of the IR, but they are not. For now, we'll convert back and
forth between this and the structure that exists in the language
(i.e. JFloatLiteral).
Complex numbers are immutable -- i.e. their value can't change after
they are instantiated.
$Id: ComplexNumber.java,v 1.9 2006/01/25 17:02:30 thies Exp $
Field Summary | |
---|---|
static double |
MAX_PRECISION
The maximum difference between two complex numbers (either their real or imaginary parts) before the equals method will not distinguish them anymore. |
static double |
MAX_PRECISION_BUFFER
|
static ComplexNumber |
ONE
Canonical real number one. |
static ComplexNumber |
ZERO
Canonical number zero. |
Constructor Summary | |
---|---|
ComplexNumber(double re,
double im)
Create a complex number with real part re and imaginary part im. |
Method Summary | |
---|---|
ComplexNumber |
conjugate()
Returns the complex congugate of this complex number. |
ComplexNumber |
dividedby(ComplexNumber other)
Divide this by the specified complex number and return the dividend. |
static boolean |
doubleEquals(double d1,
double d2)
Returns true if these two doubles are equal within a certain precision. |
boolean |
equals(Object o)
Return true if the passed complex number is the same as this (by value). |
double |
getImaginary()
Get the imaginary part of this complex number. |
double |
getReal()
Get the real part of this complex number. |
int |
hashCode()
Hashcode so that data structures work correctly |
boolean |
isIntegral()
returns true if both the real and imaginary parts of this are integers |
boolean |
isReal()
returns true of abs(imaginary part) is less than MAX_PRECISION |
ComplexNumber |
negate()
Compute the negative of this complex number. |
ComplexNumber |
plus(ComplexNumber other)
Compute the sum of this and the passed complex number. |
ComplexNumber |
times(ComplexNumber other)
Multiply this by the specified complex number, and return their product. |
String |
toString()
PrettyPrint this complex number. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double MAX_PRECISION
public static final double MAX_PRECISION_BUFFER
public static final ComplexNumber ZERO
public static final ComplexNumber ONE
Constructor Detail |
---|
public ComplexNumber(double re, double im)
Method Detail |
---|
public double getReal()
public double getImaginary()
public boolean isReal()
public boolean isIntegral()
public ComplexNumber negate()
public ComplexNumber plus(ComplexNumber other)
public ComplexNumber times(ComplexNumber other)
public ComplexNumber dividedby(ComplexNumber other)
public ComplexNumber conjugate()
public boolean equals(Object o)
equals
in class Object
public static boolean doubleEquals(double d1, double d2)
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |