edu.jas.poly
Class ResidueRing<C extends RingElem<C>>

java.lang.Object
  extended by edu.jas.poly.ResidueRing<C>
All Implemented Interfaces:
AbelianGroupFactory<Residue<C>>, ElemFactory<Residue<C>>, MonoidFactory<Residue<C>>, RingFactory<Residue<C>>, java.io.Serializable

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

Residue ring factory based on RingElem and RingFactory module. Objects of this class are immutable.

Author:
Heinz Kredel
See Also:
Serialized Form

Field Summary
protected  int isField
          Indicator if this ring is a field.
protected  C modul
          Ring element for reduction.
protected  RingFactory<C> ring
          Ring factory.
 
Constructor Summary
ResidueRing(RingFactory<C> r, C m)
          The constructor creates a ResidueRing object from an ring factory and a modul.
 
Method Summary
 java.math.BigInteger characteristic()
          Characteristic of this ring.
 Residue<C> copy(Residue<C> c)
          Copy Residue element c.
 boolean equals(java.lang.Object b)
          Comparison with any other object.
 Residue<C> fromInteger(java.math.BigInteger a)
          Get a Residue element from a BigInteger value.
 Residue<C> fromInteger(long a)
          Get a Residue element from a long value.
 java.util.List<Residue<C>> generators()
          Get a list of the generating elements.
 Residue<C> getONE()
          Get the one element.
 Residue<C> getZERO()
          Get the zero element.
 int hashCode()
          Hash code for this residue ring.
 boolean isAssociative()
          Query if this ring is associative.
 boolean isCommutative()
          Query if this ring is commutative.
 boolean isField()
          Query if this ring is a field.
 boolean isFinite()
          Is this structure finite or infinite.
 Residue<C> parse(java.io.Reader r)
          Parse Residue from Reader.
 Residue<C> parse(java.lang.String s)
          Parse Residue from String.
 Residue<C> random(int n)
          Residue random.
 Residue<C> random(int n, java.util.Random rnd)
          Residue random.
 java.lang.String toScript()
          Get a scripting compatible string representation.
 java.lang.String toString()
          Get the String representation as RingFactory.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

modul

protected final C extends RingElem<C> modul
Ring element for reduction.


ring

protected final RingFactory<C extends RingElem<C>> ring
Ring factory.


isField

protected int isField
Indicator if this ring is a field.

Constructor Detail

ResidueRing

public ResidueRing(RingFactory<C> r,
                   C m)
The constructor creates a ResidueRing object from an ring factory and a modul.

Parameters:
r - ring factory.
m - modul.
Method Detail

isFinite

public boolean isFinite()
Is this structure finite or infinite.

Specified by:
isFinite in interface ElemFactory<Residue<C extends RingElem<C>>>
Returns:
true if this structure is finite, else false.
See Also:
ElemFactory.isFinite()

copy

public Residue<C> copy(Residue<C> c)
Copy Residue element c.

Specified by:
copy in interface ElemFactory<Residue<C extends RingElem<C>>>
Parameters:
c -
Returns:
a copy of c.

getZERO

public Residue<C> getZERO()
Get the zero element.

Specified by:
getZERO in interface AbelianGroupFactory<Residue<C extends RingElem<C>>>
Returns:
0 as Residue.

getONE

public Residue<C> getONE()
Get the one element.

Specified by:
getONE in interface MonoidFactory<Residue<C extends RingElem<C>>>
Returns:
1 as Residue.

generators

public java.util.List<Residue<C>> generators()
Get a list of the generating elements.

Specified by:
generators in interface ElemFactory<Residue<C extends RingElem<C>>>
Returns:
list of generators for the algebraic structure.
See Also:
ElemFactory.generators()

isCommutative

public boolean isCommutative()
Query if this ring is commutative.

Specified by:
isCommutative in interface MonoidFactory<Residue<C extends RingElem<C>>>
Returns:
true if this ring is commutative, else false.

isAssociative

public boolean isAssociative()
Query if this ring is associative.

Specified by:
isAssociative in interface MonoidFactory<Residue<C extends RingElem<C>>>
Returns:
true if this ring is associative, else false.

isField

public boolean isField()
Query if this ring is a field.

Specified by:
isField in interface RingFactory<Residue<C extends RingElem<C>>>
Returns:
false.

characteristic

public java.math.BigInteger characteristic()
Characteristic of this ring.

Specified by:
characteristic in interface RingFactory<Residue<C extends RingElem<C>>>
Returns:
characteristic of this ring.

fromInteger

public Residue<C> fromInteger(java.math.BigInteger a)
Get a Residue element from a BigInteger value.

Specified by:
fromInteger in interface ElemFactory<Residue<C extends RingElem<C>>>
Parameters:
a - BigInteger.
Returns:
a Residue.

fromInteger

public Residue<C> fromInteger(long a)
Get a Residue element from a long value.

Specified by:
fromInteger in interface ElemFactory<Residue<C extends RingElem<C>>>
Parameters:
a - long.
Returns:
a Residue.

toString

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

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

toScript

public java.lang.String toScript()
Get a scripting compatible string representation.

Specified by:
toScript in interface ElemFactory<Residue<C extends RingElem<C>>>
Returns:
script compatible representation for this ElemFactory.
See Also:
ElemFactory.toScript()

equals

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

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

hashCode

public int hashCode()
Hash code for this residue ring.

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

random

public Residue<C> random(int n)
Residue random.

Specified by:
random in interface ElemFactory<Residue<C extends RingElem<C>>>
Parameters:
n - such that 0 ≤ v ≤ (2n-1).
Returns:
a random residue element.

random

public Residue<C> random(int n,
                         java.util.Random rnd)
Residue random.

Specified by:
random in interface ElemFactory<Residue<C extends RingElem<C>>>
Parameters:
n - such that 0 ≤ v ≤ (2n-1).
rnd - is a source for random bits.
Returns:
a random residue element.

parse

public Residue<C> parse(java.lang.String s)
Parse Residue from String.

Specified by:
parse in interface ElemFactory<Residue<C extends RingElem<C>>>
Parameters:
s - String.
Returns:
Residue from s.

parse

public Residue<C> parse(java.io.Reader r)
Parse Residue from Reader.

Specified by:
parse in interface ElemFactory<Residue<C extends RingElem<C>>>
Parameters:
r - Reader.
Returns:
next Residue from r.