|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.rubato.math.module.RingElement
org.rubato.math.module.PolynomialElement
public final class PolynomialElement
Elements in a ring of polynomials.
PolynomialRing
,
Serialized FormConstructor Summary | |
---|---|
PolynomialElement(PolynomialRing ring,
RingElement... coefficients)
Constructs a polynomial in a specified ring with given coefficents. |
|
PolynomialElement(java.lang.String indeterminate,
RingElement... coefficients)
Constructs a polynomial with given coefficents. |
Method Summary | |
---|---|
void |
add(ModuleElement element)
Adds element to this module element. |
void |
add(PolynomialElement element)
|
ModuleElement |
cast(Module module)
Tries to cast this element to an element in the given module. |
PolynomialElement |
clone()
Returns a deep copy of this module element. |
int |
compareTo(ModuleElement object)
Compares this module element with object . |
PolynomialElement |
difference(ModuleElement element)
Returns the difference of this module element and element . |
PolynomialElement |
difference(PolynomialElement element)
|
void |
divide(PolynomialElement element)
|
void |
divide(RingElement element)
Replaces this by the solution x of
element *x = this , if it exists,
otherwise a DivisionException is thrown. |
boolean |
divides(RingElement element)
Return true iff the solution x of this *x = element
exists. |
boolean |
equals(java.lang.Object object)
Returns true iff this element is equal to object . |
RingElement |
evaluate(RingElement element)
|
PolynomialElement |
exgcd(PolynomialElement y,
PolynomialElement[] res)
The extended Euclidean algorithm. |
double[] |
fold(ModuleElement[] elements)
Fold elements assuming they are of this same type. |
ModuleElement |
fromXML(XMLReader reader,
org.w3c.dom.Element element)
Reads XML representation from reader starting with element . |
PolynomialElement |
gcd(PolynomialElement element)
Returns the greatest common divisior of this and element . |
RingElement |
getCoefficient(int power)
|
Ring |
getCoefficientRing()
Returns the ring of the coefficients of the polynomial. |
RingElement[] |
getCoefficients()
|
int |
getDegree()
|
java.lang.String |
getElementTypeName()
Returns the value of the type attribute for this class. |
java.lang.String |
getIndeterminate()
Returns the indeterminate of the polynomial. |
RingElement |
getLeadingCoefficient()
|
PolynomialRing |
getModule()
Returns the module that this module element is an element of. |
PolynomialRing |
getRing()
Returns the ring this element is a member of. |
static XMLInputOutput<ModuleElement> |
getXMLInputOutput()
|
int |
hashCode()
Returns the hash code for this module element. |
PolynomialElement |
inverse()
Returns the inverse of this ring element, if it has an inverse. |
void |
invert()
Inverts this ring element, if it has an inverse. |
boolean |
isInvertible()
Returns true if this ring element is invertible. |
boolean |
isOne()
Returns true if this ring element is one. |
boolean |
isZero()
Returns true iff this element is zero. |
void |
multiply(PolynomialElement element)
|
void |
multiply(RingElement element)
Multiplies this ring element with element . |
void |
negate()
Negate this module element. |
PolynomialElement |
negated()
Returns the negative of this module element. |
PolynomialElement |
product(PolynomialElement element)
|
PolynomialElement |
product(RingElement element)
Returns the product of this ring element with element . |
PolynomialElement |
quo(PolynomialElement element)
|
PolynomialElement |
quorem(PolynomialElement element,
PolynomialElement[] remainder)
|
PolynomialElement |
quotient(PolynomialElement element)
|
PolynomialElement |
quotient(RingElement element)
Returns the solution x of element *x = this ,
if it exists, otherwise a DivisionException is thrown. |
PolynomialElement |
rem(PolynomialElement element)
|
PolynomialFreeElement |
resize(int n)
Returns this free element resized to length n . |
void |
scale(RingElement element)
Multiplies this element with element . |
PolynomialElement |
scaled(RingElement element)
Returns the product of this element with element . |
java.lang.String |
stringRep(boolean... parens)
Returns a string representation of this module element. |
void |
subtract(ModuleElement element)
Subtracts element from this module element. |
void |
subtract(PolynomialElement element)
|
PolynomialElement |
sum(ModuleElement element)
Returns the sum of this module element and element . |
PolynomialElement |
sum(PolynomialElement element)
|
java.lang.String |
toString()
Returns a human readable string representation of this module element. |
void |
toXML(XMLWriter writer)
Outputs XML representation to writer . |
Methods inherited from class org.rubato.math.module.RingElement |
---|
difference, getComponent, getLength, getRingElement, iterator, multiplyCW, power, productCW, sum |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.rubato.math.module.FreeElement |
---|
getComponent, getLength, getRingElement, iterator, multiplyCW, productCW |
Constructor Detail |
---|
public PolynomialElement(PolynomialRing ring, RingElement... coefficients)
coefficients
contains the coefficient of power n
at index n
.
ring
- the ring of polynomialscoefficients
- elements of the coefficient ringpublic PolynomialElement(java.lang.String indeterminate, RingElement... coefficients)
coefficients
contains the coefficient of power n
at index n
.
The polynomial ring is inferred from the coefficients, which must all
be elements of the the same ring.
coefficients
- elements of the coefficient ringMethod Detail |
---|
public boolean isOne()
RingElement
isOne
in class RingElement
public boolean isZero()
ModuleElement
isZero
in interface ModuleElement
public PolynomialElement sum(ModuleElement element) throws DomainException
ModuleElement
element
.
sum
in interface ModuleElement
DomainException
- if element
is not in domainpublic PolynomialElement sum(PolynomialElement element) throws DomainException
DomainException
public void add(ModuleElement element) throws DomainException
ModuleElement
element
to this module element.
This is a destructive operation.
add
in interface ModuleElement
DomainException
- if element
is not in domainpublic void add(PolynomialElement element) throws DomainException
DomainException
public PolynomialElement difference(ModuleElement element) throws DomainException
ModuleElement
element
.
difference
in interface ModuleElement
DomainException
- if element
is not in domainpublic PolynomialElement difference(PolynomialElement element) throws DomainException
DomainException
public void subtract(ModuleElement element) throws DomainException
ModuleElement
element
from this module element.
This is a destructive operation.
subtract
in interface ModuleElement
DomainException
- if element
is not in domainpublic void subtract(PolynomialElement element) throws DomainException
DomainException
public PolynomialElement negated()
ModuleElement
negated
in interface ModuleElement
public void negate()
ModuleElement
negate
in interface ModuleElement
public PolynomialElement scaled(RingElement element) throws DomainException
ModuleElement
element
.
scaled
in interface ModuleElement
DomainException
- if element
is not in domainpublic void scale(RingElement element) throws DomainException
ModuleElement
element
.
This is a destructive operation.
scale
in interface ModuleElement
DomainException
- if element
is not in domainpublic PolynomialElement product(RingElement element) throws DomainException
RingElement
element
.
product
in class RingElement
DomainException
- if element
is not in domainpublic PolynomialElement product(PolynomialElement element) throws DomainException
DomainException
public void multiply(RingElement element) throws DomainException
RingElement
element
.
multiply
in class RingElement
DomainException
- if element
is not in domainpublic void multiply(PolynomialElement element) throws DomainException
DomainException
public boolean isInvertible()
RingElement
isInvertible
in class RingElement
public PolynomialElement inverse()
RingElement
inverse
in class RingElement
public void invert()
RingElement
invert
in class RingElement
public PolynomialElement quotient(RingElement element) throws DomainException, DivisionException
RingElement
element
*x = this
,
if it exists, otherwise a DivisionException is thrown.
quotient
in class RingElement
DomainException
DivisionException
public PolynomialElement quotient(PolynomialElement element) throws DomainException, DivisionException
DomainException
DivisionException
public void divide(RingElement element) throws DomainException, DivisionException
RingElement
this
by the solution x of
element
*x = this
, if it exists,
otherwise a DivisionException is thrown.
divide
in class RingElement
DomainException
DivisionException
public void divide(PolynomialElement element) throws DomainException, DivisionException
DomainException
DivisionException
public boolean divides(RingElement element)
RingElement
this
*x = element
exists.
divides
in class RingElement
public PolynomialElement quorem(PolynomialElement element, PolynomialElement[] remainder) throws DomainException, DivisionException
DomainException
DivisionException
public PolynomialElement quo(PolynomialElement element) throws DomainException, DivisionException
DomainException
DivisionException
public PolynomialElement rem(PolynomialElement element) throws DomainException, DivisionException
DomainException
DivisionException
public PolynomialElement gcd(PolynomialElement element) throws DomainException, DivisionException
this
and element
.
DomainException
DivisionException
public PolynomialElement exgcd(PolynomialElement y, PolynomialElement[] res) throws DomainException, DivisionException
res
- is an array of polynomials that will contain two values such that:
res[0]*x + res[1]*y = gcd(x,y)
DomainException
DivisionException
public RingElement evaluate(RingElement element) throws DomainException
DomainException
public PolynomialRing getModule()
ModuleElement
getModule
in interface ModuleElement
public PolynomialRing getRing()
RingElement
getRing
in class RingElement
public RingElement[] getCoefficients()
public RingElement getCoefficient(int power)
public RingElement getLeadingCoefficient()
public int getDegree()
public Ring getCoefficientRing()
PolynomialFreeElement
getCoefficientRing
in interface PolynomialFreeElement
public java.lang.String getIndeterminate()
PolynomialFreeElement
getIndeterminate
in interface PolynomialFreeElement
public PolynomialFreeElement resize(int n)
FreeElement
n
.
If the new length n
is greater than the old length,
the new values are filled with the zero of the underlying ring.
If the new length n
is less than the old length,
the vector of values is simply truncated.
resize
in interface FreeElement
public boolean equals(java.lang.Object object)
ModuleElement
object
.
equals
in interface ModuleElement
equals
in class java.lang.Object
public int compareTo(ModuleElement object)
ModuleElement
object
.
compareTo
in interface java.lang.Comparable<ModuleElement>
compareTo
in interface ModuleElement
compareTo
in class RingElement
public PolynomialElement clone()
ModuleElement
clone
in interface ModuleElement
clone
in class RingElement
public java.lang.String stringRep(boolean... parens)
ModuleElement
stringRep
in interface ModuleElement
stringRep
in class RingElement
public java.lang.String toString()
ModuleElement
toString
in interface ModuleElement
toString
in class java.lang.Object
public double[] fold(ModuleElement[] elements)
ModuleElement
elements
assuming they are of this same type.
fold
in interface ModuleElement
public ModuleElement cast(Module module)
ModuleElement
cast
in interface ModuleElement
public void toXML(XMLWriter writer)
XMLInputOutput
writer
.
toXML
in interface XMLInputOutput<ModuleElement>
public ModuleElement fromXML(XMLReader reader, org.w3c.dom.Element element)
XMLInputOutput
reader
starting with element
.
fromXML
in interface XMLInputOutput<ModuleElement>
public static XMLInputOutput<ModuleElement> getXMLInputOutput()
public java.lang.String getElementTypeName()
XMLInputOutput
getElementTypeName
in interface XMLInputOutput<ModuleElement>
public int hashCode()
ModuleElement
hashCode
in interface ModuleElement
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |