Package edu.jas.poly

Class GenExteriorPolynomial<C extends RingElem<C>>

    • Field Detail

      • val

        final java.util.SortedMap<IndexList,​C extends RingElem<C>> val
        The data structure for polynomials.
      • logger

        private static final org.apache.logging.log4j.Logger logger
      • debug

        private static final boolean debug
    • Constructor Detail

      • GenExteriorPolynomial

        private GenExteriorPolynomial​(GenExteriorPolynomialRing<C> r,
                                      java.util.TreeMap<IndexList,​C> t)
        Private constructor for GenExteriorPolynomial.
        Parameters:
        r - polynomial ring factory.
        t - TreeMap with correct ordering.
      • GenExteriorPolynomial

        public GenExteriorPolynomial​(GenExteriorPolynomialRing<C> r)
        Constructor for zero GenExteriorPolynomial.
        Parameters:
        r - polynomial ring factory.
      • GenExteriorPolynomial

        public GenExteriorPolynomial​(GenExteriorPolynomialRing<C> r,
                                     C c,
                                     IndexList e)
        Constructor for GenExteriorPolynomial c * xe.
        Parameters:
        r - polynomial ring factory.
        c - coefficient.
        e - word.
      • GenExteriorPolynomial

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

        public GenExteriorPolynomial​(GenExteriorPolynomialRing<C> r,
                                     IndexList e)
        Constructor for GenExteriorPolynomial xe.
        Parameters:
        r - polynomial ring factory.
        e - index list.
      • GenExteriorPolynomial

        public GenExteriorPolynomial​(GenExteriorPolynomialRing<C> r,
                                     ExpVector e)
        Constructor for GenExteriorPolynomial xe.
        Parameters:
        r - polynomial ring factory.
        e - exponent vector.
      • GenExteriorPolynomial

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

        protected GenExteriorPolynomial​(GenExteriorPolynomialRing<C> r,
                                        java.util.SortedMap<IndexList,​C> v)
        Constructor for GenExteriorPolynomial.
        Parameters:
        r - polynomial ring factory.
        v - the SortedMap of some other polynomial.
    • Method Detail

      • length

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

        public java.util.SortedMap<IndexList,​C> getMap()
        IndexList to coefficient map of GenExteriorPolynomial.
        Returns:
        val as unmodifiable SortedMap.
      • doPutToMap

        public void doPutToMap​(IndexList e,
                               C c)
        Put a IndexList to coefficient entry into the internal map of this GenExteriorPolynomial. 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 - index list.
      • doRemoveFromMap

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

        public void doPutToMap​(java.util.SortedMap<IndexList,​C> vals)
        Put an a sorted map of index list to coefficients into the internal map of this GenExteriorPolynomial. 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 index list and coefficients.
      • toString

        public java.lang.String toString()
        String representation of GenExteriorPolynomial.
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • toScript

        public java.lang.String toScript()
        Get a scripting compatible string representation.
        Specified by:
        toScript in interface Element<C extends RingElem<C>>
        Returns:
        script compatible representation for this Element.
        See Also:
        Element.toScript()
      • toScriptFactory

        public java.lang.String toScriptFactory()
        Get a scripting compatible string representation of the factory.
        Specified by:
        toScriptFactory in interface Element<C extends RingElem<C>>
        Returns:
        script compatible representation for this ElemFactory.
        See Also:
        Element.toScriptFactory()
      • isONE

        public boolean isONE()
        Is GenExteriorPolynomial<C> one.
        Specified by:
        isONE in interface MonoidElem<C extends RingElem<C>>
        Returns:
        If this is 1 then true is returned, else false.
        See Also:
        MonoidElem.isONE()
      • isUnit

        public boolean isUnit()
        Is GenExteriorPolynomial<C> a unit.
        Specified by:
        isUnit in interface MonoidElem<C extends RingElem<C>>
        Returns:
        If this is a unit then true is returned, else false.
        See Also:
        MonoidElem.isUnit()
      • isConstant

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

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

        public GenExteriorPolynomial<C> form​(long k)
        k-form part.
        Parameters:
        k - requested k-form part.
        Returns:
        k-form part of given degree of this.
      • homogeneousPart

        public GenExteriorPolynomial<C> homogeneousPart​(long tdeg)
        Homogeneous part.
        Parameters:
        tdeg - requested degree of part.
        Returns:
        polynomial part of given degree.
      • equals

        public boolean equals​(java.lang.Object B)
        Comparison with any other object.
        Specified by:
        equals in interface Element<C extends RingElem<C>>
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to b, else false.
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Hash code for this polynomial.
        Specified by:
        hashCode in interface Element<C extends RingElem<C>>
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashCode.
        See Also:
        Object.hashCode()
      • compareTo

        public int compareTo​(GenExteriorPolynomial<C> b)
        GenExteriorPolynomial comparison.
        Specified by:
        compareTo in interface java.lang.Comparable<C extends RingElem<C>>
        Specified by:
        compareTo in interface Element<C extends RingElem<C>>
        Parameters:
        b - GenExteriorPolynomial.
        Returns:
        sign(this-b).
      • signum

        public int signum()
        GenExteriorPolynomial signum.
        Specified by:
        signum in interface AbelianGroupElem<C extends RingElem<C>>
        Returns:
        sign(ldcf(this)).
      • numberOfVariables

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

        public java.util.Map.Entry<IndexList,​C> leadingMonomial()
        Leading monomial.
        Returns:
        first map entry.
      • leadingIndexList

        public IndexList leadingIndexList()
        Leading index list.
        Returns:
        first highest index list.
      • trailingIndexList

        public IndexList trailingIndexList()
        Trailing index list.
        Returns:
        last lowest index list.
      • 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​(IndexList e)
        Coefficient.
        Parameters:
        e - index list.
        Returns:
        coefficient for given index list.
      • degree

        public long degree()
        Index degree.
        Returns:
        maximal length of indexes.
      • maxDegree

        public long maxDegree()
        Index maximal degree.
        Returns:
        maximal degree of indexes.
      • maxNorm

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

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

        public GenExteriorPolynomial<C> sum​(C a,
                                            IndexList e)
        GenExteriorPolynomial addition. This method is not very efficient, since this is copied.
        Parameters:
        a - coefficient.
        e - index list.
        Returns:
        this + a e.
      • sum

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

        public GenExteriorPolynomial<C> subtract​(C a,
                                                 IndexList e)
        GenExteriorPolynomial subtraction. This method is not very efficient, since this is copied.
        Parameters:
        a - coefficient.
        e - index list.
        Returns:
        this - a e.
      • subtract

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

        public GenExteriorPolynomial<C> interiorRightProduct​(GenExteriorPolynomial<C> S)
        GenExteriorPolynomial interior right multiplication.
        Parameters:
        S - GenExteriorPolynomial.
        Returns:
        this |_ S.
      • multiply

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

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

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

        public GenExteriorPolynomial<C> multiply​(C s,
                                                 IndexList e)
        GenExteriorPolynomial multiplication. Product with ring element and index list.
        Parameters:
        s - coefficient.
        e - left index list.
        Returns:
        this * s e.
      • multiply

        public GenExteriorPolynomial<C> multiply​(IndexList e,
                                                 IndexList f)
        GenExteriorPolynomial left and right multiplication. Product with ring element and two index lists.
        Parameters:
        e - left index list.
        f - right index list.
        Returns:
        e * this * f.
      • multiply

        public GenExteriorPolynomial<C> multiply​(C s,
                                                 IndexList e,
                                                 IndexList f)
        GenExteriorPolynomial left and right multiplication. Product with ring element and two index lists.
        Parameters:
        s - coefficient.
        e - left index list.
        f - right index list.
        Returns:
        e * this * s * f.
      • multiply

        public GenExteriorPolynomial<C> multiply​(C s,
                                                 IndexList e,
                                                 C t,
                                                 IndexList f)
        GenExteriorPolynomial left and right multiplication. Product with ring element and two index lists.
        Parameters:
        s - coefficient.
        e - left index list.
        t - coefficient.
        f - right index list.
        Returns:
        s * e * this * t * f.
      • multiply

        public GenExteriorPolynomial<C> multiply​(IndexList e)
        GenExteriorPolynomial multiplication. Product with index list.
        Parameters:
        e - index list (!= null).
        Returns:
        this * e.
      • multiply

        public GenExteriorPolynomial<C> multiply​(java.util.Map.Entry<IndexList,​C> m)
        GenExteriorPolynomial multiplication. Product with 'monomial'.
        Parameters:
        m - 'monomial'.
        Returns:
        this * m.
      • divide

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

        public GenExteriorPolynomial<C> coeffPrimitivePart()
        GenExteriorPolynomial coefficient primitive part. Division by gcd of coefficients.
        Returns:
        this/gcd(coeff(this)).
      • quotientRemainder

        public GenExteriorPolynomial<C>[] quotientRemainder​(GenExteriorPolynomial<C> S)
        GenExteriorPolynomial 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.
        Specified by:
        quotientRemainder in interface MonoidElem<C extends RingElem<C>>
        Parameters:
        S - nonzero GenExteriorPolynomial with invertible leading coefficient.
        Returns:
        [ quotient , remainder ] with this = quotient * S + remainder and deg(remainder) < deg(S) or remainder = 0.
        See Also:
        .
      • divide

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

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

        public GenExteriorPolynomial<C> inverse()
        GenExteriorPolynomial inverse. Required by RingElem. Throws not invertible exception.
        Specified by:
        inverse in interface MonoidElem<C extends RingElem<C>>
        Returns:
        x with this * x = 1, if it exists.
      • shiftIndex

        public GenExteriorPolynomial<C> shiftIndex​(int s)
        GenExteriorPolynomial shift index. Add number to each index.
        Parameters:
        s - shift index by this number.
        Returns:
        this.shift(s).
      • coefficientIterator

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

        public java.util.Iterator<IndexList> indexListIterator()
        Iterator over index lists.
        Returns:
        val.keySet().iterator().
      • iterator

        public java.util.Iterator<IndexListMonomial<C>> iterator()
        Iterator over monomials.
        Specified by:
        iterator in interface java.lang.Iterable<C extends RingElem<C>>
        Returns:
        a PolyIterator.
      • map

        public GenExteriorPolynomial<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)).