// Product t = rp.next();
// ContractionsGraphDrawer.drawToPngFile(t, "/home/stas/Projects/Durty/", "Huge1");
DescriptiveStatistics timeStats = new DescriptiveStatistics();
DescriptiveStatistics trysStats = new DescriptiveStatistics();
int count = -1;
while (++count < 100) {
CC.resetTensorNames();
Product from = rp.next();
Product target = from.clone();
long start = System.nanoTime();
Tensor[] dataFrom = from.getContent().getDataCopy();
Tensor[] dataTarget = target.getContent().getDataCopy();
// if (count == 6)
// ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Huge6");
if (count == 24)
ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Huge24");
if (count == 30)
ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Huge30");
ProductsBijectionsPort port = new ProductsBijectionsPort(from.getContent(), target.getContent());
// List<int[]> bijections = new ArrayList<>();
int[] bijection;
boolean good = false;
int trys = 0;
OUTER:
while (trys++ < 5000 && (bijection = port.take()) != null)
// System.out.println(Arrays.toString(bijection));
// bijections.add(bijection.clone());
if (IndexMappings.createBijectiveProductPort(dataFrom, dataTo(dataTarget, bijection), false).take() != null) {
good = true;
System.out.println(count + " " + trys);
break;
}
// if (trys == 3169) {
// ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Worst");
// for (int[] b : bijections)
// System.out.println(Arrays.toString(b));
// }
double millis = 1E-6 * (System.nanoTime() - start);
timeStats.addValue(millis);
trysStats.addValue(trys);
if (!good)
throw new RuntimeException();
}
System.out.println(timeStats);