Package edu.jas.arith

Class Product<C extends RingElem<C>>

    • Field Detail

      • logger

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

        public final java.util.SortedMap<java.lang.Integer,​C extends RingElem<C>> val
        Value part of the element data structure.
      • isunit

        protected int isunit
        Flag to remember if this product element is a unit in each cmponent. -1 is unknown, 1 is unit, 0 not a unit.
    • Constructor Detail

      • Product

        public Product​(ProductRing<C> r)
        The constructor creates a Product object from a ring factory.
        Parameters:
        r - ring factory.
      • Product

        public Product​(ProductRing<C> r,
                       java.util.SortedMap<java.lang.Integer,​C> a)
        The constructor creates a Product object from a ring factory and a ring element.
        Parameters:
        r - ring factory.
        a - ring element.
      • Product

        public Product​(ProductRing<C> r,
                       java.util.SortedMap<java.lang.Integer,​C> a,
                       int u)
        The constructor creates a Product object from a ring factory, a ring element and an indicator if a is a unit.
        Parameters:
        r - ring factory.
        a - ring element.
        u - isunit indicator, -1, 0, 1.
    • Method Detail

      • get

        public C get​(int i)
        Get component.
        Parameters:
        i - index of component.
        Returns:
        val(i).
      • copy

        public Product<C> copy()
        Clone this.
        Specified by:
        copy in interface Element<C extends RingElem<C>>
        Returns:
        Creates and returns a copy of this Element.
        See Also:
        Object.clone()
      • isFull

        public boolean isFull()
        Is Product full.
        Specified by:
        isFull in interface RegularRingElem<C extends RingElem<C>>
        Returns:
        If every component is non-zero, then true is returned, else false.
      • isIdempotent

        public boolean isIdempotent()
        Is Product idempotent.
        Specified by:
        isIdempotent in interface RegularRingElem<C extends RingElem<C>>
        Returns:
        If this is a idempotent element then true is returned, else false.
      • toString

        public java.lang.String toString()
        Get the String representation as RingElem.
        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()
      • compareTo

        public int compareTo​(Product<C> b)
        Product 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 - Product.
        Returns:
        sign(this-b).
      • 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 local.
        Specified by:
        hashCode in interface Element<C extends RingElem<C>>
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashCode.
        See Also:
        Object.hashCode()
      • extend

        public Product<C> extend​(int i,
                                 int j)
        Product extend. Add new component j with value of component i.
        Parameters:
        i - from index.
        j - to index.
        Returns:
        the extended value of this.
      • quotientRemainder

        public Product<C>[] quotientRemainder​(Product<C> S)
        Quotient and remainder by division of this by S.
        Specified by:
        quotientRemainder in interface MonoidElem<C extends RingElem<C>>
        Parameters:
        S - a product
        Returns:
        [this/S, this - (this/S)*S].
      • multiply

        public Product<C> multiply​(C c)
        Product multiply by coefficient.
        Parameters:
        c - coefficient.
        Returns:
        this*c.
      • gcd

        public Product<C> gcd​(Product<C> S)
        Greatest common divisor.
        Specified by:
        gcd in interface RingElem<C extends RingElem<C>>
        Parameters:
        S - other element.
        Returns:
        gcd(this,S).
      • egcd

        public Product<C>[] egcd​(Product<C> S)
        Extended greatest common divisor.
        Specified by:
        egcd in interface RingElem<C extends RingElem<C>>
        Parameters:
        S - other element.
        Returns:
        [ gcd(this,S), c1, c2 ] with c1*this + c2*b = gcd(this,S).