Package edu.jas.poly
Class GenExteriorPolynomial<C extends RingElem<C>>
java.lang.Object
edu.jas.poly.GenExteriorPolynomial<C>
- Type Parameters:
C
- coefficient type
- All Implemented Interfaces:
AbelianGroupElem<GenExteriorPolynomial<C>>
,Element<GenExteriorPolynomial<C>>
,MonoidElem<GenExteriorPolynomial<C>>
,RingElem<GenExteriorPolynomial<C>>
,Serializable
,Comparable<GenExteriorPolynomial<C>>
,Iterable<IndexListMonomial<C>>
public final class GenExteriorPolynomial<C extends RingElem<C>>
extends Object
implements RingElem<GenExteriorPolynomial<C>>, Iterable<IndexListMonomial<C>>
GenExteriorPolynomial generic polynomials implementing RingElem.
Antisymmetric polynomials (in fact vectors) over C. Objects of this class are
intended to be immutable. The implementation is based on TreeMap respectively
SortedMap from index lists to coefficients. Only the coefficients are modeled
with generic types, the "exponents" are fixed to IndexList. C can also be a
non integral domain, e.g. a ModInteger, i.e. it may contain zero divisors,
since multiply() does check for zero coefficients and index lists.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor for zero GenExteriorPolynomial.Constructor for GenExteriorPolynomial c * x0.Constructor for GenExteriorPolynomial c * xe.Constructor for GenExteriorPolynomial c * xe.Constructor for GenExteriorPolynomial xe.Constructor for GenExteriorPolynomial xe.protected
Constructor for GenExteriorPolynomial.private
Private constructor for GenExteriorPolynomial. -
Method Summary
Modifier and TypeMethodDescriptionabs()
GenExteriorPolynomial absolute value, i.e.Coefficient.Iterator over coefficients.GenExteriorPolynomial coefficient primitive part.int
GenExteriorPolynomial comparison.copy()
Copy this GenExteriorPolynomial.long
degree()
Index degree.GenExteriorPolynomial division.GenExteriorPolynomial division.void
doPutToMap
(IndexList e, C c) Put a IndexList to coefficient entry into the internal map of this GenExteriorPolynomial.void
doPutToMap
(SortedMap<IndexList, C> vals) Put an a sorted map of index list to coefficients into the internal map of this GenExteriorPolynomial.void
doRemoveFromMap
(IndexList e, C c) Remove a IndexList to coefficient entry from the internal map of this GenExteriorPolynomial.GenExteriorPolynomial extended greatest common divisor.boolean
Comparison with any other object.factory()
Get the corresponding element factory.form
(long k) k-form part.GenExteriorPolynomial greatest common divisor.getMap()
IndexList to coefficient map of GenExteriorPolynomial.int
hashCode()
Hash code for this polynomial.homogeneousPart
(long tdeg) Homogeneous part.Iterator over index lists.GenExteriorPolynomial interior left multiplication.GenExteriorPolynomial interior right multiplication.inverse()
GenExteriorPolynomial inverse.boolean
Is GenExteriorPolynomial<C> a constant.boolean
Is GenExteriorPolynomial<C> homogeneous.boolean
isONE()
Is GenExteriorPolynomial<C> one.boolean
isUnit()
Is GenExteriorPolynomial<C> a unit.boolean
isZERO()
Is GenExteriorPolynomial<C> zero.iterator()
Iterator over monomials.Leading base coefficient.Leading index list.Leading monomial.int
length()
Length of GenExteriorPolynomial.map
(UnaryFunctor<? super C, C> f) Map a unary function to the coefficients.long
Index maximal degree.maxNorm()
GenExteriorPolynomial maximum norm.monic()
GenExteriorPolynomial monic, i.e.GenExteriorPolynomial multiplication.GenExteriorPolynomial multiplication.GenExteriorPolynomial multiplication.GenExteriorPolynomial left and right multiplication.GenExteriorPolynomial left and right multiplication.GenExteriorPolynomial multiplication.GenExteriorPolynomial left and right multiplication.GenExteriorPolynomial multiplication.GenExteriorPolynomial left and right multiplication.GenExteriorPolynomial multiplication.negate()
GenExteriorPolynomial negation.int
Number of variables.GenExteriorPolynomial division with remainder.reductum()
Reductum.GenExteriorPolynomial remainder.shiftIndex
(int s) GenExteriorPolynomial shift index.int
signum()
GenExteriorPolynomial signum.GenExteriorPolynomial subtract.GenExteriorPolynomial subtraction.GenExteriorPolynomial subtraction.GenExteriorPolynomial addition.GenExteriorPolynomial addition.GenExteriorPolynomial summation.sumNorm()
GenExteriorPolynomial sum norm.toScript()
Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()
String representation of GenExteriorPolynomial.Trailing base coefficient.Trailing index list.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
ring
The factory for the polynomial ring. -
val
The data structure for polynomials. -
logger
private static final org.apache.logging.log4j.Logger logger -
debug
private static final boolean debug
-
-
Constructor Details
-
GenExteriorPolynomial
Private constructor for GenExteriorPolynomial.- Parameters:
r
- polynomial ring factory.t
- TreeMap with correct ordering.
-
GenExteriorPolynomial
Constructor for zero GenExteriorPolynomial.- Parameters:
r
- polynomial ring factory.
-
GenExteriorPolynomial
Constructor for GenExteriorPolynomial c * xe.- Parameters:
r
- polynomial ring factory.c
- coefficient.e
- word.
-
GenExteriorPolynomial
Constructor for GenExteriorPolynomial c * x0.- Parameters:
r
- polynomial ring factory.c
- coefficient.
-
GenExteriorPolynomial
Constructor for GenExteriorPolynomial xe.- Parameters:
r
- polynomial ring factory.e
- index list.
-
GenExteriorPolynomial
Constructor for GenExteriorPolynomial xe.- Parameters:
r
- polynomial ring factory.e
- exponent vector.
-
GenExteriorPolynomial
Constructor for GenExteriorPolynomial c * xe.- Parameters:
r
- polynomial ring factory.c
- coefficient.e
- exponent vector.
-
GenExteriorPolynomial
Constructor for GenExteriorPolynomial.- Parameters:
r
- polynomial ring factory.v
- the SortedMap of some other polynomial.
-
-
Method Details
-
factory
Get the corresponding element factory. -
copy
Copy this GenExteriorPolynomial. -
length
public int length()Length of GenExteriorPolynomial.- Returns:
- number of coefficients of this GenExteriorPolynomial.
-
getMap
IndexList to coefficient map of GenExteriorPolynomial.- Returns:
- val as unmodifiable SortedMap.
-
doPutToMap
Put a IndexList to coefficient entry into the internal map of this GenExteriorPolynomial. Note: Do not use this method unless you are constructing a new polynomial. this is modified and breaks the immutability promise of this class.- Parameters:
e
- index list.c
- coefficient.
-
doRemoveFromMap
Remove a IndexList to coefficient entry from the internal map of this GenExteriorPolynomial. Note: Do not use this method unless you are constructing a new polynomial. this is modified and breaks the immutability promise of this class.- Parameters:
e
- IndexList.c
- expected coefficient, null for ignore.
-
doPutToMap
Put an a sorted map of index list to coefficients into the internal map of this GenExteriorPolynomial. Note: Do not use this method unless you are constructing a new polynomial. this is modified and breaks the immutability promise of this class.- Parameters:
vals
- sorted map of index list and coefficients.
-
toString
String representation of GenExteriorPolynomial. -
toScript
Get a scripting compatible string representation. -
toScriptFactory
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<C extends RingElem<C>>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
isZERO
public boolean isZERO()Is GenExteriorPolynomial<C> zero.- Specified by:
isZERO
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- If this is 0 then true is returned, else false.
- See Also:
-
isONE
public boolean isONE()Is GenExteriorPolynomial<C> one.- Specified by:
isONE
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- If this is 1 then true is returned, else false.
- See Also:
-
isUnit
public boolean isUnit()Is GenExteriorPolynomial<C> a unit.- Specified by:
isUnit
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- If this is a unit then true is returned, else false.
- See Also:
-
isConstant
public boolean isConstant()Is GenExteriorPolynomial<C> a constant.- Returns:
- If this is a constant polynomial then true is returned, else false.
-
isHomogeneous
public boolean isHomogeneous()Is GenExteriorPolynomial<C> homogeneous.- Returns:
- true, if this is homogeneous, else false.
-
form
k-form part.- Parameters:
k
- requested k-form part.- Returns:
- k-form part of given degree of this.
-
homogeneousPart
Homogeneous part.- Parameters:
tdeg
- requested degree of part.- Returns:
- polynomial part of given degree.
-
equals
Comparison with any other object. -
hashCode
public int hashCode()Hash code for this polynomial. -
compareTo
GenExteriorPolynomial comparison. -
signum
public int signum()GenExteriorPolynomial signum.- Specified by:
signum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- sign(ldcf(this)).
-
numberOfVariables
public int numberOfVariables()Number of variables.- Returns:
- ring.ixfac.length().
-
leadingMonomial
Leading monomial.- Returns:
- first map entry.
-
leadingIndexList
Leading index list.- Returns:
- first highest index list.
-
trailingIndexList
Trailing index list.- Returns:
- last lowest index list.
-
leadingBaseCoefficient
Leading base coefficient.- Returns:
- first coefficient.
-
trailingBaseCoefficient
Trailing base coefficient.- Returns:
- coefficient of constant term.
-
coefficient
Coefficient.- Parameters:
e
- index list.- Returns:
- coefficient for given index list.
-
reductum
Reductum.- Returns:
- this - leading monomial.
-
degree
public long degree()Index degree.- Returns:
- maximal length of indexes.
-
maxDegree
public long maxDegree()Index maximal degree.- Returns:
- maximal degree of indexes.
-
maxNorm
GenExteriorPolynomial maximum norm.- Returns:
- ||this||.
-
sumNorm
GenExteriorPolynomial sum norm.- Returns:
- sum of all absolute values of coefficients.
-
sum
GenExteriorPolynomial summation.- Specified by:
sum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
S
- GenExteriorPolynomial.- Returns:
- this+S.
-
sum
GenExteriorPolynomial addition. This method is not very efficient, since this is copied.- Parameters:
a
- coefficient.e
- index list.- Returns:
- this + a e.
-
sum
GenExteriorPolynomial addition. This method is not very efficient, since this is copied.- Parameters:
a
- coefficient.- Returns:
- this + a x0.
-
subtract
GenExteriorPolynomial subtraction.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
S
- GenExteriorPolynomial.- Returns:
- this-S.
-
subtract
GenExteriorPolynomial subtraction. This method is not very efficient, since this is copied.- Parameters:
a
- coefficient.e
- index list.- Returns:
- this - a e.
-
subtract
GenExteriorPolynomial subtract. This method is not very efficient, since this is copied.- Parameters:
a
- coefficient.- Returns:
- this + a x0.
-
negate
GenExteriorPolynomial negation.- Specified by:
negate
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- -this.
-
abs
GenExteriorPolynomial absolute value, i.e. leadingCoefficient > 0.- Specified by:
abs
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- abs(this).
-
multiply
GenExteriorPolynomial multiplication.- Specified by:
multiply
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- GenExteriorPolynomial.- Returns:
- this /\\ S.
-
interiorLeftProduct
GenExteriorPolynomial interior left multiplication.- Parameters:
S
- GenExteriorPolynomial.- Returns:
- this _| S.
-
interiorRightProduct
GenExteriorPolynomial interior right multiplication.- Parameters:
S
- GenExteriorPolynomial.- Returns:
- this |_ S.
-
multiply
GenExteriorPolynomial left and right multiplication. Product with two polynomials.- Parameters:
S
- GenExteriorPolynomial.T
- GenExteriorPolynomial.- Returns:
- S*this*T.
-
multiply
GenExteriorPolynomial multiplication. Product with coefficient ring element.- Parameters:
s
- coefficient.- Returns:
- this*s.
-
multiply
GenExteriorPolynomial multiplication. Product with coefficient ring element.- Parameters:
s
- coefficient.t
- coefficient.- Returns:
- s*this*t.
-
monic
GenExteriorPolynomial monic, i.e. leadingCoefficient == 1. If leadingCoefficient is not invertible returns this unmodified.- Returns:
- monic(this).
-
multiply
GenExteriorPolynomial multiplication. Product with ring element and index list.- Parameters:
s
- coefficient.e
- left index list.- Returns:
- this * s e.
-
multiply
GenExteriorPolynomial left and right multiplication. Product with ring element and two index lists.- Parameters:
e
- left index list.f
- right index list.- Returns:
- e * this * f.
-
multiply
GenExteriorPolynomial left and right multiplication. Product with ring element and two index lists.- Parameters:
s
- coefficient.e
- left index list.f
- right index list.- Returns:
- e * this * s * f.
-
multiply
GenExteriorPolynomial left and right multiplication. Product with ring element and two index lists.- Parameters:
s
- coefficient.e
- left index list.t
- coefficient.f
- right index list.- Returns:
- s * e * this * t * f.
-
multiply
GenExteriorPolynomial multiplication. Product with index list.- Parameters:
e
- index list (!= null).- Returns:
- this * e.
-
multiply
GenExteriorPolynomial multiplication. Product with 'monomial'.- Parameters:
m
- 'monomial'.- Returns:
- this * m.
-
divide
GenExteriorPolynomial division. Division by coefficient ring element. Fails, if exact division is not possible.- Parameters:
s
- coefficient.- Returns:
- this/s.
-
coeffPrimitivePart
GenExteriorPolynomial coefficient primitive part. Division by gcd of coefficients.- Returns:
- this/gcd(coeff(this)).
-
quotientRemainder
GenExteriorPolynomial division with remainder. Fails, if exact division by leading base coefficient is not possible. Meaningful only for univariate polynomials over fields, but works in any case.- Specified by:
quotientRemainder
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- nonzero GenExteriorPolynomial with invertible leading coefficient.- Returns:
- [ quotient , remainder ] with this = quotient * S + remainder and deg(remainder) < deg(S) or remainder = 0.
- See Also:
-
divide
GenExteriorPolynomial division. Fails, if exact division by leading base coefficient is not possible. Meaningful only for univariate polynomials over fields, but works in any case.- Specified by:
divide
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- nonzero GenExteriorPolynomial with invertible leading coefficient.- Returns:
- quotient with this = quotient * S + remainder.
- See Also:
-
remainder
GenExteriorPolynomial remainder. Fails, if exact division by leading base coefficient is not possible. Meaningful only for univariate polynomials over fields, but works in any case.- Specified by:
remainder
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- nonzero GenExteriorPolynomial with invertible leading coefficient.- Returns:
- remainder with this = quotient * S + remainder.
- See Also:
-
gcd
GenExteriorPolynomial greatest common divisor. Note: not implemented. -
egcd
GenExteriorPolynomial extended greatest common divisor. Note: not implemented. -
inverse
GenExteriorPolynomial inverse. Required by RingElem. Throws not invertible exception.- Specified by:
inverse
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- x with this * x = 1, if it exists.
-
shiftIndex
GenExteriorPolynomial shift index. Add number to each index.- Parameters:
s
- shift index by this number.- Returns:
- this.shift(s).
-
coefficientIterator
Iterator over coefficients.- Returns:
- val.values().iterator().
-
indexListIterator
Iterator over index lists.- Returns:
- val.keySet().iterator().
-
iterator
Iterator over monomials. -
map
Map a unary function to the coefficients.- Parameters:
f
- evaluation functor.- Returns:
- new polynomial with coefficients f(this(e)).
-