Package edu.jas.application
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>>
,java.io.Serializable
,java.lang.Comparable<SolvableResidue<C>>
public class SolvableResidue<C extends GcdRingElem<C>> extends java.lang.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.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
isunit
Flag to remember if this residue element is a unit. -1 is unknown, 1 is unit, 0 not a unit.SolvableResidueRing<C>
ring
SolvableResidue class factory data structure.GenSolvablePolynomial<C>
val
Value part of the element data structure.
-
Constructor Summary
Constructors Constructor Description SolvableResidue(SolvableResidueRing<C> r)
The constructor creates a SolvableResidue object from a ring factory.SolvableResidue(SolvableResidueRing<C> r, GenSolvablePolynomial<C> a)
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SolvableResidue<C>
abs()
SolvableResidue absolute value.int
compareTo(SolvableResidue<C> b)
SolvableResidue comparison.SolvableResidue<C>
copy()
Clone this.GenSolvablePolynomial<C>
denominator()
Denominator.SolvableResidue<C>
divide(SolvableResidue<C> S)
SolvableResidue division.SolvableResidue<C>[]
egcd(SolvableResidue<C> b)
Extended greatest common divisor.boolean
equals(java.lang.Object b)
Comparison with any other object.SolvableResidueRing<C>
factory()
Get the corresponding element factory.SolvableResidue<C>
gcd(SolvableResidue<C> b)
Greatest common divisor.int
hashCode()
Hash code for this residue.SolvableResidue<C>
inverse()
SolvableResidue inverse.boolean
isConstant()
Is SolvableResidue a constant.boolean
isONE()
Is SolvableResidue one.boolean
isUnit()
Is SolvableResidue unit.boolean
isZERO()
Is SolvableResidue zero.SolvableResidue<C>
monic()
SolvableResidue monic.SolvableResidue<C>
multiply(C s)
SolvableResidue<C>
multiply(SolvableResidue<C> S)
SolvableResidue multiplication.SolvableResidue<C>
multiply(ExpVector e)
SolvableResidue multiplication.SolvableResidue<C>
multiply(GenSolvablePolynomial<C> S)
SolvableResidue multiplication.SolvableResidue<C>
negate()
SolvableResidue negate.GenSolvablePolynomial<C>
numerator()
Numerator.SolvableResidue<C>
remainder(SolvableResidue<C> S)
SolvableResidue remainder.int
signum()
SolvableResidue signum.SolvableResidue<C>
subtract(SolvableResidue<C> S)
SolvableResidue subtraction.SolvableResidue<C>
sum(SolvableResidue<C> S)
SolvableResidue summation.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toScriptFactory()
Get a scripting compatible string representation of the factory.java.lang.String
toString()
Get the String representation as RingElem.GenSolvablePolynomial<C>
value()
Value.-
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, quotientRemainder, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
-
-
-
Field Detail
-
ring
public final SolvableResidueRing<C extends GcdRingElem<C>> ring
SolvableResidue class factory data structure.
-
val
public final GenSolvablePolynomial<C extends GcdRingElem<C>> val
Value part of the element data structure.
-
isunit
protected int isunit
Flag to remember if this residue element is a unit. -1 is unknown, 1 is unit, 0 not a unit.
-
-
Constructor Detail
-
SolvableResidue
public SolvableResidue(SolvableResidueRing<C> r)
The constructor creates a SolvableResidue object from a ring factory.- Parameters:
r
- solvable residue ring factory.
-
SolvableResidue
public SolvableResidue(SolvableResidueRing<C> r, GenSolvablePolynomial<C> a)
The constructor creates a SolvableResidue object from a ring factory and a polynomial.- Parameters:
r
- solvable residue ring factory.a
- solvable polynomial.
-
SolvableResidue
public 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.- Parameters:
r
- solvable residue ring factory.a
- solvable polynomial.u
- isunit indicator, -1, 0, 1.
-
-
Method Detail
-
factory
public SolvableResidueRing<C> factory()
Get the corresponding element factory.- Specified by:
factory
in interfaceElement<C extends GcdRingElem<C>>
- Returns:
- factory for this Element.
- See Also:
Element.factory()
-
value
public GenSolvablePolynomial<C> value()
Value. Returns the value.- Specified by:
value
in interfaceValue<C extends GcdRingElem<C>>
- See Also:
Value.value()
-
numerator
public GenSolvablePolynomial<C> numerator()
Numerator. Returns the value.- Specified by:
numerator
in interfaceQuotPair<C extends GcdRingElem<C>>
- See Also:
QuotPair.numerator()
-
denominator
public GenSolvablePolynomial<C> denominator()
Denominator. Returns 1.- Specified by:
denominator
in interfaceQuotPair<C extends GcdRingElem<C>>
- See Also:
QuotPair.denominator()
-
copy
public SolvableResidue<C> copy()
Clone this.- Specified by:
copy
in interfaceElement<C extends GcdRingElem<C>>
- Returns:
- Creates and returns a copy of this Element.
- See Also:
Object.clone()
-
isZERO
public boolean isZERO()
Is SolvableResidue zero.- Specified by:
isZERO
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Returns:
- If this is 0 then true is returned, else false.
- See Also:
AbelianGroupElem.isZERO()
-
isONE
public boolean isONE()
Is SolvableResidue one.- Specified by:
isONE
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Returns:
- If this is 1 then true is returned, else false.
- See Also:
MonoidElem.isONE()
-
isUnit
public boolean isUnit()
Is SolvableResidue unit.- Specified by:
isUnit
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Returns:
- If this is a unit then true is returned, else false.
- See Also:
MonoidElem.isUnit()
-
isConstant
public boolean isConstant()
Is SolvableResidue a constant.- Specified by:
isConstant
in interfaceQuotPair<C extends GcdRingElem<C>>
- Specified by:
isConstant
in interfaceValue<C extends GcdRingElem<C>>
- Returns:
- true if this.val is a constant polynomial, else false.
-
toString
public java.lang.String toString()
Get the String representation as RingElem.- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScript
in interfaceElement<C extends GcdRingElem<C>>
- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<C extends GcdRingElem<C>>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
compareTo
public int compareTo(SolvableResidue<C> b)
SolvableResidue comparison.- Specified by:
compareTo
in interfacejava.lang.Comparable<C extends GcdRingElem<C>>
- Specified by:
compareTo
in 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
public boolean equals(java.lang.Object b)
Comparison with any other object.- Specified by:
equals
in interfaceElement<C extends GcdRingElem<C>>
- Overrides:
equals
in classjava.lang.Object
- Returns:
- true means that this and b are equivalent in this residue class ring.
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this residue.- Specified by:
hashCode
in interfaceElement<C extends GcdRingElem<C>>
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hashCode.
- See Also:
Object.hashCode()
-
abs
public SolvableResidue<C> abs()
SolvableResidue absolute value.- Specified by:
abs
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Returns:
- the absolute value of this.
- See Also:
AbelianGroupElem.abs()
-
sum
public SolvableResidue<C> sum(SolvableResidue<C> S)
SolvableResidue summation.- Specified by:
sum
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Parameters:
S
- SolvableResidue.- Returns:
- this+S.
-
negate
public SolvableResidue<C> negate()
SolvableResidue negate.- Specified by:
negate
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Returns:
- -this.
- See Also:
AbelianGroupElem.negate()
-
signum
public int signum()
SolvableResidue signum.- Specified by:
signum
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Returns:
- signum(this).
- See Also:
AbelianGroupElem.signum()
-
subtract
public SolvableResidue<C> subtract(SolvableResidue<C> S)
SolvableResidue subtraction.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Parameters:
S
- SolvableResidue.- Returns:
- this-S.
-
divide
public SolvableResidue<C> divide(SolvableResidue<C> S)
SolvableResidue division.- Specified by:
divide
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Parameters:
S
- SolvableResidue.- Returns:
- this/S.
-
inverse
public SolvableResidue<C> inverse()
SolvableResidue inverse.- Specified by:
inverse
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Returns:
- S with S = 1/this if defined.
- See Also:
MonoidElem.inverse()
-
remainder
public SolvableResidue<C> remainder(SolvableResidue<C> S)
SolvableResidue remainder.- Specified by:
remainder
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Parameters:
S
- SolvableResidue.- Returns:
- this - (this/S)*S.
-
multiply
public SolvableResidue<C> multiply(SolvableResidue<C> S)
SolvableResidue multiplication.- Specified by:
multiply
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Parameters:
S
- SolvableResidue.- Returns:
- this*S.
-
multiply
public SolvableResidue<C> multiply(GenSolvablePolynomial<C> S)
SolvableResidue multiplication.- Parameters:
S
- GenSolvablePolynomial.- Returns:
- this*S.
-
multiply
public SolvableResidue<C> multiply(C s)
-
multiply
public SolvableResidue<C> multiply(ExpVector e)
SolvableResidue multiplication.- Parameters:
e
- exponent.- Returns:
- this*Xe.
-
monic
public SolvableResidue<C> monic()
SolvableResidue monic.- Returns:
- this with monic value part.
-
gcd
public SolvableResidue<C> gcd(SolvableResidue<C> b)
Greatest common divisor.- Specified by:
gcd
in interfaceRingElem<C extends GcdRingElem<C>>
- Parameters:
b
- other element.- Returns:
- gcd(this,b).
-
egcd
public SolvableResidue<C>[] egcd(SolvableResidue<C> b)
Extended greatest common divisor. Note: Not implemented, throws UnsupportedOperationException.- Specified by:
egcd
in interfaceRingElem<C extends GcdRingElem<C>>
- Parameters:
b
- other element.- Returns:
- [ gcd(this,b), c1, c2 ] with c1*this + c2*b = gcd(this,b).
-
-