public static PolyBase bigGenLength(PolyBase a) { PolyBase oldGen = new PolyBase(generator.toString()); Integer dif = a.decomposition.size() - oldGen.decomposition.size(); for (int i = 0; i < dif; i++) { oldGen.decomposition.add(0); } return oldGen; }
public static PolyBase gornerMeth2(PolyBase a, int b, Integer fl) { PolyBase temp = new PolyBase(a.toString()); PolyBase result = one(fl); String pow = Integer.toBinaryString(b); for (int i = 0; i < pow.length(); i++) { result = square(result); if (pow.charAt(i) == '1') { result = multiplication(result, temp); } } return result; }
public static ArrayList<PolyBase> getFuncRes(ArrayList<PolyBase> elts, String fc) { ArrayList<PolyBase> result = new ArrayList<>(); int o = 0; int all = (int) Math.pow(2, fl); if (fc.equals("rev")) { for (PolyBase i : elts) { System.out.println("Element " + i + " started"); i.getBigger(); PolyBase t = revElem(i, fl); t.getBigger(); result.add(t); System.out.println("Element " + t + " added"); o++; System.out.println((all - o) + " elements to go"); } } if (fc.equals("sec")) { for (PolyBase i : elts) { i.getBigger(); PolyBase t = new PolyBase(i.toString()); t = gornerMeth2(t, (int) Math.pow(2, fl) - 3, fl); t.getBigger(); result.add(t); } } if (fc.equals("15")) { for (PolyBase i : elts) { i.getBigger(); PolyBase t = new PolyBase(i.toString()); t = gornerMeth2(t, 131, fl); t.getBigger(); result.add(t); } } return result; }