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 boolean
protected int
Flag to remember if this residue element is a unit.private static final org.apache.logging.log4j.Logger
protected final ResidueRing
<C> Residue class factory data structure.protected final 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, 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.int
Residue comparison.copy()
Copy this.Residue division.Extended greatest common divisor.boolean
Comparison with any other object.factory()
Get the corresponding element factory.Greatest common divisor.int
hashCode()
Hash code for this local.inverse()
Residue inverse.boolean
isONE()
Is Residue one.boolean
isUnit()
Is Residue unit.boolean
isZERO()
Is Residue zero.Residue multiplication.negate()
Residue negate.Quotient and remainder by division of this by S.Residue remainder.int
signum()
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, wait
Methods 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:
isZERO
in 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:
isONE
in 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:
isUnit
in 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:
toScriptFactory
in 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:
abs
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- the absolute value of this.
- See Also:
-
sum
Residue summation.- Specified by:
sum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
S
- Residue.- Returns:
- this+S.
-
negate
Residue negate.- Specified by:
negate
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- -this.
- See Also:
-
signum
public int signum()Residue signum.- Specified by:
signum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- signum(this).
- See Also:
-
subtract
Residue subtraction.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
S
- Residue.- Returns:
- this-S.
-
divide
Residue division.- Specified by:
divide
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- Residue.- Returns:
- this/S.
-
inverse
Residue inverse.- Specified by:
inverse
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- S with S = 1/this if defined.
- See Also:
-
remainder
Residue remainder.- Specified by:
remainder
in 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:
quotientRemainder
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- a Residue- Returns:
- [this/S, this - (this/S)*S].
-
multiply
Residue multiplication.- Specified by:
multiply
in 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.
-