Package edu.jas.ps
Class MultiVarPowerSeries<C extends RingElem<C>>
java.lang.Object
edu.jas.ps.MultiVarPowerSeries<C>
- Type Parameters:
C
- ring element type
- All Implemented Interfaces:
AbelianGroupElem<MultiVarPowerSeries<C>>
,Element<MultiVarPowerSeries<C>>
,MonoidElem<MultiVarPowerSeries<C>>
,RingElem<MultiVarPowerSeries<C>>
,Serializable
,Comparable<MultiVarPowerSeries<C>>
public class MultiVarPowerSeries<C extends RingElem<C>>
extends Object
implements RingElem<MultiVarPowerSeries<C>>
Multivariate power series implementation. Uses inner classes and lazy
evaluated generating function for coefficients. All ring element methods use
lazy evaluation except where noted otherwise. Eager evaluated methods are
toString()
, compareTo()
, equals()
,
evaluate()
, or methods which use the order()
or
orderExpVector()
methods, like signum()
,
abs()
, divide()
, remainder()
and
gcd()
. Note: Currently the term order is fixed to the
order defined by the iterator over exponent vectors in class
ExpVectorIterator
.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ExpVector
ExpVector of order of power series.(package private) MultiVarCoefficients
<C> Data structure / generating function for coefficients.private int
Order of power series.final MultiVarPowerSeriesRing
<C> Power series ring factory.private int
Truncation of computations. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor.(package private)
Package constructor.MultiVarPowerSeries
(MultiVarPowerSeriesRing<C> ring, MultiVarCoefficients<C> lazyCoeffs) Constructor.MultiVarPowerSeries
(MultiVarPowerSeriesRing<C> ring, MultiVarCoefficients<C> lazyCoeffs, int trunc) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabs()
Absolute value.Get a GenPolynomial<C> from this.coefficient
(ExpVector index) Get coefficient.int
Compare to.copy()
Clone this power series.differentiate
(int r) Differentiate with respect to variable r.divide
(MultiVarPowerSeries<C> ps) Divide by another power series.long
ecart()
Ecart.egcd
(MultiVarPowerSeries<C> S) Power series extended greatest common divisor.boolean
Comparison with any other object.Evaluate at given point.factory()
Get the corresponding element factory.gcd
(MultiVarPowerSeries<C> ps) Power series greatest common divisor.int
hashCode()
Hash code for this polynomial.homogeneousPart
(long tdeg) Homogeneous part.Integrate with respect to variable r and with given constant.inverse()
Inverse power series.boolean
isONE()
Is power series one.boolean
isUnit()
Is unit.boolean
isZERO()
Is power series zero.Leading base coefficient.map
(UnaryFunctor<? super C, C> f) Map a unary function to this power series.monic()
Monic.Multiply by coefficient.Multiply by exponent vector and coefficient.multiply
(MultiVarPowerSeries<C> ps) Multiply by another power series.negate()
Negate.int
order()
Order.Order ExpVector.Order monomial.Prepend a new leading coefficient.Quotient and remainder by division of this by S.reductum()
Reductum.reductum
(int r) Reductum.Power series remainder.Select coefficients.int
setTruncate
(int t) Set truncate.shift
(int k, int r) Shift coefficients.Shift coefficients.shiftSelect
(Selector<? super C> sel) Shift select coefficients.int
signum()
Signum.Subtract exponent vector and coefficient.subtract
(MultiVarPowerSeries<C> ps) Subtract a another power series.Subtraction of two power series, using zip().Sum exponent vector and coefficient.sum
(MultiVarCoefficients<C> mvc) Sum exponent vector and coefficient.sum
(MultiVarPowerSeries<C> ps) Sum a another power series.Sum monomial.sumZip
(MultiVarPowerSeries<C> ps) Sum of two power series, using zip().toScript()
Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()
String representation of power series.toString
(int trunc) To String with given truncate.int
truncate()
Truncate.zip
(BinaryFunctor<? super C, ? super C, C> f, MultiVarPowerSeries<C> ps) Map a binary function to this and another power series.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, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
ring
Power series ring factory. -
lazyCoeffs
MultiVarCoefficients<C extends RingElem<C>> lazyCoeffsData structure / generating function for coefficients. Cannot be final because of fixPoint, must be accessible in factory. -
truncate
private int truncateTruncation of computations. -
order
private int orderOrder of power series. -
evorder
ExpVector of order of power series.
-
-
Constructor Details
-
MultiVarPowerSeries
private MultiVarPowerSeries()Private constructor. -
MultiVarPowerSeries
MultiVarPowerSeries(MultiVarPowerSeriesRing<C> ring) Package constructor. Use in fixPoint only, must be accessible in factory.- Parameters:
ring
- power series ring.
-
MultiVarPowerSeries
Constructor.- Parameters:
ring
- power series ring.lazyCoeffs
- generating function for coefficients.
-
MultiVarPowerSeries
public MultiVarPowerSeries(MultiVarPowerSeriesRing<C> ring, MultiVarCoefficients<C> lazyCoeffs, int trunc) Constructor.- Parameters:
ring
- power series ring.lazyCoeffs
- generating function for coefficients.trunc
- truncate parameter for this power series.
-
-
Method Details
-
factory
Get the corresponding element factory. -
copy
Clone this power series. -
toString
String representation of power series. -
toString
To String with given truncate.- Parameters:
trunc
- truncate parameter for this power series.- Returns:
- string representation of this to given truncate.
-
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:
-
coefficient
Get coefficient.- Parameters:
index
- number of requested coefficient.- Returns:
- coefficient at index.
-
homogeneousPart
Homogeneous part.- Parameters:
tdeg
- requested degree.- Returns:
- polynomial part of given degree.
-
asPolynomial
Get a GenPolynomial<C> from this.- Returns:
- a GenPolynomial<C> from this up to truncate homogeneous parts.
-
leadingCoefficient
Leading base coefficient.- Returns:
- first coefficient.
-
prepend
Prepend a new leading coefficient.- Parameters:
h
- new coefficient.r
- variable for the direction.- Returns:
- new power series.
-
shift
Shift coefficients.- Parameters:
k
- shift index.r
- variable for the direction.- Returns:
- new power series with coefficient(i) = old.coefficient(i-k).
-
reductum
Reductum.- Parameters:
r
- variable for taking the reductum.- Returns:
- this - leading monomial in the direction of r.
-
reductum
Reductum.- Returns:
- this - leading monomial.
-
shift
Shift coefficients. Multiply by exponent vector.- Parameters:
k
- shift ExpVector.- Returns:
- new power series with coefficient(i) = old.coefficient(i-k).
-
multiply
Multiply by exponent vector and coefficient.- Parameters:
c
- coefficient multiplier.k
- shift ExpVector.- Returns:
- new power series with coefficient(i) = old.coefficient(i-k)*c.
-
sum
Sum monomial.- Parameters:
m
- ExpVector , coefficient pair- Returns:
- this + ONE.multiply(m.coefficient,m.exponent).
-
sum
Sum exponent vector and coefficient.- Parameters:
c
- coefficient.k
- ExpVector.- Returns:
- this + ONE.multiply(c,k).
-
subtract
Subtract exponent vector and coefficient.- Parameters:
c
- coefficient.k
- ExpVector.- Returns:
- this - ONE.multiply(c,k).
-
sum
Sum exponent vector and coefficient.- Parameters:
mvc
- cached coefficients.- Returns:
- this + mvc.
-
select
Select coefficients.- Parameters:
sel
- selector functor.- Returns:
- new power series with selected coefficients.
-
shiftSelect
Shift select coefficients. Not selected coefficients are removed from the result series.- Parameters:
sel
- selector functor.- Returns:
- new power series with shifted selected coefficients.
-
map
Map a unary function to this power series.- Parameters:
f
- evaluation functor.- Returns:
- new power series with coefficients f(this(i)).
-
zip
public MultiVarPowerSeries<C> zip(BinaryFunctor<? super C, ? super C, C> f, MultiVarPowerSeries<C> ps) Map a binary function to this and another power series.- Parameters:
f
- evaluation functor with coefficients f(this(i),other(i)).ps
- other power series.- Returns:
- new power series.
-
sumZip
Sum of two power series, using zip().- Parameters:
ps
- other power series.- Returns:
- this + ps.
-
subtractZip
Subtraction of two power series, using zip().- Parameters:
ps
- other power series.- Returns:
- this - ps.
-
multiply
Multiply by coefficient.- Parameters:
a
- coefficient.- Returns:
- this * a.
-
monic
Monic.- Returns:
- 1/orderCoeff() * this.
-
negate
Negate.- Specified by:
negate
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- - this.
-
abs
Absolute value.- Specified by:
abs
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- abs(this).
-
evaluate
Evaluate at given point.- Returns:
- ps(a).
-
order
public int order()Order.- Returns:
- index of first non zero coefficient.
-
orderExpVector
Order ExpVector.- Returns:
- ExpVector of first non zero coefficient.
-
orderMonomial
Order monomial.- Returns:
- first map entry or null.
-
truncate
public int truncate()Truncate.- Returns:
- truncate index of power series.
-
setTruncate
public int setTruncate(int t) Set truncate.- Parameters:
t
- new truncate index.- Returns:
- old truncate index of power series.
-
ecart
public long ecart()Ecart.- Returns:
- ecart.
-
signum
public int signum()Signum.- Specified by:
signum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- sign of first non zero coefficient.
-
compareTo
Compare to. Note: compare only up to max(truncates). -
isZERO
public boolean isZERO()Is power series zero. Note: compare only up to truncate.- 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 power series one. Note: compare only up to truncate.- Specified by:
isONE
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- If this is 1 then true is returned, else false.
- See Also:
-
equals
Comparison with any other object. Note: compare only up to truncate. -
hashCode
public int hashCode()Hash code for this polynomial. Note: only up to truncate. -
isUnit
public boolean isUnit()Is unit.- Specified by:
isUnit
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- true, if this power series is invertible, else false.
-
sum
Sum a another power series.- Specified by:
sum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
ps
- other power series.- Returns:
- this + ps.
-
subtract
Subtract a another power series.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
ps
- other power series.- Returns:
- this - ps.
-
multiply
Multiply by another power series.- Specified by:
multiply
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
ps
- other power series.- Returns:
- this * ps.
-
inverse
Inverse power series.- Specified by:
inverse
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- ps with this * ps = 1.
-
divide
Divide by another power series.- Specified by:
divide
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
ps
- nonzero power series with invertible coefficient.- Returns:
- this / ps.
-
remainder
Power series remainder.- Specified by:
remainder
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
ps
- nonzero power series with invertible leading coefficient.- Returns:
- remainder with this = quotient * ps + remainder.
-
quotientRemainder
Quotient and remainder by division of this by S.- Specified by:
quotientRemainder
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- a MultiVarPowerSeries- Returns:
- [this/S, this - (this/S)*S].
-
differentiate
Differentiate with respect to variable r.- Parameters:
r
- variable for the direction.- Returns:
- differentiate(this).
-
integrate
Integrate with respect to variable r and with given constant.- Parameters:
c
- integration constant.r
- variable for the direction.- Returns:
- integrate(this).
-
gcd
Power series greatest common divisor. -
egcd
Power series extended greatest common divisor. Note: not implemented.
-