Class UnivPowerSeries<C extends RingElem<C>>
java.lang.Object
edu.jas.ps.UnivPowerSeries<C>
- Type Parameters:
C- ring element type
- All Implemented Interfaces:
AbelianGroupElem<UnivPowerSeries<C>>, Element<UnivPowerSeries<C>>, MonoidElem<UnivPowerSeries<C>>, RingElem<UnivPowerSeries<C>>, Serializable, Comparable<UnivPowerSeries<C>>
public class UnivPowerSeries<C extends RingElem<C>>
extends Object
implements RingElem<UnivPowerSeries<C>>
Univariate 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 they use the order() method, like
signum(), abs(), divide(),
remainder() and gcd().- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Coefficients<C> Data structure / generating function for coefficients.private intOrder of power series.final UnivPowerSeriesRing<C> Power series ring factory.private intTruncation of computations. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor.(package private)UnivPowerSeries(UnivPowerSeriesRing<C> ring) Package constructor.UnivPowerSeries(UnivPowerSeriesRing<C> ring, Coefficients<C> lazyCoeffs) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabs()Absolute value.Get a GenPolynomial<C> from this.asVector()Get a GenVector<C> from this.coefficient(int index) Get coefficient.intcompareTo(UnivPowerSeries<C> ps) Compare to.copy()Clone this power series.Differentiate.divide(UnivPowerSeries<C> ps) Divide by another power series.UnivPowerSeries<C>[]egcd(UnivPowerSeries<C> S) Power series extended greatest common divisor.booleanComparison with any other object.Evaluate at given point.factory()Get the corresponding element factory.gcd(UnivPowerSeries<C> ps) Power series greatest common divisor.inthashCode()Hash code for this polynomial.Integrate with given constant.inverse()Inverse power series.booleanisONE()Is power series one.booleanisUnit()Is unit.booleanisZERO()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(UnivPowerSeries<C> ps) Multiply by another power series.negate()Negate.intorder()Order.Prepend a new leading coefficient.UnivPowerSeries<C>[]Quotient and remainder by division of this by S.reductum()Reductum.remainder(UnivPowerSeries<C> ps) Power series remainder.Select coefficients.intsetTruncate(int t) Set truncate.shift(int k) Shift coefficients.shiftSelect(Selector<? super C> sel) Shift select coefficients.intsignum()Signum.subtract(UnivPowerSeries<C> ps) Subtraction of two power series.sum(UnivPowerSeries<C> ps) Sum of two power series.toScript()Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()String representation of power series.toString(int truncate) To String with given truncate.inttruncate()Truncate.<C2 extends RingElem<C2>>
UnivPowerSeries<C> zip(BinaryFunctor<? super C, ? super C2, C> f, UnivPowerSeries<C2> ps) Map a binary function to this and another power series.Methods inherited from interface MonoidElem
leftDivide, leftRemainder, power, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
ring
Power series ring factory. -
lazyCoeffs
Coefficients<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.
-
-
Constructor Details
-
UnivPowerSeries
private UnivPowerSeries()Private constructor. -
UnivPowerSeries
UnivPowerSeries(UnivPowerSeriesRing<C> ring) Package constructor. Use in fixPoint only, must be accessible in factory.- Parameters:
ring- power series ring.
-
UnivPowerSeries
Constructor.- Parameters:
ring- power series ring.lazyCoeffs- generating function for coefficients.
-
-
Method Details
-
factory
-
copy
-
toString
-
toString
To String with given truncate.- Returns:
- string representation of this to given truncate.
-
toScript
-
toScriptFactory
-
coefficient
Get coefficient.- Parameters:
index- number of requested coefficient.- Returns:
- coefficient at index.
-
asPolynomial
Get a GenPolynomial<C> from this.- Returns:
- a GenPolynomial<C> from this up to truncate parts.
-
asVector
-
leadingCoefficient
-
reductum
-
prepend
Prepend a new leading coefficient.- Parameters:
h- new coefficient.- Returns:
- new power series.
-
shift
Shift coefficients.- Parameters:
k- shift index.- Returns:
- new power series with coefficient(i) = old.coefficient(i-k).
-
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 <C2 extends RingElem<C2>> UnivPowerSeries<C> zip(BinaryFunctor<? super C, ? super C2, C> f, UnivPowerSeries<C2> 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.
-
sum
Sum of two power series.- Specified by:
sumin interfaceAbelianGroupElem<C extends RingElem<C>>- Parameters:
ps- other power series.- Returns:
- this + ps.
-
subtract
Subtraction of two power series.- Specified by:
subtractin interfaceAbelianGroupElem<C extends RingElem<C>>- Parameters:
ps- other power series.- Returns:
- this - ps.
-
multiply
Multiply by coefficient.- Parameters:
c- coefficient.- Returns:
- this * c.
-
monic
-
negate
Negate.- Specified by:
negatein interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- - this.
-
abs
Absolute value.- Specified by:
absin interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- abs(this).
-
evaluate
-
order
public int order()Order.- Returns:
- index of first non zero coefficient.
-
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.
-
signum
public int signum()Signum.- Specified by:
signumin interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- sign of first non zero coefficient.
-
compareTo
Compare to. Note: compare only up to truncate. -
isZERO
public boolean isZERO()Is power series zero. Note: compare only up to truncate.- Specified by:
isZEROin 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:
isONEin interfaceMonoidElem<C extends RingElem<C>>- Returns:
- If this is 1 then true is returned, else false.
- See Also:
-
equals
-
hashCode
-
isUnit
public boolean isUnit()Is unit.- Specified by:
isUnitin interfaceMonoidElem<C extends RingElem<C>>- Returns:
- true, if this power series is invertible, else false.
-
multiply
Multiply by another power series.- Specified by:
multiplyin interfaceMonoidElem<C extends RingElem<C>>- Parameters:
ps-- Returns:
- this * ps.
-
inverse
Inverse power series.- Specified by:
inversein interfaceMonoidElem<C extends RingElem<C>>- Returns:
- ps with this * ps = 1.
-
divide
Divide by another power series.- Specified by:
dividein interfaceMonoidElem<C extends RingElem<C>>- Parameters:
ps-- Returns:
- this / ps.
-
remainder
Power series remainder.- Specified by:
remainderin 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:
quotientRemainderin interfaceMonoidElem<C extends RingElem<C>>- Parameters:
S- a UnivPowerSeries- Returns:
- [this/S, this - (this/S)*S].
-
differentiate
-
integrate
Integrate with given constant.- Parameters:
c- integration constant.- Returns:
- integrate(this).
-
gcd
Power series greatest common divisor. -
egcd
Power series extended greatest common divisor. Note: not implemented.
-