Class ImageRing<F,​I>

    • Field Detail

      • ring

        public final Ring<F> ring
        the ring
      • imageFunc

        public final Function<F,​I> imageFunc
      • inverseFunc

        public final Function<I,​F> inverseFunc
    • Method Detail

      • image

        public I image​(F el)
      • image

        public I[] image​(F[] el)
      • inverse

        public F inverse​(I el)
      • inverse

        public F[] inverse​(I[] el)
      • isField

        public boolean isField()
        Description copied from interface: Ring
        Returns whether this ring is a field
        Specified by:
        isField in interface Ring<F>
        Returns:
        whether this ring is a field
      • isEuclideanRing

        public boolean isEuclideanRing()
        Description copied from interface: Ring
        Returns whether this ring is a Euclidean ring
        Specified by:
        isEuclideanRing in interface Ring<F>
        Returns:
        whether this ring is a Euclidean ring
      • cardinality

        public BigInteger cardinality()
        Description copied from interface: Ring
        Returns the number of elements in this ring (cardinality) or null if ring is infinite
        Specified by:
        cardinality in interface Ring<F>
        Returns:
        the number of elements in this ring (cardinality) or null if ring is infinite
      • characteristic

        public BigInteger characteristic()
        Description copied from interface: Ring
        Returns characteristic of this ring
        Specified by:
        characteristic in interface Ring<F>
        Returns:
        characteristic of this ring
      • isPerfectPower

        public boolean isPerfectPower()
        Description copied from interface: Ring
        Returns whether the cardinality is a perfect power (p^k with k > 1)
        Specified by:
        isPerfectPower in interface Ring<F>
        Returns:
        whether the cardinality is a perfect power (p^k with k > 1)
      • perfectPowerBase

        public BigInteger perfectPowerBase()
        Description copied from interface: Ring
        Returns base so that cardinality == base^exponent or null if cardinality is not finite
        Specified by:
        perfectPowerBase in interface Ring<F>
        Returns:
        base so that cardinality == base^exponent or null if cardinality is not finite
      • perfectPowerExponent

        public BigInteger perfectPowerExponent()
        Description copied from interface: Ring
        Returns exponent so that cardinality == base^exponent or null if cardinality is not finite
        Specified by:
        perfectPowerExponent in interface Ring<F>
        Returns:
        exponent so that cardinality == base^exponent or null if cardinality is not finite
      • add

        public I add​(I a,
                     I b)
        Description copied from interface: Ring
        Add two elements
        Specified by:
        add in interface Ring<F>
        Parameters:
        a - the first element
        b - the second element
        Returns:
        a + b
      • subtract

        public I subtract​(I a,
                          I b)
        Description copied from interface: Ring
        Subtracts b from a
        Specified by:
        subtract in interface Ring<F>
        Parameters:
        a - the first element
        b - the second element
        Returns:
        a - b
      • multiply

        public I multiply​(I a,
                          I b)
        Description copied from interface: Ring
        Multiplies two elements
        Specified by:
        multiply in interface Ring<F>
        Parameters:
        a - the first element
        b - the second element
        Returns:
        a * b
      • negate

        public I negate​(I element)
        Description copied from interface: Ring
        Negates the given element
        Specified by:
        negate in interface Ring<F>
        Parameters:
        element - the ring element
        Returns:
        -val
      • increment

        public I increment​(I element)
        Description copied from interface: Ring
        Returns element + 1
        Specified by:
        increment in interface Ring<F>
        Parameters:
        element - the element
        Returns:
        element + 1
      • decrement

        public I decrement​(I element)
        Description copied from interface: Ring
        Returns element - 1
        Specified by:
        decrement in interface Ring<F>
        Parameters:
        element - the element
        Returns:
        element - 1
      • add

        public I add​(I... elements)
        Description copied from interface: Ring
        Total of the array of elements
        Specified by:
        add in interface Ring<F>
        Parameters:
        elements - elements to sum
        Returns:
        sum of the array
      • multiply

        public I multiply​(I... elements)
        Description copied from interface: Ring
        Multiplies the array of elements
        Specified by:
        multiply in interface Ring<F>
        Parameters:
        elements - the elements
        Returns:
        product of the array
      • abs

        public I abs​(I el)
        Description copied from interface: Ring
        Returns the abs value of element (no copy)
        Specified by:
        abs in interface Ring<F>
      • copy

        public I copy​(I element)
        Description copied from interface: Ring
        Makes a deep copy of the specified element (for immutable instances the same reference returned).
        Specified by:
        copy in interface Ring<F>
        Parameters:
        element - the element
        Returns:
        deep copy of specified element
      • divideAndRemainder

        public I[] divideAndRemainder​(I dividend,
                                      I divider)
        Description copied from interface: Ring
        Returns quotient and remainder of dividend / divider
        Specified by:
        divideAndRemainder in interface Ring<F>
        Parameters:
        dividend - the dividend
        divider - the divider
        Returns:
        {quotient, remainder}
      • quotient

        public I quotient​(I dividend,
                          I divider)
        Description copied from interface: Ring
        Returns the quotient of dividend / divider
        Specified by:
        quotient in interface Ring<F>
        Parameters:
        dividend - the dividend
        divider - the divider
        Returns:
        the quotient of dividend / divider
      • remainder

        public I remainder​(I dividend,
                           I divider)
        Description copied from interface: Ring
        Returns the remainder of dividend / divider
        Specified by:
        remainder in interface Ring<F>
        Parameters:
        dividend - the dividend
        divider - the divider
        Returns:
        the remainder of dividend / divider
      • reciprocal

        public I reciprocal​(I element)
        Description copied from interface: Ring
        Gives the inverse element element ^ (-1)
        Specified by:
        reciprocal in interface Ring<F>
        Parameters:
        element - the element
        Returns:
        element ^ (-1)
      • getZero

        public I getZero()
        Description copied from interface: Ring
        Returns zero element of this ring
        Specified by:
        getZero in interface Ring<F>
        Returns:
        0
      • getOne

        public I getOne()
        Description copied from interface: Ring
        Returns unit element of this ring (one)
        Specified by:
        getOne in interface Ring<F>
        Returns:
        1
      • isZero

        public boolean isZero​(I element)
        Description copied from interface: Ring
        Tests whether specified element is zero
        Specified by:
        isZero in interface Ring<F>
        Parameters:
        element - the ring element
        Returns:
        whether specified element is zero
      • isOne

        public boolean isOne​(I element)
        Description copied from interface: Ring
        Tests whether specified element is one (exactly)
        Specified by:
        isOne in interface Ring<F>
        Parameters:
        element - the ring element
        Returns:
        whether specified element is exactly one
        See Also:
        Ring.isUnit(Object)
      • isUnit

        public boolean isUnit​(I element)
        Description copied from interface: Ring
        Tests whether specified element is a ring unit
        Specified by:
        isUnit in interface Ring<F>
        Parameters:
        element - the ring element
        Returns:
        whether specified element is a ring unit
        See Also:
        Ring.isOne(Object)
      • valueOf

        public I valueOf​(long val)
        Description copied from interface: Ring
        Returns ring element associated with specified long
        Specified by:
        valueOf in interface Ring<F>
        Parameters:
        val - machine integer
        Returns:
        ring element associated with specified long
      • valueOfBigInteger

        public I valueOfBigInteger​(BigInteger val)
        Description copied from interface: Ring
        Returns ring element associated with specified integer
        Specified by:
        valueOfBigInteger in interface Ring<F>
        Parameters:
        val - integer
        Returns:
        ring element associated with specified integer
      • valueOf

        public I valueOf​(I val)
        Description copied from interface: Ring
        Converts a value from other ring to this ring. The result is not guarantied to be a new instance (i.e. val == valueOf(val) is possible).
        Specified by:
        valueOf in interface Ring<F>
        Parameters:
        val - some element from any ring
        Returns:
        this ring element associated with specified val
      • iterator

        public Iterator<I> iterator()
        Description copied from interface: Ring
        Returns iterator over ring elements (for finite rings, otherwise throws exception)
        Specified by:
        iterator in interface Iterable<F>
        Specified by:
        iterator in interface Ring<F>
      • gcd

        public I gcd​(I a,
                     I b)
        Description copied from interface: Ring
        Returns the greatest common divisor of two elements
        Specified by:
        gcd in interface Ring<F>
        Parameters:
        a - the first element
        b - the second element
        Returns:
        gcd
      • extendedGCD

        public I[] extendedGCD​(I a,
                               I b)
        Description copied from interface: Ring
        Returns array of [gcd(a,b), s, t] such that s * a + t * b = gcd(a, b)
        Specified by:
        extendedGCD in interface Ring<F>
      • lcm

        public I lcm​(I a,
                     I b)
        Description copied from interface: Ring
        Returns the least common multiple of two elements
        Specified by:
        lcm in interface Ring<F>
        Parameters:
        a - the first element
        b - the second element
        Returns:
        lcm
      • gcd

        public I gcd​(I... elements)
        Description copied from interface: Ring
        Returns greatest common divisor of specified elements
        Specified by:
        gcd in interface Ring<F>
        Parameters:
        elements - the elements
        Returns:
        gcd
      • gcd

        public I gcd​(Iterable<I> elements)
        Description copied from interface: Ring
        Returns greatest common divisor of specified elements
        Specified by:
        gcd in interface Ring<F>
        Parameters:
        elements - the elements
        Returns:
        gcd
      • signum

        public int signum​(I element)
        Description copied from interface: Ring
        Returns -1 if element < 0, 0 if element == 0 and 1 if element > 0, where comparison is specified by Comparator.compare(Object, Object)
        Specified by:
        signum in interface Ring<F>
        Parameters:
        element - the element
        Returns:
        -1 if element < 0, 0 if element == 0 and 1 otherwise
      • parse

        public I parse​(String string)
        Description copied from interface: Ring
        Parse string into ring element
        Specified by:
        parse in interface IParser<F>
        Specified by:
        parse in interface Ring<F>
        Parameters:
        string - string
        Returns:
        ring element
        See Also:
        Coder
      • pow

        public I pow​(I base,
                     int exponent)
        Description copied from interface: Ring
        Returns base in a power of exponent (non negative)
        Specified by:
        pow in interface Ring<F>
        Parameters:
        base - base
        exponent - exponent (non negative)
        Returns:
        base in a power of exponent
      • pow

        public I pow​(I base,
                     long exponent)
        Description copied from interface: Ring
        Returns base in a power of exponent (non negative)
        Specified by:
        pow in interface Ring<F>
        Parameters:
        base - base
        exponent - exponent (non negative)
        Returns:
        base in a power of exponent
      • pow

        public I pow​(I base,
                     BigInteger exponent)
        Description copied from interface: Ring
        Returns base in a power of exponent (non negative)
        Specified by:
        pow in interface Ring<F>
        Parameters:
        base - base
        exponent - exponent (non negative)
        Returns:
        base in a power of exponent
      • factorial

        public I factorial​(long num)
        Description copied from interface: Ring
        Gives a product of valueOf(1) * valueOf(2) * .... * valueOf(num)
        Specified by:
        factorial in interface Ring<F>
        Parameters:
        num - the number
        Returns:
        valueOf(1) * valueOf(2) * .... * valueOf(num)
      • randomElement

        public I randomElement​(org.apache.commons.math3.random.RandomGenerator rnd)
        Description copied from interface: Ring
        Returns a random element from this ring
        Specified by:
        randomElement in interface Ring<F>
        Parameters:
        rnd - the source of randomness
        Returns:
        random element from this ring
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object