Interface IPolynomial<Poly extends IPolynomial<Poly>>

    • Method Detail

      • sameCoefficientRingWith

        boolean sameCoefficientRingWith​(Poly oth)
        Returns whether oth and this have the same coefficient ring
        Parameters:
        oth - other polynomial
        Returns:
        whether this and oth are over the same coefficient ring
      • assertSameCoefficientRingWith

        default void assertSameCoefficientRingWith​(Poly oth)
        Checks whether oth and this have the same coefficient ring, if not exception will be thrown
        Parameters:
        oth - other polynomial
        Throws:
        IllegalArgumentException - if this and oth have different coefficient ring
      • setCoefficientRingFrom

        Poly setCoefficientRingFrom​(Poly poly)
        Set the coefficient ring from specified poly
        Parameters:
        poly - the polynomial
        Returns:
        a copy of this with the coefficient ring taken from poly
      • setCoefficientRingFromOptional

        default Poly setCoefficientRingFromOptional​(Poly poly)
      • degree

        int degree()
        Returns the degree of this polynomial
        Returns:
        the degree
      • size

        int size()
        Returns the size of this polynomial
        Returns:
        the size
      • isZero

        boolean isZero()
        Returns true if this is zero
        Returns:
        whether this is zero
      • isOne

        boolean isOne()
        Returns true if this is one
        Returns:
        whether this is one
      • isMonic

        boolean isMonic()
        Returns true if this polynomial is monic
        Returns:
        whether this is monic
      • isUnitCC

        boolean isUnitCC()
        Returns true if constant term is equal to one
        Returns:
        whether constant term is 1
      • isZeroCC

        boolean isZeroCC()
        Returns true if constant term is zero
        Returns:
        whether constant term is zero
      • isConstant

        boolean isConstant()
        Returns true if this polynomial has only constant term
        Returns:
        whether this is constant
      • isMonomial

        boolean isMonomial()
        Returns true if this polynomial has only one monomial term
        Returns:
        whether this has only one monomial term
      • isOverField

        boolean isOverField()
        Returns whether the coefficient ring of this polynomial is a field
        Returns:
        whether the coefficient ring of this polynomial is a field
      • isOverZ

        boolean isOverZ()
        Returns whether the coefficient ring of this polynomial is Z
        Returns:
        whether the coefficient ring of this polynomial is Z
      • isOverFiniteField

        boolean isOverFiniteField()
        Returns whether the coefficient ring of this polynomial is a finite field
        Returns:
        whether the coefficient ring of this polynomial is a finite field
      • isLinearOrConstant

        boolean isLinearOrConstant()
        Returns whether this polynomial is linear (i.e. of the form a * X + b)
      • isLinearExactly

        boolean isLinearExactly()
        Returns whether this polynomial is linear (i.e. of the form a * X + b with nonzero a)
      • coefficientRingCardinality

        BigInteger coefficientRingCardinality()
        Returns cardinality of the coefficient ring of this poly
        Returns:
        cardinality of the coefficient ring
      • coefficientRingCharacteristic

        BigInteger coefficientRingCharacteristic()
        Returns characteristic of the coefficient ring of this poly
        Returns:
        characteristic of the coefficient ring
      • isOverPerfectPower

        boolean isOverPerfectPower()
        Returns whether the coefficientRingCardinality() is a perfect power
        Returns:
        whether the coefficientRingCardinality() is a perfect power
      • coefficientRingPerfectPowerBase

        BigInteger coefficientRingPerfectPowerBase()
        Returns base so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
        Returns:
        base so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
      • coefficientRingPerfectPowerExponent

        BigInteger coefficientRingPerfectPowerExponent()
        Returns exponent so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
        Returns:
        exponent so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
      • monic

        Poly 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(). NOTE: if null is returned, the content of this is destroyed.
        Returns:
        monic this or null
      • monicExact

        default Poly monicExact()
        Sets this to its monic part (that is this divided by its leading coefficient), or throws ArithmeticException if some of the elements can't be exactly divided by the l.c.
        Returns:
        monic this or null
        Throws:
        ArithmeticException - if some of the elements can't be exactly divided by the l.c.
      • canonical

        default Poly canonical()
        Makes this poly monic if coefficient ring is field, otherwise makes this primitive
      • signumOfLC

        int signumOfLC()
        Gives signum of the leading coefficient
        Returns:
        signum of the leading coefficient
      • toPositiveLC

        default Poly toPositiveLC()
        If signum of leading coefficient is minus one, negate this
      • toZero

        Poly toZero()
        Sets this to zero
        Returns:
        this := zero
      • set

        Poly set​(Poly oth)
        Sets the content of this to oth
        Parameters:
        oth - the polynomial
        Returns:
        this := oth
      • primitivePart

        Poly primitivePart()
        Reduces poly to its primitive part (primitive part will always have positive l.c.)
        Returns:
        primitive part (poly will be modified)
      • primitivePartSameSign

        Poly primitivePartSameSign()
        Reduces poly to its primitive part, so that primitive part will have the same signum as the initial poly
        Returns:
        primitive part (poly will be modified)
      • increment

        Poly increment()
        Adds 1 to this
        Returns:
        this + 1
      • decrement

        Poly decrement()
        Subtracts 1 from this
        Returns:
        this - 1
      • createZero

        Poly createZero()
        Returns the new instance of zero polynomial (with the same coefficient ring)
        Returns:
        new instance of 0
      • createOne

        Poly createOne()
        Returns the new instance of unit polynomial (with the same coefficient ring)
        Returns:
        new instance of 1
      • createConstant

        default Poly createConstant​(long value)
        Creates constant polynomial with specified value
        Parameters:
        value - the value
        Returns:
        constant polynomial
      • add

        Poly add​(Poly oth)
        Adds oth to this.
        Parameters:
        oth - the polynomial
        Returns:
        this + oth
      • add

        default Poly add​(Poly... oth)
        Adds oth to this.
        Parameters:
        oth - the polynomials
        Returns:
        this + oth
      • subtract

        Poly subtract​(Poly oth)
        Subtracts oth from this.
        Parameters:
        oth - the polynomial
        Returns:
        this - oth
      • subtract

        default Poly subtract​(Poly... oth)
        Subtracts oth from this.
        Parameters:
        oth - the polynomial
        Returns:
        this - oth
      • negate

        Poly negate()
        Negates this and returns
        Returns:
        this negated
      • multiply

        Poly multiply​(Poly oth)
        Multiplies this by oth
        Parameters:
        oth - the polynomial
        Returns:
        this * oth
      • multiply

        default Poly multiply​(Poly... oth)
        Multiplies this by oth
        Parameters:
        oth - the polynomials
        Returns:
        this * oth
      • multiply

        default Poly multiply​(Iterable<Poly> oth)
        Multiplies this by oth
        Parameters:
        oth - the polynomials
        Returns:
        this * oth
      • multiply

        Poly multiply​(long factor)
        Multiplies this by factor
        Parameters:
        factor - the factor
        Returns:
        this * factor
      • multiplyByBigInteger

        Poly multiplyByBigInteger​(BigInteger factor)
        Multiplies this by factor
        Parameters:
        factor - the factor
        Returns:
        this * factor
      • square

        Poly square()
        Squares this
        Returns:
        this * this
      • contentAsPoly

        Poly contentAsPoly()
        Returns the content of this (gcd of coefficients) as a constant poly
      • lcAsPoly

        Poly lcAsPoly()
        Returns the leading coefficient as a constant poly
      • ccAsPoly

        Poly ccAsPoly()
        Returns the constant coefficient as a constant poly
      • divideByLC

        Poly divideByLC​(Poly 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(). NOTE: if null is returned, the content of this is destroyed.
        Parameters:
        other - the polynomial
        Returns:
        this divided by the other.lc() or null if exact division is not possible
      • monicWithLC

        Poly monicWithLC​(Poly other)
        Sets this to its monic part multiplied by the leading coefficient of other;
        Parameters:
        other - other polynomial
        Returns:
        monic part multiplied by the leading coefficient of other or null if exact division by the reduced leading coefficient is not possible
      • multiplyByLC

        Poly multiplyByLC​(Poly other)
        Multiply this by the leading coefficient of other
        Parameters:
        other - polynomial
        Returns:
        this * lc(other)
      • clone

        Poly clone()
        Deep copy of this
        Returns:
        deep copy of this
      • copy

        default Poly copy()
        Deep copy of this (alias for clone(), required for scala)
        Returns:
        deep copy of this
      • createArray

        Poly[] createArray​(int length)
        overcome Java generics...
      • createArray2d

        Poly[][] createArray2d​(int length)
        overcome Java generics...
      • createArray2d

        Poly[][] createArray2d​(int length1,
                               int length2)
        overcome Java generics...
      • createArray

        default Poly[] createArray​(Poly a)
        overcome Java generics...
      • createArray

        default Poly[] createArray​(Poly a,
                                   Poly b)
        overcome Java generics...
      • createArray

        default Poly[] createArray​(Poly a,
                                   Poly b,
                                   Poly c)
        overcome Java generics...
      • coefficientRingToString

        String coefficientRingToString​(IStringifier<Poly> stringifier)
        String representation of the coefficient ring of this
      • coefficientRingToString

        default String coefficientRingToString()
        String representation of the coefficient ring of this
      • toString

        default String toString​(String... variables)
        String representation of this polynomial with specified string variables