GenPolynomial
edu.jas.poly

Class GenPolynomial<C extends RingElem<C>>

    • Constructor Detail

      • GenPolynomial

        public GenPolynomial(GenPolynomialRing<C> r)
        Constructor for zero GenPolynomial.
        Parameters:
        r - polynomial ring factory.
      • GenPolynomial

        public GenPolynomial(GenPolynomialRing<C> r,             C c,             ExpVector e)
        Constructor for GenPolynomial c * xe.
        Parameters:
        r - polynomial ring factory.
        c - coefficient.
        e - exponent.
      • GenPolynomial

        public GenPolynomial(GenPolynomialRing<C> r,             C c)
        Constructor for GenPolynomial c * x0.
        Parameters:
        r - polynomial ring factory.
        c - coefficient.
      • GenPolynomial

        public GenPolynomial(GenPolynomialRing<C> r,             ExpVector e)
        Constructor for GenPolynomial xe.
        Parameters:
        r - polynomial ring factory.
        e - exponent.
    • Method Detail

      • length

        public int length()
        Length of GenPolynomial.
        Returns:
        number of coefficients of this GenPolynomial.
      • getMap

        public SortedMap<ExpVector,C> getMap()
        ExpVector to coefficient map of GenPolynomial.
        Returns:
        val as unmodifiable SortedMap.
      • doPutToMap

        public void doPutToMap(ExpVector e,              C c)
        Put an ExpVector to coefficient entry into the internal map of this GenPolynomial. 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:
        c - coefficient.
        e - exponent.
      • doRemoveFromMap

        public void doRemoveFromMap(ExpVector e,                   C c)
        Remove an ExpVector to coefficient entry from the internal map of this GenPolynomial. 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 - exponent.
        c - expected coefficient, null for ignore.
      • doPutToMap

        public void doPutToMap(SortedMap<ExpVector,C> vals)
        Put an a sorted map of exponents to coefficients into the internal map of this GenPolynomial. 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 exponents and coefficients.
      • toString

        public String toString(String[] v)
        String representation of GenPolynomial.
        Parameters:
        v - names for variables.
        See Also:
        Object.toString()
      • isConstant

        public boolean isConstant()
        Is GenPolynomial<C> a constant.
        Returns:
        If this is a constant polynomial then true is returned, else false.
      • isHomogeneous

        public boolean isHomogeneous()
        Is GenPolynomial<C> homogeneous.
        Returns:
        true, if this is homogeneous, else false.
      • numberOfVariables

        public int numberOfVariables()
        Number of variables.
        Returns:
        ring.nvar.
      • leadingMonomial

        public Map.Entry<ExpVector,C> leadingMonomial()
        Leading monomial.
        Returns:
        first map entry.
      • leadingExpVector

        public ExpVector leadingExpVector()
        Leading exponent vector.
        Returns:
        first exponent.
      • trailingExpVector

        public ExpVector trailingExpVector()
        Trailing exponent vector.
        Returns:
        last exponent.
      • leadingBaseCoefficient

        public C leadingBaseCoefficient()
        Leading base coefficient.
        Returns:
        first coefficient.
      • trailingBaseCoefficient

        public C trailingBaseCoefficient()
        Trailing base coefficient.
        Returns:
        coefficient of constant term.
      • coefficient

        public C coefficient(ExpVector e)
        Coefficient.
        Parameters:
        e - exponent.
        Returns:
        coefficient for given exponent.
      • reductum

        public GenPolynomial<C> reductum()
        Reductum.
        Returns:
        this - leading monomial.
      • degree

        public long degree(int i)
        Degree in variable i.
        Returns:
        maximal degree in the variable i.
      • degree

        public long degree()
        Maximal degree.
        Returns:
        maximal degree in any variables.
      • totalDegree

        public long totalDegree()
        Total degree.
        Returns:
        total degree in any variables.
      • degreeVector

        public ExpVector degreeVector()
        Maximal degree vector.
        Returns:
        maximal degree vector of all variables.
      • maxNorm

        public C maxNorm()
        GenPolynomial maximum norm.
        Returns:
        ||this||.
      • sumNorm

        public C sumNorm()
        GenPolynomial sum norm.
        Returns:
        sum of all absolute values of coefficients.
      • sum

        public GenPolynomial<C> sum(C a,                   ExpVector e)
        GenPolynomial addition. This method is not very efficient, since this is copied.
        Parameters:
        a - coefficient.
        e - exponent.
        Returns:
        this + a xe.
      • sum

        public GenPolynomial<C> sum(C a)
        GenPolynomial addition. This method is not very efficient, since this is copied.
        Parameters:
        a - coefficient.
        Returns:
        this + a x0.
      • subtract

        public GenPolynomial<C> subtract(C a,                        ExpVector e)
        GenPolynomial subtraction. This method is not very efficient, since this is copied.
        Parameters:
        a - coefficient.
        e - exponent.
        Returns:
        this - a xe.
      • subtract

        public GenPolynomial<C> subtract(C a)
        GenPolynomial subtract. This method is not very efficient, since this is copied.
        Parameters:
        a - coefficient.
        Returns:
        this + a x0.
      • subtractMultiple

        public GenPolynomial<C> subtractMultiple(C a,                                GenPolynomial<C> S)
        GenPolynomial subtract a multiple.
        Parameters:
        a - coefficient.
        S - GenPolynomial.
        Returns:
        this - a xe S.
      • subtractMultiple

        public GenPolynomial<C> subtractMultiple(C a,                                ExpVector e,                                GenPolynomial<C> S)
        GenPolynomial subtract a multiple.
        Parameters:
        a - coefficient.
        e - exponent.
        S - GenPolynomial.
        Returns:
        this - a xe S.
      • scaleSubtractMultiple

        public GenPolynomial<C> scaleSubtractMultiple(C b,                                     C a,                                     ExpVector e,                                     GenPolynomial<C> S)
        GenPolynomial scale and subtract a multiple.
        Parameters:
        b - scale factor.
        a - coefficient.
        e - exponent.
        S - GenPolynomial.
        Returns:
        this * b - a xe S.
      • scaleSubtractMultiple

        public GenPolynomial<C> scaleSubtractMultiple(C b,                                     ExpVector g,                                     C a,                                     ExpVector e,                                     GenPolynomial<C> S)
        GenPolynomial scale and subtract a multiple.
        Parameters:
        b - scale factor.
        g - scale exponent.
        a - coefficient.
        e - exponent.
        S - GenPolynomial.
        Returns:
        this * a xg - a xe S.
      • multiply

        public GenPolynomial<C> multiply(C s)
        GenPolynomial multiplication. Product with coefficient ring element.
        Parameters:
        s - coefficient.
        Returns:
        this*s.
      • monic

        public GenPolynomial<C> monic()
        GenPolynomial monic, i.e. leadingCoefficient == 1. If leadingCoefficient is not invertible returns this unmodified.
        Returns:
        monic(this).
      • multiply

        public GenPolynomial<C> multiply(C s,                        ExpVector e)
        GenPolynomial multiplication. Product with ring element and exponent vector.
        Parameters:
        s - coefficient.
        e - exponent.
        Returns:
        this * s xe.
      • multiply

        public GenPolynomial<C> multiply(ExpVector e)
        GenPolynomial multiplication. Product with exponent vector.
        Parameters:
        e - exponent (!= null).
        Returns:
        this * xe.
      • multiply

        public GenPolynomial<C> multiply(Map.Entry<ExpVector,C> m)
        GenPolynomial multiplication. Product with 'monomial'.
        Parameters:
        m - 'monomial'.
        Returns:
        this * m.
      • divide

        public GenPolynomial<C> divide(C s)
        GenPolynomial division. Division by coefficient ring element. Fails, if exact division is not possible.
        Parameters:
        s - coefficient.
        Returns:
        this/s.
      • quotientRemainder

        public GenPolynomial<C>[] quotientRemainder(GenPolynomial<C> S)
        GenPolynomial 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.
        Parameters:
        S - nonzero GenPolynomial with invertible leading coefficient.
        Returns:
        [ quotient , remainder ] with this = quotient * S + remainder and deg(remainder) < deg(S) or remiander = 0.
        See Also:
        .
      • divideAndRemainder

        @Deprecatedpublic GenPolynomial<C>[] divideAndRemainder(GenPolynomial<C> S)
        Deprecated. use quotientRemainder()
        GenPolynomial 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.
        Parameters:
        S - nonzero GenPolynomial with invertible leading coefficient.
        Returns:
        [ quotient , remainder ] with this = quotient * S + remainder and deg(remainder) < deg(S) or remiander = 0.
        See Also:
        .
      • divide

        public GenPolynomial<C> divide(GenPolynomial<C> S)
        GenPolynomial 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 interface MonoidElem<GenPolynomial<C extends RingElem<C>>>
        Parameters:
        S - nonzero GenPolynomial with invertible leading coefficient.
        Returns:
        quotient with this = quotient * S + remainder.
        See Also:
        .
      • remainder

        public GenPolynomial<C> remainder(GenPolynomial<C> S)
        GenPolynomial 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 interface MonoidElem<GenPolynomial<C extends RingElem<C>>>
        Parameters:
        S - nonzero GenPolynomial with invertible leading coefficient.
        Returns:
        remainder with this = quotient * S + remainder.
        See Also:
        .
      • egcd

        public GenPolynomial<C>[] egcd(GenPolynomial<C> S)
        GenPolynomial extended greatest comon divisor. Only for univariate polynomials over fields.
        Specified by:
        egcd in interface RingElem<GenPolynomial<C extends RingElem<C>>>
        Parameters:
        S - GenPolynomial.
        Returns:
        [ gcd(this,S), a, b ] with a*this + b*S = gcd(this,S).
      • hegcd

        public GenPolynomial<C>[] hegcd(GenPolynomial<C> S)
        GenPolynomial half extended greatest comon divisor. Only for univariate polynomials over fields.
        Parameters:
        S - GenPolynomial.
        Returns:
        [ gcd(this,S), a ] with a*this + b*S = gcd(this,S).
      • modInverse

        public GenPolynomial<C> modInverse(GenPolynomial<C> m)
        GenPolynomial modular inverse. Only for univariate polynomials over fields.
        Parameters:
        m - GenPolynomial.
        Returns:
        a with with a*this = 1 mod m.
      • extend

        public GenPolynomial<C> extend(GenPolynomialRing<C> pfac,                      int j,                      long k)
        Extend variables. Used e.g. in module embedding. Extend all ExpVectors by i elements and multiply by x_j^k.
        Parameters:
        pfac - extended polynomial ring factory (by i variables).
        j - index of variable to be used for multiplication.
        k - exponent for x_j.
        Returns:
        extended polynomial.
      • extendLower

        public GenPolynomial<C> extendLower(GenPolynomialRing<C> pfac,                           int j,                           long k)
        Extend lower variables. Used e.g. in module embedding. Extend all ExpVectors by i lower elements and multiply by x_j^k.
        Parameters:
        pfac - extended polynomial ring factory (by i variables).
        j - index of variable to be used for multiplication.
        k - exponent for x_j.
        Returns:
        extended polynomial.
      • contract

        public Map<ExpVector,GenPolynomial<C>> contract(GenPolynomialRing<C> pfac)
        Contract variables. Used e.g. in module embedding. Remove i elements of each ExpVector.
        Parameters:
        pfac - contracted polynomial ring factory (by i variables).
        Returns:
        Map of exponents and contracted polynomials. Note: could return SortedMap
      • contractCoeff

        public GenPolynomial<C> contractCoeff(GenPolynomialRing<C> pfac)
        Contract variables to coefficient polynomial. Remove i elements of each ExpVector, removed elements must be zero.
        Parameters:
        pfac - contracted polynomial ring factory (by i variables).
        Returns:
        contracted coefficient polynomial.
      • extendUnivariate

        public GenPolynomial<C> extendUnivariate(GenPolynomialRing<C> pfac,                                int i)
        Extend univariate to multivariate polynomial. This is an univariate polynomial in variable i of the polynomial ring, it is extended to the given polynomial ring.
        Parameters:
        pfac - extended polynomial ring factory.
        i - index of the variable of this polynomial in pfac.
        Returns:
        extended multivariate polynomial.
      • homogenize

        public GenPolynomial<C> homogenize(GenPolynomialRing<C> pfac)
        Make homogeneous.
        Parameters:
        pfac - extended polynomial ring factory (by 1 variable).
        Returns:
        homogeneous polynomial.
      • deHomogenize

        public GenPolynomial<C> deHomogenize(GenPolynomialRing<C> pfac)
        Dehomogenize.
        Parameters:
        pfac - contracted polynomial ring factory (by 1 variable).
        Returns:
        in homogeneous polynomial.
      • coefficientIterator

        public Iterator<C> coefficientIterator()
        Iterator over coefficients.
        Returns:
        val.values().iterator().
      • exponentIterator

        public Iterator<ExpVector> exponentIterator()
        Iterator over exponents.
        Returns:
        val.keySet().iterator().
      • map

        public GenPolynomial<C> map(UnaryFunctor<? super C,C> f)
        Map a unary function to the coefficients.
        Parameters:
        f - evaluation functor.
        Returns:
        new polynomial with coefficients f(this(e)).

SCaVis 2.0 © jWork.ORG