Class RandomUnivariatePolynomials


  • public final class RandomUnivariatePolynomials
    extends Object
    Methods to generate random polynomials.
    Since:
    1.0
    • Method Summary

      Modifier and Type Method Description
      static <E> E[] randomArray​(int degree, Ring<E> ring, Function<org.apache.commons.math3.random.RandomGenerator,​E> method, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements from the specified ring
      static <E> E[] randomArray​(int degree, Ring<E> ring, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements from the specified ring
      static BigInteger[] randomBigArray​(int degree, BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
      static long[] randomLongArray​(int degree, long bound, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
      static UnivariatePolynomialZp64 randomMonicPoly​(int degree, long modulus, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree.
      static UnivariatePolynomial<BigInteger> randomMonicPoly​(int degree, BigInteger modulus, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree.
      static <E> UnivariatePolynomial<E> randomMonicPoly​(int degree, Ring<E> ring, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree.
      static UnivariatePolynomialZ64 randomPoly​(int degree, long bound, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree with elements bounded by bound (by absolute value).
      static UnivariatePolynomial<BigInteger> randomPoly​(int degree, BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree with elements bounded by bound (by absolute value).
      static <E> UnivariatePolynomial<E> randomPoly​(int degree, Ring<E> ring, Function<org.apache.commons.math3.random.RandomGenerator,​E> method, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree with elements from specified ring
      static <E> UnivariatePolynomial<E> randomPoly​(int degree, Ring<E> ring, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree with elements from specified ring
      static UnivariatePolynomialZ64 randomPoly​(int degree, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree.
      static <Poly extends IUnivariatePolynomial<Poly>>
      Poly
      randomPoly​(Poly factory, int degree, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random polynomial of specified degree.
    • Method Detail

      • randomPoly

        public static <Poly extends IUnivariatePolynomial<Poly>> Poly randomPoly​(Poly factory,
                                                                                 int degree,
                                                                                 org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree.
        Parameters:
        factory - the factory (used to infer the type and the ring)
        degree - polynomial degree
        rnd - random source
        Returns:
        random polynomial of specified degree
      • randomPoly

        public static UnivariatePolynomialZ64 randomPoly​(int degree,
                                                         org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree.
        Parameters:
        degree - polynomial degree
        rnd - random source
        Returns:
        random polynomial of specified degree
      • randomMonicPoly

        public static UnivariatePolynomialZp64 randomMonicPoly​(int degree,
                                                               long modulus,
                                                               org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree.
        Parameters:
        degree - polynomial degree
        rnd - random source
        Returns:
        random polynomial of specified degree
      • randomMonicPoly

        public static UnivariatePolynomial<BigInteger> randomMonicPoly​(int degree,
                                                                       BigInteger modulus,
                                                                       org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree.
        Parameters:
        degree - polynomial degree
        rnd - random source
        Returns:
        random polynomial of specified degree
      • randomMonicPoly

        public static <E> UnivariatePolynomial<E> randomMonicPoly​(int degree,
                                                                  Ring<E> ring,
                                                                  org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree.
        Parameters:
        degree - polynomial degree
        ring - the ring
        rnd - random source
        Returns:
        random polynomial of specified degree
      • randomPoly

        public static UnivariatePolynomialZ64 randomPoly​(int degree,
                                                         long bound,
                                                         org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree with elements bounded by bound (by absolute value).
        Parameters:
        degree - polynomial degree
        bound - absolute bound for coefficients
        rnd - random source
        Returns:
        random polynomial of specified degree with elements bounded by bound (by absolute value)
      • randomPoly

        public static UnivariatePolynomial<BigInteger> randomPoly​(int degree,
                                                                  BigInteger bound,
                                                                  org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree with elements bounded by bound (by absolute value).
        Parameters:
        degree - polynomial degree
        bound - absolute bound for coefficients
        rnd - random source
        Returns:
        random polynomial of specified degree with elements bounded by bound (by absolute value)
      • randomPoly

        public static <E> UnivariatePolynomial<E> randomPoly​(int degree,
                                                             Ring<E> ring,
                                                             org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree with elements from specified ring
        Parameters:
        degree - polynomial degree
        ring - the ring
        rnd - random source
        Returns:
        random polynomial of specified degree with elements bounded by bound (by absolute value)
      • randomPoly

        public static <E> UnivariatePolynomial<E> randomPoly​(int degree,
                                                             Ring<E> ring,
                                                             Function<org.apache.commons.math3.random.RandomGenerator,​E> method,
                                                             org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random polynomial of specified degree with elements from specified ring
        Parameters:
        degree - polynomial degree
        ring - the ring
        method - method for generating random coefficients
        rnd - random source
        Returns:
        random polynomial of specified degree with elements bounded by bound (by absolute value)
      • randomLongArray

        public static long[] randomLongArray​(int degree,
                                             long bound,
                                             org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
        Parameters:
        degree - polynomial degree
        bound - absolute bound for coefficients
        rnd - random source
        Returns:
        array of length degree + 1 with elements bounded by bound (by absolute value)
      • randomBigArray

        public static BigInteger[] randomBigArray​(int degree,
                                                  BigInteger bound,
                                                  org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
        Parameters:
        degree - polynomial degree
        bound - absolute bound for coefficients
        rnd - random source
        Returns:
        array of length degree + 1 with elements bounded by bound (by absolute value)
      • randomArray

        public static <E> E[] randomArray​(int degree,
                                          Ring<E> ring,
                                          org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random array of length degree + 1 with elements from the specified ring
        Parameters:
        degree - polynomial degree
        ring - the ring
        rnd - random source
        Returns:
        array of length degree + 1 with elements from specified ring
      • randomArray

        public static <E> E[] randomArray​(int degree,
                                          Ring<E> ring,
                                          Function<org.apache.commons.math3.random.RandomGenerator,​E> method,
                                          org.apache.commons.math3.random.RandomGenerator rnd)
        Creates random array of length degree + 1 with elements from the specified ring
        Parameters:
        degree - polynomial degree
        ring - the ring
        method - method for generating random coefficients
        rnd - random source
        Returns:
        array of length degree + 1 with elements from specified ring