All Packages Class Hierarchy This Package Previous Next Index
Class Jampack.Znum
java.lang.Object
|
+----Jampack.Znum
- public class Znum
- extends Object
Znum is a mutable complex variable class. It is designed to
perform complex arithmetic without creating a new Znum at
each operation. Specifically, binary operations have the
form c.op(a,b), in which a, b, and c need not be different.
The method places the complex number a.op.b in
c. The method also returns a pointer to c. Thus the
class supports two styles of programming. For example
to compute e = a*b + c*d you can write
z1.Times(a,b)
z2.Times(c,d)
e.Plus(z1,z2)
or
e.Plus(z1.Times(a,b), z2.Times(a,b))
Since objects of class Znum are mutable, the use of the assignment
operator "=" with these objects is deprecated. Use Eq.
The functions are reasonably resistent to overflow and underflow.
But the more complicated ones could almost certainly be improved.
-
I
- Imaginary unit.
-
im
- The imaginary part of Znum.
-
ONE
- Complex 1.
-
re
- The real part of Znum.
-
ZERO
- Complex 0.
-
Znum()
- Creates a Znum and initializes it to zero.
-
Znum(double)
- Creates a Znum and initializes its real part.
-
Znum(double, double)
- Creates a Znum and initializes its real and imaginary parts.
-
Znum(Znum)
- Creates a Znum and initializes it to another Znum.
-
abs(Znum)
- Computes the absolute value of a Znum.
-
abs1(Znum)
- Computes the 1-norm of a Znum
-
Conj(Znum)
- Computes the conjugate of a Znum.
-
Div(Znum, double)
- Computes the quotient of a Znum and a double.
-
Div(Znum, Znum)
- Computes the quotient of two Znum's.
-
Eq(double, double)
- Resets the real and imaginary parts of a Znum.
-
Eq(Znum)
- Resets the real and imaginary parts of a Znum to those of another Znum.
-
Exch(Znum)
- Interchanges the real and imaginary parts of two Znum's.
-
IsEqual(Znum, Znum)
- Tests two Znum'z for equality.
-
Minus(Znum)
- Computes unary minus of a Znum.
-
Minus(Znum, Znum)
- Computes the difference of two Znum's.
-
Plus(Znum, Znum)
- Computes the sum of two Znum's.
-
Sqrt(Znum)
- Computes the principal value of the square root of a Znum.
-
Times(double, Znum)
- Computes the product of a double and a Znum.
-
Times(Znum, Znum)
- Computes the product of two Znum's.
ONE
public static final Znum ONE
- Complex 1.
ZERO
public static final Znum ZERO
- Complex 0.
I
public static final Znum I
- Imaginary unit.
re
public double re
- The real part of Znum.
im
public double im
- The imaginary part of Znum.
Znum
public Znum()
- Creates a Znum and initializes it to zero.
- Returns:
- a Znum initialized to zero.
Znum
public Znum(double x,
double y)
- Creates a Znum and initializes its real and imaginary parts.
- Parameters:
- x - a double
- y - a double
- Returns:
- x + iy
Znum
public Znum(double x)
- Creates a Znum and initializes its real part.
- Parameters:
- x - a double
- Returns:
- x + i*0
Znum
public Znum(Znum a)
- Creates a Znum and initializes it to another Znum.
- Parameters:
- a - a Znum
- Returns:
- a
IsEqual
public boolean IsEqual(Znum z1,
Znum z2)
- Tests two Znum'z for equality.
- Parameters:
- z1 - a Znum
- z2 - a Znum
- Returns:
- true if z1=z2, otherwise false
Eq
public Znum Eq(Znum a)
- Resets the real and imaginary parts of a Znum to those of another Znum.
- Parameters:
- a - a Znum
- Returns:
- this = a;
Eq
public Znum Eq(double a,
double b)
- Resets the real and imaginary parts of a Znum.
- Parameters:
- a - a double
- b - a double
- Returns:
- this = a + ib
Exch
public Znum Exch(Znum a)
- Interchanges the real and imaginary parts of two Znum's.
- Parameters:
- a - a Znum
- Returns:
- this = a, with a set to the original
value of this.
abs1
public static double abs1(Znum z)
- Computes the 1-norm of a Znum
abs
public static double abs(Znum z)
- Computes the absolute value of a Znum.
- Parameters:
- z - a Znum
- Returns:
- the absolute vaue of Znum
Conj
public Znum Conj(Znum a)
- Computes the conjugate of a Znum.
- Parameters:
- a - a Znum
- Returns:
- this = conj(a);
Minus
public Znum Minus(Znum a)
- Computes unary minus of a Znum.
- Parameters:
- a - a Znum
- Returns:
- this = -a;
Plus
public Znum Plus(Znum a,
Znum b)
- Computes the sum of two Znum's.
- Parameters:
- a - a Znum
- b - a Znum
- Returns:
- this = a + b
Minus
public Znum Minus(Znum a,
Znum b)
- Computes the difference of two Znum's.
- Parameters:
- a - a Znum
- b - a Znum
- Returns:
- this = a - b
Times
public Znum Times(Znum a,
Znum b)
- Computes the product of two Znum's.
- Parameters:
- a - a Znum
- b - a Znum
- Returns:
- this = ab
Times
public Znum Times(double a,
Znum b)
- Computes the product of a double and a Znum.
- Parameters:
- a - a double
- b - a Znum
- Returns:
- this = ab
Div
public Znum Div(Znum a,
Znum b) throws JampackException
- Computes the quotient of two Znum's. Throws a JampackException if
the denominator is zero.
- Parameters:
- a - a Znum
- b - a Znum
- Returns:
- this = a/b
- Throws: JampackException
- Thrown if b is zero.
Div
public Znum Div(Znum a,
double b) throws JampackException
- Computes the quotient of a Znum and a double. Throws a JampackException
if the denominator is zero.
- Parameters:
- a - a Znum
- b - a double
- Returns:
- this = a/b
- Throws: JampackException
- Thrown if b is zero.
Sqrt
public Znum Sqrt(Znum a)
- Computes the principal value of the square root of a Znum.
- Parameters:
- a - a Znum
- this - = sqrt(a)
All Packages Class Hierarchy This Package Previous Next Index