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