public interface RingElement extends Element
| Modifier and Type | Method and Description |
|---|---|
RingElement |
add(Element e)
Computes \(\text{this} + e\).
|
default java.math.BigInteger |
asInteger()
Interprets this element as an integer.
|
default RingElement |
div(Element e)
Computes \(\text{this} / e = \text{this} \cdot e^{-1}\).
|
boolean |
divides(RingElement e)
Returns true iff there exists an \(x\) in the ring such that \(\text{this} \cdot x = e\).
|
RingElement[] |
divideWithRemainder(RingElement e)
Divides this by e with remainder, returning both quotient and remainder.
|
java.math.BigInteger |
getRank()
Implements the euclidean function of a euclidean domain.
|
Ring |
getStructure()
Returns the
Structure that this Element belongs to. |
RingElement |
inv()
Computes the multiplicative inverse of this element.
|
default boolean |
isOne()
Returns true iff this is the one element of the ring.
|
default boolean |
isUnit()
Determines whether an element has a multiplicative inverse.
|
default boolean |
isZero()
Returns true iff this is the zero element of the ring.
|
default RingElement |
mul(java.math.BigInteger k)
Computes \(\text{this} \cdot k\) (equivalent to \(\text{this} + \text{this} + \cdots\) k-times).
|
RingElement |
mul(Element e)
Computes \(\text{this} \cdot e\).
|
default RingElement |
mul(long k)
Computes \(\text{this} \cdot k\) (equivalent to \(\text{this} + \text{this} + \cdots\) k-times).
|
RingElement |
neg()
Computes the additive inverse of this element.
|
default RingElement |
pow(java.math.BigInteger k)
Calculates \(\text{this}^k\).
|
default RingElement |
pow(long k)
Calculates \(\text{this}^k\).
|
default RingElement |
square()
Computes \(\text{this}^2\).
|
default RingElement |
sub(Element e)
Computes \(\text{this} - e\).
|
default GroupElement |
toAdditiveGroupElement()
Interprets this element as an element of this rings additive group.
|
default GroupElement |
toUnitGroupElement()
Interprets this element as an element of this ring's unit group.
|
getRepresentationgetUniqueByteRepresentation, updateAccumulatorRing getStructure()
ElementStructure that this Element belongs to.getStructure in interface Elementdefault GroupElement toUnitGroupElement()
default GroupElement toAdditiveGroupElement()
RingElement add(Element e)
e - the addendRingElement neg()
default RingElement sub(Element e)
e - the subtrahendRingElement mul(Element e)
e - the factordefault RingElement mul(java.math.BigInteger k)
k - the factordefault RingElement mul(long k)
k - the factordefault RingElement pow(java.math.BigInteger k)
Note that \(a^0 = 1\) for any \(a\) in the ring, particularly \(0^0 = 1\).
default RingElement pow(long k)
Note that \(a^0 = 1\) for any \(a\) in the ring, particularly \(0^0 = 1\).
RingElement inv() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if this is not a unitdefault boolean isUnit()
default RingElement div(Element e) throws java.lang.IllegalArgumentException
e - the divisorjava.lang.IllegalArgumentException - if e is not a unitboolean divides(RingElement e) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if this cannot be decided (efficiently)RingElement[] divideWithRemainder(RingElement e) throws java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
Specifically, returns an array result such that the first entry contains the quotient
and the second entry the remainder.
Furthermore, result[1].getRank() < e.getRank() or result[1] = 0.
This definition implies that the remainder is zero if and only if e divides this element.
java.lang.UnsupportedOperationException - if the ring is not a euclidean domainjava.lang.IllegalArgumentException - if e is zerojava.math.BigInteger getRank()
throws java.lang.UnsupportedOperationException
The euclidean function is a function from \(R \setminus \{0\}\) to \(\mathbb{N}_0\) such that
a.getRank() >= 0 for any a in the ring
a.mul(b).getRank() >= a.getRank() for any a, b != 0
divideWithRemainder is less than the divisor's rank
The rank of the zero element is undefined (no guarantee as to what this method returns in that case).
java.lang.UnsupportedOperationException - if the ring is not a euclidean domaindefault boolean isZero()
default boolean isOne()
default RingElement square()
Useful if the ring allows squaring to be more efficiently implemented than general exponentiation.
default java.math.BigInteger asInteger()
throws java.lang.UnsupportedOperationException
Result will be between 0 and the ring's characteristic.
Formally, this method shall return the inverse of Ring.getElement(BigInteger), i.e.
x.getStructure().getElement(x.asInteger()).equals(x) (if asInteger() doesn't throw an exception).
java.lang.UnsupportedOperationException - if no such element exists or cannot be efficiently computed