@Test public void testForwardTransform() { BigInteger[] actual = BigNumberTheoreticTransform.transform( bigintArray(6, 0, 10, 7, 2), bi(3), bi(11)); BigInteger[] expect = bigintArray(3, 7, 0, 5, 4); assertArrayEquals(expect, actual); }
public static BigInteger[] transform(BigInteger[] invec, BigInteger root, BigInteger mod) { int n = invec.length; BigInteger[] outvec = new BigInteger[n]; for (int i = 0; i < n; i++) { BigInteger sum = BigInteger.ZERO; for (int j = 0; j < n; j++) { BigInteger k = BigInteger.valueOf((long)i * j % n); sum = invec[j].multiply(root.modPow(k, mod)).add(sum).mod(mod); } outvec[i] = sum; } return outvec; }
BigNumberTheoreticTransform { public static BigInteger[] transform(BigInteger[] invec, BigInteger root, BigInteger mod) { int n = invec.length; BigInteger[] outvec = new BigInteger[n]; for (int i = 0; i < n; i++) { BigInteger sum = BigInteger.ZERO; for (int j = 0; j < n; j++) { BigInteger k = BigInteger.valueOf((long)i * j % n); sum = invec[j].multiply(root.modPow(k, mod)).add(sum).mod(mod); } outvec[i] = sum; } return outvec; } }
BigNumberTheoreticTransform { public static BigInteger[] transform(BigInteger[] invec, BigInteger root, BigInteger mod) { int n = invec.length; BigInteger[] outvec = new BigInteger[n]; for (int i = 0; i < n; i++) { BigInteger sum = BigInteger.ZERO; for (int j = 0; j < n; j++) { BigInteger k = BigInteger.valueOf((long)i * j % n); sum = invec[j].multiply(root.modPow(k, mod)).add(sum).mod(mod); } outvec[i] = sum; } return outvec; }  }
BigNumberTheoreticTransform { public static BigInteger[] transform(BigInteger[] invec, BigInteger root, BigInteger mod) { int n = invec.length; BigInteger[] outvec = new BigInteger[n]; for (int i = 0; i < n; i++) { BigInteger sum = BigInteger.ZERO; for (int j = 0; j < n; j++) { BigInteger k = BigInteger.valueOf((long)i * j % n); sum = invec[j].multiply(root.modPow(k, mod)).add(sum).mod(mod); } outvec[i] = sum; } return outvec; }  static BigInteger[] transform(BigInteger[] invec, BigInteger root, BigInteger mod); static BigInteger[] inverseTransform(BigInteger[] invec, BigInteger root, BigInteger mod); static void transformRadix2(BigInteger[] vector, BigInteger root, BigInteger mod); static BigInteger[] circularConvolve(BigInteger[] vec0, BigInteger[] vec1); static BigInteger findModulus(int vecLen, BigInteger minimum); static BigInteger findGenerator(BigInteger totient, BigInteger mod); static BigInteger findPrimitiveRoot(BigInteger degree, BigInteger totient, BigInteger mod); static boolean isGenerator(BigInteger val, BigInteger totient, BigInteger mod); static boolean isPrimitiveRoot(BigInteger val, BigInteger degree, BigInteger mod); static List<BigInteger> uniquePrimeFactors(BigInteger n); static boolean isPrime(BigInteger n); static BigInteger sqrt(BigInteger x); }
BigNumberTheoreticTransform { public static BigInteger[] transform(BigInteger[] invec, BigInteger root, BigInteger mod) { int n = invec.length; BigInteger[] outvec = new BigInteger[n]; for (int i = 0; i < n; i++) { BigInteger sum = BigInteger.ZERO; for (int j = 0; j < n; j++) { BigInteger k = BigInteger.valueOf((long)i * j % n); sum = invec[j].multiply(root.modPow(k, mod)).add(sum).mod(mod); } outvec[i] = sum; } return outvec; }  static BigInteger[] transform(BigInteger[] invec, BigInteger root, BigInteger mod); static BigInteger[] inverseTransform(BigInteger[] invec, BigInteger root, BigInteger mod); static void transformRadix2(BigInteger[] vector, BigInteger root, BigInteger mod); static BigInteger[] circularConvolve(BigInteger[] vec0, BigInteger[] vec1); static BigInteger findModulus(int vecLen, BigInteger minimum); static BigInteger findGenerator(BigInteger totient, BigInteger mod); static BigInteger findPrimitiveRoot(BigInteger degree, BigInteger totient, BigInteger mod); static boolean isGenerator(BigInteger val, BigInteger totient, BigInteger mod); static boolean isPrimitiveRoot(BigInteger val, BigInteger degree, BigInteger mod); static List<BigInteger> uniquePrimeFactors(BigInteger n); static boolean isPrime(BigInteger n); static BigInteger sqrt(BigInteger x);  }