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