public final class UnivariatePolynomialZp64 extends Object
[2, 2^62)
(the last value is specified by
MachineArithmetic.MAX_SUPPORTED_MODULUS_BITS
. Fast methods from IntegersZp64
are used to perform all
arithmetic operations.Modifier and Type | Field and Description |
---|---|
IntegersZp64 |
ring
The coefficient ring
|
Modifier and Type | Method and Description |
---|---|
lPoly |
add(long val)
Add constant to this.
|
lPoly |
add(lPoly oth)
Adds
oth to this . |
lPoly |
addMonomial(long coefficient,
int exponent)
Adds
coefficient*x^exponent to this |
lPoly |
addMul(lPoly oth,
long factor)
Adds
oth * factor to this |
MultivariatePolynomialZp64 |
asMultivariate()
Convert to multivariate polynomial
|
MultivariatePolynomialZp64 |
asMultivariate(Comparator<DegreeVector> ordering)
Convert to multivariate polynomial
|
UnivariatePolynomialZ64 |
asPolyZ(boolean copy)
Returns Z[x] polynomial formed from the coefficients of this.
|
UnivariatePolynomialZ64 |
asPolyZSymmetric()
Returns Z[x] polynomial formed from the coefficients of this represented in symmetric modular form (
-modulus/2 <= cfx <= modulus/2 ). |
long |
cc()
Returns the constant coefficient of this poly
|
lPoly |
ccAsPoly()
Returns the constant coefficient as a constant poly
|
UnivariatePolynomialZp64 |
clone()
Deep copy of this
|
BigInteger |
coefficientRingCardinality()
Returns cardinality of the coefficient ring of this poly
|
BigInteger |
coefficientRingCharacteristic()
Returns characteristic of the coefficient ring of this poly
|
BigInteger |
coefficientRingPerfectPowerBase()
Returns
base so that coefficientRingCardinality() == base^exponent or null if cardinality is not
finite |
BigInteger |
coefficientRingPerfectPowerExponent()
Returns
exponent so that coefficientRingCardinality() == base^exponent or null if cardinality is
not finite |
String |
coefficientRingToString(IStringifier<UnivariatePolynomialZp64> stringifier)
String representation of the coefficient ring of this
|
int |
compareTo(lPoly o) |
MultivariatePolynomialZp64 |
composition(AMultivariatePolynomial value)
Calculates the composition of this(oth)
|
lPoly |
composition(lPoly value)
Calculates the composition of this(oth) (new instance, so the content of this is not changed))
|
static UnivariatePolynomialZp64 |
constant(IntegersZp64 ring,
long value)
Creates constant polynomial with specified value
|
static UnivariatePolynomialZp64 |
constant(long modulus,
long value)
Creates constant polynomial with specified value
|
long |
content()
Returns the content of this poly (gcd of its coefficients)
|
lPoly |
contentAsPoly()
Returns the content of this (gcd of coefficients) as a constant poly
|
static UnivariatePolynomialZp64 |
create(IntegersZp64 ring,
long[] data)
Creates poly with specified coefficients represented as signed integers reducing them modulo
modulus |
static UnivariatePolynomialZp64 |
create(long modulus,
long[] data)
Creates poly with specified coefficients represented as signed integers reducing them modulo
modulus |
UnivariatePolynomialZp64[] |
createArray(int length)
overcome Java generics...
|
UnivariatePolynomialZp64[] |
createArray(UnivariatePolynomialZp64 a,
UnivariatePolynomialZp64 b)
overcome Java generics...
|
UnivariatePolynomialZp64[][] |
createArray2d(int length)
overcome Java generics...
|
UnivariatePolynomialZp64[][] |
createArray2d(int length1,
int length2)
overcome Java generics...
|
lPoly |
createConstant(long val)
Creates constant polynomial with specified value (with the same coefficient ring)
|
UnivariatePolynomialZp64 |
createFromArray(long[] newData)
Creates new poly with the specified coefficients (over the same ring)
|
lPoly |
createLinear(long cc,
long lc)
Creates linear polynomial of form
cc + x * lc (with the same coefficient ring) |
lPoly |
createMonomial(int degree)
Creates new monomial
x^degree (with the same coefficient ring) |
UnivariatePolynomialZp64 |
createMonomial(long coefficient,
int newDegree)
Creates monomial
coefficient * x^degree (with the same coefficient ring) |
lPoly |
createOne()
Returns the new instance of unit polynomial (with the same coefficient ring)
|
static UnivariatePolynomialZp64 |
createUnsafe(IntegersZp64 ring,
long[] data)
data is not reduced modulo modulus
|
static UnivariatePolynomialZp64 |
createUnsafe(long modulus,
long[] data)
data is not reduced modulo modulus
|
lPoly |
createZero()
Returns the new instance of zero polynomial (with the same coefficient ring)
|
lPoly |
decrement()
Subtracts 1 from this
|
int |
degree()
Returns the degree of this polynomial
|
UnivariatePolynomialZp64 |
derivative()
Returns the formal derivative of this poly (new instance, so the content of this is not changed)
|
UnivariatePolynomialZp64 |
divide(long val)
Divide by specified value
|
UnivariatePolynomialZp64 |
divideByLC(UnivariatePolynomialZp64 other)
Divides this polynomial by the leading coefficient of
other or returns null (causing loss of
internal data) if some of the elements can't be exactly divided by the other.lc() . |
void |
ensureInternalCapacity(int desiredCapacity)
ensures that internal storage has enough size to store
desiredCapacity elements |
boolean |
equals(Object obj) |
long |
evaluate(long point)
Evaluates this poly at a given
point (via Horner method). |
int |
firstNonZeroCoefficientPosition()
Returns position of the first non-zero coefficient, that is common monomial exponent (e.g.
|
long |
get(int i)
Returns the i-th coefficient of this poly (coefficient before x^i)
|
lPoly |
getAsPoly(int i)
Returns i-th coefficient of this as a constant polynomial
|
long[] |
getDataReferenceUnsafe()
internal API >>> direct unsafe access to internal storage
|
UnivariatePolynomialZp64 |
getRange(int from,
int to)
Creates polynomial formed from the coefficients of this starting from
from (inclusive) to to
(exclusive) |
int |
hashCode() |
lPoly |
increment()
Adds 1 to this
|
boolean |
isConstant()
Returns
true if this polynomial has only constant term |
boolean |
isMonic()
Returns
true if this polynomial is monic |
boolean |
isMonomial()
Returns
true if this polynomial has only one monomial term |
boolean |
isOne()
Returns
true if this is one |
boolean |
isOverField()
Returns whether the coefficient ring of this polynomial is a field
|
boolean |
isOverFiniteField()
Returns whether the coefficient ring of this polynomial is a finite field
|
boolean |
isOverPerfectPower()
Returns whether the
coefficientRingCardinality() is a perfect power |
boolean |
isOverZ()
Returns whether the coefficient ring of this polynomial is Z
|
boolean |
isUnitCC()
Returns true if constant term is equal to one
|
boolean |
isZero()
Returns
true if this is zero |
boolean |
isZeroAt(int i)
Returns whether i-th coefficient of this is zero
|
long |
lc()
Returns the leading coefficient of this poly
|
lPoly |
lcAsPoly()
Returns the leading coefficient as a constant poly
|
static UnivariatePolynomialZp64 |
linear(long cc,
long lc,
long modulus)
Creates linear polynomial of form
cc + x * lc |
<T> UnivariatePolynomial<T> |
mapCoefficients(Ring<T> ring,
LongFunction<T> mapper)
Applies transformation function to this and returns the result.
|
long |
maxAbsCoefficient()
Returns max coefficient (by absolute value) of this poly
|
long |
modulus()
Returns the modulus
|
UnivariatePolynomialZp64 |
monic()
Sets
this to its monic part (that is this divided by its leading coefficient), or returns null (causing loss of internal data) if some of the elements can't be exactly divided by the lc() . |
UnivariatePolynomialZp64 |
monic(long factor)
Sets
this to its monic part multiplied by the factor (that is monic(modulus).multiply(factor) ). |
lPoly |
monicWithLC(lPoly other)
Sets
this to its monic part multiplied by the leading coefficient of other ; |
static UnivariatePolynomialZp64 |
monomial(long modulus,
long coefficient,
int exponent)
Creates monomial
coefficient * x^exponent |
lPoly |
multiply(long factor)
Multiplies this by
factor |
UnivariatePolynomialZp64 |
multiply(UnivariatePolynomialZp64 oth)
Multiplies this by
oth |
UnivariatePolynomialZp64 |
multiplyByBigInteger(BigInteger factor)
Multiplies this by
factor |
lPoly |
multiplyByLC(lPoly other)
Multiply this by the leading coefficient of
other |
lPoly |
negate()
Negates this and returns
|
double |
norm1()
Returns L1 norm of this polynomial, i.e.
|
double |
norm2()
Returns L2 norm of this polynomial, i.e.
|
double |
normMax()
Returns max coefficient (by absolute value) of this poly
|
static UnivariatePolynomialZp64 |
one(IntegersZp64 ring)
Creates unit polynomial
|
static UnivariatePolynomialZp64 |
one(long modulus)
Creates unit polynomial
|
static UnivariatePolynomialZp64 |
parse(String string,
IntegersZp64 modulus)
Deprecated.
|
static UnivariatePolynomialZp64 |
parse(String string,
IntegersZp64 modulus,
String variable)
Parse string into polynomial
|
static UnivariatePolynomialZp64 |
parse(String string,
long modulus)
Deprecated.
|
UnivariatePolynomialZp64 |
parsePoly(String string) |
lPoly |
primitivePart()
Reduces poly to its primitive part (primitive part will always have positive l.c.)
|
lPoly |
primitivePartSameSign()
Reduces poly to its primitive part, so that primitive part will have the same signum as the initial poly
|
lPoly |
reverse()
Reverses the coefficients of this
|
boolean |
sameCoefficientRingWith(UnivariatePolynomialZp64 oth)
Returns whether
oth and this have the same coefficient ring |
lPoly |
set(int i,
long el)
Sets i-th element of this poly with the specified value
|
lPoly |
set(lPoly oth)
Sets the content of this to
oth |
lPoly |
setAndDestroy(lPoly oth)
Sets the content of this with
oth and destroys oth |
UnivariatePolynomialZp64 |
setCoefficientRingFrom(UnivariatePolynomialZp64 univariatePolynomialZp64)
Set the coefficient ring from specified poly
|
lPoly |
setFrom(int indexInThis,
lPoly poly,
int indexInPoly)
Sets i-th element of this by j-th element of other poly
|
lPoly |
setLC(long lc)
Sets hte leading coefficient of this poly with specified value
|
UnivariatePolynomialZp64 |
setModulus(IntegersZp64 newDomain)
Creates new Zp[x] polynomial by coping the coefficients of this and reducing them modulo new modulus.
|
UnivariatePolynomialZp64 |
setModulus(long newModulus)
Creates new Zp[x] polynomial by coping the coefficients of this and reducing them modulo new modulus.
|
UnivariatePolynomialZp64 |
setModulusUnsafe(IntegersZp64 newModulus)
does not copy the data and does not reduce the data with new modulus
|
UnivariatePolynomialZp64 |
setModulusUnsafe(long newModulus)
does not copy the data and does not reduce the data with new modulus
|
lPoly |
setZero(int i)
Fills i-th element with zero
|
lPoly |
shift(long value)
Shifts variable x -> x + value and returns the result (new instance)
|
lPoly |
shiftLeft(int offset)
Returns the quotient
this / x^offset , it is polynomial with coefficient list formed by shifting
coefficients of this to the left by offset . |
lPoly |
shiftRight(int offset)
Multiplies
this by the x^offset . |
int |
signumOfLC()
Gives signum of the leading coefficient
|
UnivariatePolynomialZp64 |
square()
Squares
this |
LongStream |
stream()
Returns a sequential
Stream with coefficients of this as its source. |
Stream<lPoly> |
streamAsPolys()
Stream polynomial coefficients as constant polynomials
|
lPoly |
subtract(long val)
Subtract constant from this.
|
lPoly |
subtract(lPoly oth)
Subtracts
oth from this . |
lPoly |
subtract(lPoly oth,
long factor,
int exponent)
Subtracts
factor * x^exponent * oth from this |
UnivariatePolynomial<BigInteger> |
toBigPoly()
Converts this to a polynomial over BigIntegers
|
String |
toString() |
String |
toString(IStringifier<lPoly> stringifier)
convert this to string with the use of stringifier
|
String |
toStringForCopy() |
lPoly |
toZero()
Sets this to zero
|
lPoly |
truncate(int newDegree)
Returns the remainder
this rem x^(newDegree + 1) , it is polynomial formed by coefficients of this from
zero to newDegree (both inclusive) |
static UnivariatePolynomialZp64 |
zero(IntegersZp64 ring)
Creates zero polynomial
|
static UnivariatePolynomialZp64 |
zero(long modulus)
Creates zero polynomial
|
finalize, getClass, notify, notifyAll, wait, wait, wait
composition, exponents, isLinearExactly, isLinearOrConstant, isZeroCC, mapCoefficientsAsPolys, nNonZeroTerms, size
add, assertSameCoefficientRingWith, canonical, coefficientRingToString, copy, createArray, createArray, monicExact, multiply, multiply, setCoefficientRingFromOptional, subtract, toPositiveLC, toString
public final IntegersZp64 ring
@Deprecated public static UnivariatePolynomialZp64 parse(String string, long modulus)
parse(String, IntegersZp64, String)
@Deprecated public static UnivariatePolynomialZp64 parse(String string, IntegersZp64 modulus)
parse(String, IntegersZp64, String)
public static UnivariatePolynomialZp64 parse(String string, IntegersZp64 modulus, String variable)
public static UnivariatePolynomialZp64 create(long modulus, long[] data)
modulus
modulus
- the modulusdata
- coefficientspublic static UnivariatePolynomialZp64 create(IntegersZp64 ring, long[] data)
modulus
ring
- the ringdata
- coefficientspublic static UnivariatePolynomialZp64 linear(long cc, long lc, long modulus)
cc + x * lc
cc
- the constant coefficientlc
- the leading coefficientmodulus
- the moduluscc + x * lc
public static UnivariatePolynomialZp64 createUnsafe(long modulus, long[] data)
public static UnivariatePolynomialZp64 createUnsafe(IntegersZp64 ring, long[] data)
public static UnivariatePolynomialZp64 monomial(long modulus, long coefficient, int exponent)
coefficient * x^exponent
modulus
- the moduluscoefficient
- monomial coefficientexponent
- monomial exponentcoefficient * x^exponent
public static UnivariatePolynomialZp64 constant(long modulus, long value)
modulus
- the modulusvalue
- the valuepublic static UnivariatePolynomialZp64 constant(IntegersZp64 ring, long value)
ring
- the ringvalue
- the valuepublic static UnivariatePolynomialZp64 zero(long modulus)
modulus
- the moduluspublic static UnivariatePolynomialZp64 zero(IntegersZp64 ring)
ring
- the ringpublic static UnivariatePolynomialZp64 one(long modulus)
modulus
- the moduluspublic static UnivariatePolynomialZp64 one(IntegersZp64 ring)
ring
- the ringpublic UnivariatePolynomialZp64 setCoefficientRingFrom(UnivariatePolynomialZp64 univariatePolynomialZp64)
IPolynomial
univariatePolynomialZp64
- the polynomialpoly
public long modulus()
public UnivariatePolynomialZp64 setModulusUnsafe(long newModulus)
public UnivariatePolynomialZp64 setModulusUnsafe(IntegersZp64 newModulus)
public UnivariatePolynomialZp64 setModulus(long newModulus)
newModulus
- the new moduluspublic UnivariatePolynomialZp64 setModulus(IntegersZp64 newDomain)
newDomain
- the new domainpublic UnivariatePolynomialZ64 asPolyZSymmetric()
-modulus/2 <= cfx <= modulus/2
).-modulus/2 <= cfx <=
modulus/2
).public UnivariatePolynomialZ64 asPolyZ(boolean copy)
copy
- whether to copy the internal datapublic UnivariatePolynomialZp64[] createArray(int length)
IPolynomial
public UnivariatePolynomialZp64[] createArray(UnivariatePolynomialZp64 a, UnivariatePolynomialZp64 b)
IPolynomial
public UnivariatePolynomialZp64[][] createArray2d(int length)
IPolynomial
public UnivariatePolynomialZp64[][] createArray2d(int length1, int length2)
IPolynomial
public UnivariatePolynomialZp64 getRange(int from, int to)
IUnivariatePolynomial
from
(inclusive) to to
(exclusive)from
- the initial index of the range to be copied, inclusiveto
- the final index of the range to be copied, exclusive.public boolean sameCoefficientRingWith(UnivariatePolynomialZp64 oth)
IPolynomial
oth
and this
have the same coefficient ringoth
- other polynomialpublic UnivariatePolynomialZp64 createFromArray(long[] newData)
newData
- the datapublic UnivariatePolynomialZp64 createMonomial(long coefficient, int newDegree)
coefficient * x^degree
(with the same coefficient ring)coefficient
- monomial coefficientnewDegree
- monomial degreecoefficient * x^degree
public boolean isOverField()
IPolynomial
public boolean isOverFiniteField()
IPolynomial
public boolean isOverZ()
IPolynomial
public BigInteger coefficientRingCardinality()
IPolynomial
public BigInteger coefficientRingCharacteristic()
IPolynomial
public boolean isOverPerfectPower()
IPolynomial
coefficientRingCardinality()
is a perfect powercoefficientRingCardinality()
is a perfect powerpublic BigInteger coefficientRingPerfectPowerBase()
IPolynomial
base
so that coefficientRingCardinality() == base^exponent
or null if cardinality is not
finitebase
so that coefficientRingCardinality() == base^exponent
or null if cardinality is not
finitepublic BigInteger coefficientRingPerfectPowerExponent()
IPolynomial
exponent
so that coefficientRingCardinality() == base^exponent
or null if cardinality is
not finiteexponent
so that coefficientRingCardinality() == base^exponent
or null if cardinality is
not finitepublic long content()
public UnivariatePolynomialZp64 monic()
IPolynomial
this
to its monic part (that is this
divided by its leading coefficient), or returns null
(causing loss of internal data) if some of the elements can't be exactly divided by the lc()
. NOTE:
if null
is returned, the content of this
is destroyed.this
or null
public UnivariatePolynomialZp64 monic(long factor)
this
to its monic part multiplied by the factor
(that is monic(modulus).multiply(factor)
).factor
- the factorthis
public UnivariatePolynomialZp64 divideByLC(UnivariatePolynomialZp64 other)
IPolynomial
other
or returns null
(causing loss of
internal data) if some of the elements can't be exactly divided by the other.lc()
. NOTE: if null
is returned, the content of this
is destroyed.other
- the polynomialthis
divided by the other.lc()
or null
if exact division is not possiblepublic UnivariatePolynomialZp64 divide(long val)
val
- the valuethis / val
public UnivariatePolynomialZp64 multiplyByBigInteger(BigInteger factor)
IPolynomial
factor
factor
- the factorthis * factor
public UnivariatePolynomialZp64 multiply(UnivariatePolynomialZp64 oth)
IPolynomial
oth
oth
- the polynomialthis * oth
public UnivariatePolynomialZp64 square()
IPolynomial
this
this * this
public UnivariatePolynomialZp64 derivative()
IUnivariatePolynomial
public UnivariatePolynomial<BigInteger> toBigPoly()
this.ring.asGenericRing()
public UnivariatePolynomialZp64 clone()
IPolynomial
clone
in interface IPolynomial<UnivariatePolynomialZp64>
clone
in interface IUnivariatePolynomial<UnivariatePolynomialZp64>
public UnivariatePolynomialZp64 parsePoly(String string)
public String coefficientRingToString(IStringifier<UnivariatePolynomialZp64> stringifier)
IPolynomial
public MultivariatePolynomialZp64 composition(AMultivariatePolynomial value)
IUnivariatePolynomial
value
- polynomialthis(oth)
public MultivariatePolynomialZp64 asMultivariate()
IUnivariatePolynomial
public MultivariatePolynomialZp64 asMultivariate(Comparator<DegreeVector> ordering)
IUnivariatePolynomial
public final int degree()
IPolynomial
degree
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final long get(int i)
public final lPoly set(int i, long el)
public final lPoly setLC(long lc)
public final int firstNonZeroCoefficientPosition()
IUnivariatePolynomial
firstNonZeroCoefficientPosition
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final long lc()
public final lPoly lcAsPoly()
IPolynomial
lcAsPoly
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final lPoly ccAsPoly()
IPolynomial
ccAsPoly
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public lPoly getAsPoly(int i)
IUnivariatePolynomial
getAsPoly
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
i
- index in thispublic final long cc()
public final void ensureInternalCapacity(int desiredCapacity)
IUnivariatePolynomial
desiredCapacity
elementsensureInternalCapacity
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final lPoly createMonomial(int degree)
IUnivariatePolynomial
x^degree
(with the same coefficient ring)createMonomial
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
degree
- monomial degreecoefficient * x^degree
public final lPoly createLinear(long cc, long lc)
cc + x * lc
(with the same coefficient ring)cc
- the constant coefficientlc
- the leading coefficientcc + x * lc
public final lPoly createConstant(long val)
createConstant
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
val
- the valuepublic final lPoly createZero()
IPolynomial
createZero
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final lPoly createOne()
IPolynomial
createOne
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final boolean isZeroAt(int i)
IUnivariatePolynomial
isZeroAt
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
i
- the positionpublic final lPoly setZero(int i)
IUnivariatePolynomial
setZero
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
i
- positionpublic final lPoly setFrom(int indexInThis, lPoly poly, int indexInPoly)
IUnivariatePolynomial
setFrom
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
indexInThis
- index in selfpoly
- other polynomialindexInPoly
- index in other polynomialpublic final boolean isZero()
IPolynomial
true
if this is zeroisZero
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
this
is zeropublic final boolean isOne()
IPolynomial
true
if this is oneisOne
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
this
is onepublic final boolean isMonic()
IPolynomial
true
if this polynomial is monicisMonic
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
this
is monicpublic final boolean isUnitCC()
IPolynomial
isUnitCC
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final boolean isConstant()
IPolynomial
true
if this polynomial has only constant termisConstant
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
this
is constantpublic final boolean isMonomial()
IPolynomial
true
if this polynomial has only one monomial termisMonomial
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
this
has only one monomial termpublic final int signumOfLC()
IPolynomial
signumOfLC
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final double norm1()
this
public final double norm2()
this
public final double normMax()
public final long maxAbsCoefficient()
public final lPoly toZero()
IPolynomial
toZero
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final lPoly set(lPoly oth)
IPolynomial
oth
set
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
oth
- the polynomialpublic final lPoly setAndDestroy(lPoly oth)
IUnivariatePolynomial
oth
and destroys othsetAndDestroy
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
oth
- the polynomial (will be destroyed)public final lPoly shiftLeft(int offset)
IUnivariatePolynomial
this / x^offset
, it is polynomial with coefficient list formed by shifting
coefficients of this
to the left by offset
.shiftLeft
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
offset
- shift amountthis / x^offset
public final lPoly shiftRight(int offset)
IUnivariatePolynomial
this
by the x^offset
.shiftRight
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
offset
- monomial exponentthis * x^offset
public final lPoly truncate(int newDegree)
IUnivariatePolynomial
this rem x^(newDegree + 1)
, it is polynomial formed by coefficients of this from
zero to newDegree
(both inclusive)truncate
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
newDegree
- new degreethis rem x^(newDegree + 1)
public final lPoly reverse()
IUnivariatePolynomial
reverse
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final lPoly contentAsPoly()
IPolynomial
contentAsPoly
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final lPoly primitivePart()
IPolynomial
primitivePart
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final lPoly primitivePartSameSign()
IPolynomial
primitivePartSameSign
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final long evaluate(long point)
point
(via Horner method).point
- point
point
public final lPoly composition(lPoly value)
IUnivariatePolynomial
composition
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
value
- polynomialthis(oth)
public final lPoly shift(long value)
value
- shift amountpublic lPoly monicWithLC(lPoly other)
IPolynomial
this
to its monic part multiplied by the leading coefficient of other
;monicWithLC
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
other
- other polynomialother
or null if exact division by the
reduced leading coefficient is not possiblepublic final lPoly add(long val)
val
- some numberpublic final lPoly subtract(long val)
val
- some numberpublic final lPoly decrement()
IPolynomial
decrement
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
this - 1
public final lPoly increment()
IPolynomial
increment
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
this + 1
public final lPoly add(lPoly oth)
IPolynomial
oth
to this
.add
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
oth
- the polynomialthis + oth
public final lPoly addMonomial(long coefficient, int exponent)
coefficient*x^exponent
to this
coefficient
- monomial coefficientexponent
- monomial exponentthis + coefficient*x^exponent
public final lPoly addMul(lPoly oth, long factor)
oth * factor
to this
oth
- the polynomialfactor
- the factorthis + oth * factor
modulo modulus
public final lPoly subtract(lPoly oth)
IPolynomial
oth
from this
.subtract
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
oth
- the polynomialthis - oth
public final lPoly subtract(lPoly oth, long factor, int exponent)
factor * x^exponent * oth
from this
oth
- the polynomialfactor
- the factorexponent
- the exponentthis - factor * x^exponent * oth
public final lPoly negate()
IPolynomial
negate
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public lPoly multiplyByLC(lPoly other)
IPolynomial
other
multiplyByLC
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
other
- polynomialpublic final lPoly multiply(long factor)
IPolynomial
factor
multiply
in interface IPolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
factor
- the factorthis * factor
public final long[] getDataReferenceUnsafe()
public final int compareTo(lPoly o)
compareTo
in interface Comparable<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public String toString(IStringifier<lPoly> stringifier)
Stringifiable
toString
in interface Stringifiable<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public String toStringForCopy()
public Stream<lPoly> streamAsPolys()
IUnivariatePolynomial
streamAsPolys
in interface IUnivariatePolynomial<lPoly extends cc.redberry.rings.poly.univar.AUnivariatePolynomial64<lPoly>>
public final LongStream stream()
Stream
with coefficients of this as its source.Stream
over the coefficients in this polynomialpublic final <T> UnivariatePolynomial<T> mapCoefficients(Ring<T> ring, LongFunction<T> mapper)
stream().mapToObj(mapper).collect(new PolynomialCollector<>(ring))
.T
- result elements typering
- ring of the new polynomialmapper
- function that maps coefficients of this to coefficients of the resultmapper
Copyright © 2018. All rights reserved.