edu.jas.application
Class Residue<C extends RingElem<C>>

java.lang.Object
  extended by edu.jas.application.Residue<C>
All Implemented Interfaces:
AbelianGroupElem<Residue<C>>, Element<Residue<C>>, MonoidElem<Residue<C>>, RingElem<Residue<C>>, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Residue<C>>

public class Residue<C extends RingElem<C>>
extends java.lang.Object
implements RingElem<Residue<C>>

Residue ring element based on GenPolynomial with RingElem interface. Objects of this class are (nearly) immutable.

Author:
Heinz Kredel
See Also:
Serialized Form

Field Summary
protected  int isunit
          Flag to remember if this residue element is a unit
protected  ResidueRing<C> ring
          Residue class factory data structure.
protected  GenPolynomial<C> val
          Value part of the element data structure.
 
Constructor Summary
Residue(ResidueRing<C> r)
          The constructor creates a Residue object from a ring factory.
Residue(ResidueRing<C> r, GenPolynomial<C> a)
          The constructor creates a Residue object from a ring factory and a polynomial.
Residue(ResidueRing<C> r, GenPolynomial<C> a, int u)
          The constructor creates a Residue object from a ring factory, a polynomial and an indicator if a is a unit.
 
Method Summary
 Residue<C> abs()
          Residue absolute value.
 Residue<C> clone()
          Clone this.
 int compareTo(Residue<C> b)
          Residue comparison.
 Residue<C> divide(Residue<C> S)
          Residue division.
 Residue<C>[] egcd(Residue<C> b)
          Extended greatest common divisor.
 boolean equals(java.lang.Object b)
          Comparison with any other object.
 Residue<C> gcd(Residue<C> b)
          Greatest common divisor.
 int hashCode()
          Hash code for this local.
 Residue<C> inverse()
          Residue inverse.
 boolean isONE()
          Is Residue one.
 boolean isUnit()
          Is Residue unit.
 boolean isZERO()
          Is Residue zero.
 Residue<C> monic()
          Residue monic.
 Residue<C> multiply(Residue<C> S)
          Residue multiplication.
 Residue<C> negate()
          Residue negate.
 Residue<C> remainder(Residue<C> S)
          Residue remainder.
 int signum()
          Residue signum.
 Residue<C> subtract(Residue<C> S)
          Residue subtraction.
 Residue<C> sum(Residue<C> S)
          Residue summation.
 java.lang.String toString()
          Get the String representation as RingElem.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ring

protected final ResidueRing<C extends RingElem<C>> ring
Residue class factory data structure.


val

protected final GenPolynomial<C extends RingElem<C>> val
Value part of the element data structure.


isunit

protected int isunit
Flag to remember if this residue element is a unit. -1 is unknown, 1 is unit, 0 not a unit.

Constructor Detail

Residue

public Residue(ResidueRing<C> r)
The constructor creates a Residue object from a ring factory.

Parameters:
r - ring factory.

Residue

public Residue(ResidueRing<C> r,
               GenPolynomial<C> a)
The constructor creates a Residue object from a ring factory and a polynomial.

Parameters:
r - ring factory.
a - polynomial list.

Residue

public Residue(ResidueRing<C> r,
               GenPolynomial<C> a,
               int u)
The constructor creates a Residue object from a ring factory, a polynomial and an indicator if a is a unit.

Parameters:
r - ring factory.
a - polynomial list.
u - isunit indicator, -1, 0, 1.
Method Detail

clone

public Residue<C> clone()
Clone this.

Specified by:
clone in interface Element<Residue<C extends RingElem<C>>>
Overrides:
clone in class java.lang.Object
See Also:
Object.clone()
Returns:
Creates and returns a copy of this Elemnt.

isZERO

public boolean isZERO()
Is Residue zero.

Specified by:
isZERO in interface AbelianGroupElem<Residue<C extends RingElem<C>>>
See Also:
AbelianGroupElem.isZERO()
Returns:
If this is 0 then true is returned, else false.

isONE

public boolean isONE()
Is Residue one.

Specified by:
isONE in interface MonoidElem<Residue<C extends RingElem<C>>>
See Also:
MonoidElem.isONE()
Returns:
If this is 1 then true is returned, else false.

isUnit

public boolean isUnit()
Is Residue unit.

Specified by:
isUnit in interface MonoidElem<Residue<C extends RingElem<C>>>
See Also:
MonoidElem.isUnit()
Returns:
If this is a unit then true is returned, else false.

toString

public java.lang.String toString()
Get the String representation as RingElem.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

compareTo

public int compareTo(Residue<C> b)
Residue comparison.

Specified by:
compareTo in interface Element<Residue<C extends RingElem<C>>>
Specified by:
compareTo in interface java.lang.Comparable<Residue<C extends RingElem<C>>>
Parameters:
b - Residue.
Returns:
sign(this-b).

equals

public boolean equals(java.lang.Object b)
Comparison with any other object.

Specified by:
equals in interface Element<Residue<C extends RingElem<C>>>
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)
Returns:
true if this is equal to b, else false.

hashCode

public int hashCode()
Hash code for this local.

Specified by:
hashCode in interface Element<Residue<C extends RingElem<C>>>
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()
Returns:
the hashCode.

abs

public Residue<C> abs()
Residue absolute value.

Specified by:
abs in interface AbelianGroupElem<Residue<C extends RingElem<C>>>
See Also:
AbelianGroupElem.abs()
Returns:
the absolute value of this.

sum

public Residue<C> sum(Residue<C> S)
Residue summation.

Specified by:
sum in interface AbelianGroupElem<Residue<C extends RingElem<C>>>
Parameters:
S - Residue.
Returns:
this+S.

negate

public Residue<C> negate()
Residue negate.

Specified by:
negate in interface AbelianGroupElem<Residue<C extends RingElem<C>>>
See Also:
AbelianGroupElem.negate()
Returns:
-this.

signum

public int signum()
Residue signum.

Specified by:
signum in interface AbelianGroupElem<Residue<C extends RingElem<C>>>
See Also:
AbelianGroupElem.signum()
Returns:
signum(this).

subtract

public Residue<C> subtract(Residue<C> S)
Residue subtraction.

Specified by:
subtract in interface AbelianGroupElem<Residue<C extends RingElem<C>>>
Parameters:
S - Residue.
Returns:
this-S.

divide

public Residue<C> divide(Residue<C> S)
Residue division.

Specified by:
divide in interface MonoidElem<Residue<C extends RingElem<C>>>
Parameters:
S - Residue.
Returns:
this/S.

inverse

public Residue<C> inverse()
Residue inverse.

Specified by:
inverse in interface MonoidElem<Residue<C extends RingElem<C>>>
See Also:
MonoidElem.inverse()
Returns:
S with S = 1/this if defined.

remainder

public Residue<C> remainder(Residue<C> S)
Residue remainder.

Specified by:
remainder in interface MonoidElem<Residue<C extends RingElem<C>>>
Parameters:
S - Residue.
Returns:
this - (this/S)*S.

multiply

public Residue<C> multiply(Residue<C> S)
Residue multiplication.

Specified by:
multiply in interface MonoidElem<Residue<C extends RingElem<C>>>
Parameters:
S - Residue.
Returns:
this*S.

monic

public Residue<C> monic()
Residue monic.

Returns:
this with monic value part.

gcd

public Residue<C> gcd(Residue<C> b)
Greatest common divisor. Note: Not implemented, throws RuntimeException.

Specified by:
gcd in interface RingElem<Residue<C extends RingElem<C>>>
Parameters:
b - other element.
Returns:
gcd(this,b).

egcd

public Residue<C>[] egcd(Residue<C> b)
Extended greatest common divisor. Note: Not implemented, throws RuntimeException.

Specified by:
egcd in interface RingElem<Residue<C extends RingElem<C>>>
Parameters:
b - other element.
Returns:
[ gcd(this,b), c1, c2 ] with c1*this + c2*b = gcd(this,b).