Package edu.jas.poly
Class Residue<C extends RingElem<C>>
java.lang.Object
edu.jas.poly.Residue<C>
- All Implemented Interfaces:
AbelianGroupElem<Residue<C>>,Element<Residue<C>>,MonoidElem<Residue<C>>,RingElem<Residue<C>>,Serializable,Comparable<Residue<C>>
Residue element based on RingElem residue. Objects of this class are (nearly)
immutable.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprotected intFlag to remember if this residue element is a unit.private static final org.apache.logging.log4j.Loggerprotected final ResidueRing<C> Residue class factory data structure.protected final CValue 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, C a) The constructor creates a Residue object from a ring factory and a ring element.Residue(ResidueRing<C> r, C a, int u) The constructor creates a Residue object from a ring factory, a ring element and an indicator if a is a unit. -
Method Summary
Modifier and TypeMethodDescriptionabs()Residue absolute value.intResidue comparison.copy()Copy 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 local.inverse()Residue inverse.booleanisONE()Is Residue one.booleanisUnit()Is Residue unit.booleanisZERO()Is Residue zero.Residue multiplication.negate()Residue negate.Quotient and remainder by division of this by S.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, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
debug
private static final boolean debug -
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- ring factory.
-
Residue
The constructor creates a Residue object from a ring factory and a ring element.- Parameters:
r- ring factory.a- ring element.
-
Residue
The constructor creates a Residue object from a ring factory, a ring element and an indicator if a is a unit.- Parameters:
r- ring factory.a- ring element.u- isunit indicator, -1, 0, 1.
-
-
Method Details
-
factory
Get the corresponding element factory. -
copy
Copy this. -
isZERO
public boolean isZERO()Is Residue zero.- Specified by:
isZEROin interfaceAbelianGroupElem<C extends RingElem<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 RingElem<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 RingElem<C>>- Returns:
- If this is a unit then true is returned, else false.
- See Also:
-
toString
Get the String representation as RingElem. -
toScript
Get a scripting compatible string representation. -
toScriptFactory
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactoryin interfaceElement<C extends RingElem<C>>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
compareTo
Residue comparison. -
equals
Comparison with any other object. -
hashCode
public int hashCode()Hash code for this local. -
abs
Residue absolute value.- Specified by:
absin interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- the absolute value of this.
- See Also:
-
sum
Residue summation.- Specified by:
sumin interfaceAbelianGroupElem<C extends RingElem<C>>- Parameters:
S- Residue.- Returns:
- this+S.
-
negate
Residue negate.- Specified by:
negatein interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- -this.
- See Also:
-
signum
public int signum()Residue signum.- Specified by:
signumin interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- signum(this).
- See Also:
-
subtract
Residue subtraction.- Specified by:
subtractin interfaceAbelianGroupElem<C extends RingElem<C>>- Parameters:
S- Residue.- Returns:
- this-S.
-
divide
Residue division.- Specified by:
dividein interfaceMonoidElem<C extends RingElem<C>>- Parameters:
S- Residue.- Returns:
- this/S.
-
inverse
Residue inverse.- Specified by:
inversein interfaceMonoidElem<C extends RingElem<C>>- Returns:
- S with S = 1/this if defined.
- See Also:
-
remainder
Residue remainder.- Specified by:
remainderin interfaceMonoidElem<C extends RingElem<C>>- Parameters:
S- Residue.- Returns:
- this - (this/S)*S.
-
quotientRemainder
Quotient and remainder by division of this by S.- Specified by:
quotientRemainderin interfaceMonoidElem<C extends RingElem<C>>- Parameters:
S- a Residue- Returns:
- [this/S, this - (this/S)*S].
-
multiply
Residue multiplication.- Specified by:
multiplyin interfaceMonoidElem<C extends RingElem<C>>- Parameters:
S- Residue.- Returns:
- this*S.
-
gcd
Greatest common divisor. Note: Not implemented, throws UnsupportedOperationException. -
egcd
Extended greatest common divisor. Note: Not implemented, throws UnsupportedOperationException.
-