com.perisic.ring
Class ModularRing

java.lang.Object
  extended by com.perisic.ring.Ring
      extended by com.perisic.ring.ModularRing
Direct Known Subclasses:
CyclotomicField

public class ModularRing
extends Ring

Implements a ring R/fR where R is an element of the ring R.

Currently only implemented for polynomial rings R. Might therefore be used for constructing algebraic extensions over fields.

Use the class ModularIntegerRing for constructing Z/mZ.

Version:
0.1
Author:
Marc Conrad

Field Summary
 
Fields inherited from class com.perisic.ring.Ring
C, F2, Q, R, Z
 
Constructor Summary
ModularRing(RingElt m)
          Constructs m.getRing()/m * m.getRing().
 
Method Summary
 RingElt add(RingElt a, RingElt b)
          Addition.
 void displayMod()
          Determins the behaviour of the eltToString() method.
 java.lang.String eltToString(RingElt a)
          Returns a in the form "a" or "a mod f" depending on the value of hideMod.
 boolean equalZero(RingElt b)
          true if b == 0, false otherwise.
 boolean getHideMod()
          true if hideMod() has been called.
 RingElt getModulus()
          Returns f if this is R/fR.
 RingElt getValue(RingElt b)
          Returns the value of b as an element of R.
 void hideMod()
          Determins the behaviour of the eltToString() method.
 RingElt inv(RingElt b)
          Returns the inverse b.
 RingElt map(RingElt a)
          If the ring of a is a quotient field we map the quotient of numerator and denominator.
 RingElt map(java.lang.String str)
          Maps str first into R, then into this.
 RingElt mult(RingElt a, RingElt b)
          Multiplication.
 RingElt neg(RingElt b)
          Returns -b.
 RingElt one()
          Returns 1.
 void setHideMod(boolean hideMod)
          Determins the behaviour of the eltToString() method.
 RingElt zero()
          Returns 0.
 
Methods inherited from class com.perisic.ring.Ring
div, ediv, equal, evaluatePolynomial, gcd, isEuclidian, isField, isUFD, map, map, map, mod, pow, pow, sub, tdiv
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModularRing

public ModularRing(RingElt m)
Constructs m.getRing()/m * m.getRing(). Currently only implemented for polynomial rings.

Method Detail

setHideMod

public void setHideMod(boolean hideMod)
Determins the behaviour of the eltToString() method. If method is called with true, the return value of eltToString() is of the form "a" instead of "a mod b".


hideMod

public void hideMod()
Determins the behaviour of the eltToString() method. If this method is called, the return value of eltToString() is of the form "a" instead of "a mod b".


displayMod

public void displayMod()
Determins the behaviour of the eltToString() method. If this method is called, the return value of eltToString() is of the form "a mod b" instead of "a". This is the default.


getHideMod

public boolean getHideMod()
true if hideMod() has been called. False otherwise.


getModulus

public RingElt getModulus()
Returns f if this is R/fR.


getValue

public RingElt getValue(RingElt b)
Returns the value of b as an element of R.


add

public RingElt add(RingElt a,
                   RingElt b)
Addition.

Specified by:
add in class Ring

mult

public RingElt mult(RingElt a,
                    RingElt b)
Multiplication.

Specified by:
mult in class Ring

one

public RingElt one()
Returns 1.

Overrides:
one in class Ring

zero

public RingElt zero()
Returns 0.

Specified by:
zero in class Ring

inv

public RingElt inv(RingElt b)
Returns the inverse b.

Overrides:
inv in class Ring
Throws:
RingException - if gcd(b,f) != 1.

neg

public RingElt neg(RingElt b)
Returns -b.

Specified by:
neg in class Ring

equalZero

public boolean equalZero(RingElt b)
true if b == 0, false otherwise.

Specified by:
equalZero in class Ring

map

public RingElt map(java.lang.String str)
Maps str first into R, then into this.

Overrides:
map in class Ring

map

public RingElt map(RingElt a)
If the ring of a is a quotient field we map the quotient of numerator and denominator. Otherwise we map a first into R, then into this Ring. If a.getRing().equals(this), a is also mapped.

Overrides:
map in class Ring

eltToString

public java.lang.String eltToString(RingElt a)
Returns a in the form "a" or "a mod f" depending on the value of hideMod.

Overrides:
eltToString in class Ring