Package cc.redberry.rings.poly.univar
Class RandomUnivariatePolynomials
- java.lang.Object
-
- cc.redberry.rings.poly.univar.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 lengthdegree + 1
with elements from the specified ringstatic <E> E[]
randomArray(int degree, Ring<E> ring, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random array of lengthdegree + 1
with elements from the specified ringstatic BigInteger[]
randomBigArray(int degree, BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random array of lengthdegree + 1
with elements bounded bybound
(by absolute value).static long[]
randomLongArray(int degree, long bound, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random array of lengthdegree + 1
with elements bounded bybound
(by absolute value).static UnivariatePolynomialZp64
randomMonicPoly(int degree, long modulus, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
.static UnivariatePolynomial<BigInteger>
randomMonicPoly(int degree, BigInteger modulus, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
.static <E> UnivariatePolynomial<E>
randomMonicPoly(int degree, Ring<E> ring, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
.static UnivariatePolynomialZ64
randomPoly(int degree, long bound, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
with elements bounded bybound
(by absolute value).static UnivariatePolynomial<BigInteger>
randomPoly(int degree, BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
with elements bounded bybound
(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 specifieddegree
with elements from specified ringstatic <E> UnivariatePolynomial<E>
randomPoly(int degree, Ring<E> ring, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
with elements from specified ringstatic UnivariatePolynomialZ64
randomPoly(int degree, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
.static <Poly extends IUnivariatePolynomial<Poly>>
PolyrandomPoly(Poly factory, int degree, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
.
-
-
-
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 specifieddegree
.- Parameters:
factory
- the factory (used to infer the type and the ring)degree
- polynomial degreernd
- 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 specifieddegree
.- Parameters:
degree
- polynomial degreernd
- 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 specifieddegree
.- Parameters:
degree
- polynomial degreernd
- 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 specifieddegree
.- Parameters:
degree
- polynomial degreernd
- 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 specifieddegree
.- Parameters:
degree
- polynomial degreering
- the ringrnd
- 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 specifieddegree
with elements bounded bybound
(by absolute value).- Parameters:
degree
- polynomial degreebound
- absolute bound for coefficientsrnd
- random source- Returns:
- random polynomial of specified
degree
with elements bounded bybound
(by absolute value)
-
randomPoly
public static UnivariatePolynomial<BigInteger> randomPoly(int degree, BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random polynomial of specifieddegree
with elements bounded bybound
(by absolute value).- Parameters:
degree
- polynomial degreebound
- absolute bound for coefficientsrnd
- random source- Returns:
- random polynomial of specified
degree
with elements bounded bybound
(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 specifieddegree
with elements from specified ring- Parameters:
degree
- polynomial degreering
- the ringrnd
- random source- Returns:
- random polynomial of specified
degree
with elements bounded bybound
(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 specifieddegree
with elements from specified ring- Parameters:
degree
- polynomial degreering
- the ringmethod
- method for generating random coefficientsrnd
- random source- Returns:
- random polynomial of specified
degree
with elements bounded bybound
(by absolute value)
-
randomLongArray
public static long[] randomLongArray(int degree, long bound, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random array of lengthdegree + 1
with elements bounded bybound
(by absolute value).- Parameters:
degree
- polynomial degreebound
- absolute bound for coefficientsrnd
- random source- Returns:
- array of length
degree + 1
with elements bounded bybound
(by absolute value)
-
randomBigArray
public static BigInteger[] randomBigArray(int degree, BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
Creates random array of lengthdegree + 1
with elements bounded bybound
(by absolute value).- Parameters:
degree
- polynomial degreebound
- absolute bound for coefficientsrnd
- random source- Returns:
- array of length
degree + 1
with elements bounded bybound
(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 lengthdegree + 1
with elements from the specified ring- Parameters:
degree
- polynomial degreering
- the ringrnd
- 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 lengthdegree + 1
with elements from the specified ring- Parameters:
degree
- polynomial degreering
- the ringmethod
- method for generating random coefficientsrnd
- random source- Returns:
- array of length
degree + 1
with elements from specified ring
-
-