Class WordResidue<C extends GcdRingElem<C>>
java.lang.Object
edu.jas.application.WordResidue<C>
- All Implemented Interfaces:
AbelianGroupElem<WordResidue<C>>, Element<WordResidue<C>>, GcdRingElem<WordResidue<C>>, MonoidElem<WordResidue<C>>, NoncomRingElem<WordResidue<C>>, QuotPair<GenWordPolynomial<C>>, RingElem<WordResidue<C>>, Value<GenWordPolynomial<C>>, Serializable, Comparable<WordResidue<C>>
public class WordResidue<C extends GcdRingElem<C>>
extends Object
implements GcdRingElem<WordResidue<C>>, NoncomRingElem<WordResidue<C>>, QuotPair<GenWordPolynomial<C>>, Value<GenWordPolynomial<C>>
WordResidue ring element based on GenWordPolynomial with GcdRingElem
interface. Objects of this class are immutable.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intFlag to remember if this residue element is a unit.final WordResidueRing<C> WordResidue class factory data structure.final GenWordPolynomial<C> Value part of the element data structure. -
Constructor Summary
ConstructorsConstructorDescriptionThe constructor creates a WordResidue object from a ring factory.WordResidue(WordResidueRing<C> r, GenWordPolynomial<C> a) The constructor creates a WordResidue object from a ring factory and a polynomial.WordResidue(WordResidueRing<C> r, GenWordPolynomial<C> a, int u) The constructor creates a WordResidue object from a ring factory, a polynomial and an indicator if a is a unit. -
Method Summary
Modifier and TypeMethodDescriptionabs()WordResidue absolute value.intcompareTo(WordResidue<C> b) WordResidue comparison.copy()Clone this.Denominator.divide(WordResidue<C> S) WordResidue left division.WordResidue<C>[]egcd(WordResidue<C> b) Extended greatest common divisor.booleanComparison with any other object.factory()Get the corresponding element factory.gcd(WordResidue<C> b) Greatest common divisor.inthashCode()Hash code for this residue.inverse()WordResidue inverse.booleanIs WordResidue a constant.booleanisONE()Is WordResidue one.booleanisUnit()Is WordResidue unit.booleanisZERO()Is WordResidue zero.monic()WordResidue monic.multiply(WordResidue<C> S) WordResidue multiplication.WordResidue multiplication.WordResidue multiplication.negate()WordResidue negate.Numerator.remainder(WordResidue<C> S) WordResidue remainder.rightDivide(WordResidue<C> S) WordResidue right division.WordResidue right remainder.intsignum()WordResidue signum.subtract(WordResidue<C> S) WordResidue subtraction.sum(WordResidue<C> S) WordResidue summation.toScript()Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()Get the String representation as RingElem.WordResidue<C>[]WordResidue two-sided division.WordResidue two-sided remainder.value()Value.Methods inherited from interface MonoidElem
leftDivide, leftRemainder, power, quotientRemainder
-
Field Details
-
ring
WordResidue 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
-
WordResidue
The constructor creates a WordResidue object from a ring factory.- Parameters:
r- solvable residue ring factory.
-
WordResidue
The constructor creates a WordResidue object from a ring factory and a polynomial.- Parameters:
r- solvable residue ring factory.a- solvable polynomial.
-
WordResidue
The constructor creates a WordResidue object from a ring factory, a polynomial and an indicator if a is a unit.- Parameters:
r- solvable residue ring factory.a- solvable 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:
-
value
Value. Returns the value.- Specified by:
valuein interfaceValue<C extends GcdRingElem<C>>- See Also:
-
numerator
Numerator. Returns the value.- Specified by:
numeratorin interfaceQuotPair<C extends GcdRingElem<C>>- See Also:
-
denominator
Denominator. Returns 1.- Specified by:
denominatorin interfaceQuotPair<C extends GcdRingElem<C>>- 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 WordResidue 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 WordResidue 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 WordResidue 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 WordResidue a constant.- Specified by:
isConstantin interfaceQuotPair<C extends GcdRingElem<C>>- Specified by:
isConstantin interfaceValue<C extends GcdRingElem<C>>- Returns:
- true if this.val is a constant polynomial, else false.
-
toString
-
toScript
-
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
WordResidue comparison.- Specified by:
compareToin interfaceComparable<C extends GcdRingElem<C>>- Specified by:
compareToin interfaceElement<C extends GcdRingElem<C>>- Parameters:
b- WordResidue.- Returns:
- sign(this-b), 0 means that this and b are equivalent in this residue class ring.
-
equals
-
hashCode
-
abs
WordResidue absolute value.- Specified by:
absin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- the absolute value of this.
- See Also:
-
sum
WordResidue summation.- Specified by:
sumin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this+S.
-
negate
WordResidue negate.- Specified by:
negatein interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- -this.
- See Also:
-
signum
public int signum()WordResidue signum.- Specified by:
signumin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- signum(this).
- See Also:
-
subtract
WordResidue subtraction.- Specified by:
subtractin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this-S.
-
divide
WordResidue left division.- Specified by:
dividein interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- left, with left*S = this
-
twosidedDivide
WordResidue two-sided division.- Specified by:
twosidedDividein interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
twosidedDividein interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- [left, right] with left*S*right + remainder = this.
-
rightDivide
WordResidue right division.- Specified by:
rightDividein interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
rightDividein interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- right, with S * right = this
-
inverse
WordResidue inverse.- Specified by:
inversein interfaceMonoidElem<C extends GcdRingElem<C>>- Returns:
- S with S = 1/this if defined.
- See Also:
-
remainder
WordResidue remainder.- Specified by:
remainderin interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this - (this/S) * S.
-
rightRemainder
WordResidue right remainder.- Specified by:
rightRemainderin interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
rightRemainderin interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- r = this - S * (S/right), where S * right = this.
-
twosidedRemainder
WordResidue two-sided remainder.- Specified by:
twosidedRemainderin interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
twosidedRemainderin interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- r = this - left*S*right.
-
multiply
WordResidue multiplication.- Specified by:
multiplyin interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this*S.
-
multiply
WordResidue multiplication.- Parameters:
S- GenWordPolynomial.- Returns:
- this*S.
-
multiply
-
multiply
WordResidue multiplication.- Parameters:
e- word.- Returns:
- this*e.
-
monic
-
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).
-