Package edu.jas.application
Class Residue<C extends GcdRingElem<C>>
java.lang.Object
edu.jas.application.Residue<C>
- All Implemented Interfaces:
AbelianGroupElem<Residue<C>>,Element<Residue<C>>,GcdRingElem<Residue<C>>,MonoidElem<Residue<C>>,RingElem<Residue<C>>,Serializable,Comparable<Residue<C>>
Residue ring element based on GenPolynomial with RingElem interface. Objects
of this class are (nearly) immutable.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intFlag to remember if this residue element is a unit.final ResidueRing<C> Residue class factory data structure.final GenPolynomial<C> Value part of the element data structure. -
Constructor Summary
ConstructorsConstructorDescriptionResidue(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
Modifier and TypeMethodDescriptionabs()Residue absolute value.intResidue comparison.copy()Clone this.Residue division.Extended greatest common divisor.booleanComparison with any other object.factory()Get the corresponding element factory.Greatest common divisor.inthashCode()Hash code for this residue.inverse()Residue inverse.booleanIs Residue a constant.booleanisONE()Is Residue one.booleanisUnit()Is Residue unit.booleanisZERO()Is Residue zero.monic()Residue monic.Residue multiplication.negate()Residue negate.Residue remainder.intsignum()Residue signum.Residue subtraction.Residue summation.toScript()Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()Get the String representation as RingElem.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, quotientRemainder, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
ring
Residue class factory data structure. -
val
Value part of the element data structure. -
isunit
protected int isunitFlag to remember if this residue element is a unit. -1 is unknown, 1 is unit, 0 not a unit.
-
-
Constructor Details
-
Residue
The constructor creates a Residue object from a ring factory.- Parameters:
r- residue ring factory.
-
Residue
The constructor creates a Residue object from a ring factory and a polynomial.- Parameters:
r- residue ring factory.a- polynomial.
-
Residue
The constructor creates a Residue object from a ring factory, a polynomial and an indicator if a is a unit.- Parameters:
r- residue ring factory.a- polynomial.u- isunit indicator, -1, 0, 1.
-
-
Method Details
-
factory
Get the corresponding element factory.- Specified by:
factoryin interfaceElement<C extends GcdRingElem<C>>- Returns:
- factory for this Element.
- See Also:
-
copy
Clone this.- Specified by:
copyin interfaceElement<C extends GcdRingElem<C>>- Returns:
- Creates and returns a copy of this Element.
- See Also:
-
isZERO
public boolean isZERO()Is Residue zero.- Specified by:
isZEROin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- If this is 0 then true is returned, else false.
- See Also:
-
isONE
public boolean isONE()Is Residue one.- Specified by:
isONEin interfaceMonoidElem<C extends GcdRingElem<C>>- Returns:
- If this is 1 then true is returned, else false.
- See Also:
-
isUnit
public boolean isUnit()Is Residue unit.- Specified by:
isUnitin interfaceMonoidElem<C extends GcdRingElem<C>>- Returns:
- If this is a unit then true is returned, else false.
- See Also:
-
isConstant
public boolean isConstant()Is Residue a constant.- Returns:
- true if this.val is a constant polynomial, else false.
-
toString
Get the String representation as RingElem. -
toScript
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElement<C extends GcdRingElem<C>>- Returns:
- script compatible representation for this Element.
- See Also:
-
toScriptFactory
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactoryin interfaceElement<C extends GcdRingElem<C>>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
compareTo
Residue comparison.- Specified by:
compareToin interfaceComparable<C extends GcdRingElem<C>>- Specified by:
compareToin interfaceElement<C extends GcdRingElem<C>>- Parameters:
b- Residue.- Returns:
- sign(this-b), 0 means that this and b are equivalent in this residue class ring.
-
equals
Comparison with any other object. -
hashCode
public int hashCode()Hash code for this residue. -
abs
Residue absolute value.- Specified by:
absin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- the absolute value of this.
- See Also:
-
sum
Residue summation.- Specified by:
sumin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Parameters:
S- Residue.- Returns:
- this+S.
-
negate
Residue negate.- Specified by:
negatein interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- -this.
- See Also:
-
signum
public int signum()Residue signum.- Specified by:
signumin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- signum(this).
- See Also:
-
subtract
Residue subtraction.- Specified by:
subtractin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Parameters:
S- Residue.- Returns:
- this-S.
-
divide
Residue division.- Specified by:
dividein interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- Residue.- Returns:
- this/S.
-
inverse
Residue inverse.- Specified by:
inversein interfaceMonoidElem<C extends GcdRingElem<C>>- Returns:
- S with S = 1/this if defined.
- See Also:
-
remainder
Residue remainder.- Specified by:
remainderin interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- Residue.- Returns:
- this - (this/S)*S.
-
multiply
Residue multiplication.- Specified by:
multiplyin interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- Residue.- Returns:
- this*S.
-
monic
Residue monic.- Returns:
- this with monic value part.
-
gcd
Greatest common divisor.- Specified by:
gcdin interfaceRingElem<C extends GcdRingElem<C>>- Parameters:
b- other element.- Returns:
- gcd(this,b).
-
egcd
Extended greatest common divisor. Note: Not implemented, throws UnsupportedOperationException.- Specified by:
egcdin interfaceRingElem<C extends GcdRingElem<C>>- Parameters:
b- other element.- Returns:
- [ gcd(this,b), c1, c2 ] with c1*this + c2*b = gcd(this,b).
-