edu.jas.structure
Class Local<C extends RingElem<C>>

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

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

Local element based on RingElem pairs. Objects of this class are (nearly) immutable.

Author:
Heinz Kredel
See Also:
Serialized Form
Fix me
Not jet working because of monic GBs.

Field Summary
protected  C den
          Denominator part of the element data structure.
protected  int isunit
          Flag to remember if this local element is a unit
protected  C num
          Numerator part of the element data structure.
protected  LocalRing<C> ring
          Local class factory data structure.
 
Constructor Summary
  Local(LocalRing<C> r)
          The constructor creates a Local object from a ring factory.
  Local(LocalRing<C> r, C n)
          The constructor creates a Local object from a ring factory and a numerator element.
  Local(LocalRing<C> r, C n, C d)
          The constructor creates a Local object from a ring factory and a numerator and denominator element.
protected Local(LocalRing<C> r, C n, C d, boolean isred)
          The constructor creates a Local object from a ring factory and a numerator and denominator element.
 
Method Summary
 Local<C> abs()
          Local absolute value.
 Local<C> clone()
          Clone this.
 int compareTo(Local<C> b)
          Local comparison.
 Local<C> divide(Local<C> S)
          Local division.
 Local<C>[] egcd(Local<C> b)
          Extended greatest common divisor.
 boolean equals(java.lang.Object b)
          Comparison with any other object.
 Local<C> gcd(Local<C> b)
          Greatest common divisor.
 int hashCode()
          Hash code for this local.
 Local<C> inverse()
          Local inverse.
 boolean isONE()
          Is Local one.
 boolean isUnit()
          Is Local unit.
 boolean isZERO()
          Is Local zero.
 Local<C> multiply(Local<C> S)
          Local multiplication.
 Local<C> negate()
          Local negate.
 Local<C> remainder(Local<C> S)
          Local remainder.
 int signum()
          Local signum.
 Local<C> subtract(Local<C> S)
          Local subtraction.
 Local<C> sum(Local<C> S)
          Local 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 LocalRing<C extends RingElem<C>> ring
Local class factory data structure.


num

protected final C extends RingElem<C> num
Numerator part of the element data structure.


den

protected final C extends RingElem<C> den
Denominator part of the element data structure.


isunit

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

Constructor Detail

Local

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

Parameters:
r - ring factory.

Local

public Local(LocalRing<C> r,
             C n)
The constructor creates a Local object from a ring factory and a numerator element. The denominator is assumed to be 1.

Parameters:
r - ring factory.
n - numerator.

Local

public Local(LocalRing<C> r,
             C n,
             C d)
The constructor creates a Local object from a ring factory and a numerator and denominator element.

Parameters:
r - ring factory.
n - numerator.
d - denominator.

Local

protected Local(LocalRing<C> r,
                C n,
                C d,
                boolean isred)
The constructor creates a Local object from a ring factory and a numerator and denominator element.

Parameters:
r - ring factory.
n - numerator.
d - denominator.
isred - true if gcd(n,d) == 1, else false.
Method Detail

clone

public Local<C> clone()
Clone this.

Specified by:
clone in interface Element<Local<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 Local zero.

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

isONE

public boolean isONE()
Is Local one.

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

isUnit

public boolean isUnit()
Is Local unit.

Specified by:
isUnit in interface MonoidElem<Local<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(Local<C> b)
Local comparison.

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

equals

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

Specified by:
equals in interface Element<Local<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<Local<C extends RingElem<C>>>
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()
Returns:
the hashCode.

abs

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

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

sum

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

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

negate

public Local<C> negate()
Local negate.

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

signum

public int signum()
Local signum.

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

subtract

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

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

divide

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

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

inverse

public Local<C> inverse()
Local inverse.

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

remainder

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

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

multiply

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

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

gcd

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

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

egcd

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

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