void runTests9 (int argc, char* argv[]) { ExpressionListPtr pRowPermutations = Util::quickPerm(5); ExpressionListPtr pColPermutations = Util::quickPerm(2); ExpressionListPtr pVarPermutations = Util::quickPerm(1); ilog("row permutations"); pRowPermutations->print(); ilog("col permutations"); pColPermutations->print(); ilog("outcome permutations"); pVarPermutations->print(); ilog("---- p: ----"); ExpressionPtr p = new Expression; p->set(0, 0, 0, 1); p->set(0, 1, 0, 1); p->set(1, 0, 0, 1); p->set(1, 1, 0, -1); p->set(2, 0, 0, 0); p->set(2, 1, 0, 0); p->set(3, 0, 0, -1); p->set(3, 1, 0, 1); p->set(4, 0, 0, -1); p->set(4, 1, 0, -1); p->printMatrix(); //-1 -1 1 1 -1 1 1 -1 0 0 ExpressionPtr p2 = new Expression; p2->set(0, 0, 0, -1); p2->set(0, 1, 0, 1); p2->set(1, 0, 0, 1); p2->set(1, 1, 0, 1); p2->set(2, 0, 0, -1); p2->set(2, 1, 0, 1); p2->set(3, 0, 0, 1); p2->set(3, 1, 0, -1); p2->set(4, 0, 0, 0); p2->set(4, 1, 0, 0); ilog("---- p2: ----"); p2->printMatrix(); p2->isBetter(p); ExpressionPtr pExp = p->findSpecialEquivalent(pRowPermutations, pColPermutations, pVarPermutations); ilog("---- result: ----"); pExp->printMatrix(); ilog("--------"); }
void runTests8 (int argc, char* argv[]) { ilog("2 -------------"); ExpressionListPtr pL0 = Util::quickPerm(2); pL0->print(); ilog("3 -------------"); ExpressionListPtr pL = Util::quickPerm(3); pL->print(); ilog("4 -------------"); ExpressionListPtr pL1 = Util::quickPerm(4); pL1->print(); ilog("5 -------------"); ExpressionListPtr pL2 = Util::quickPerm(5); pL2->print(); }
int main (int argc, char* argv[]) { N32 preparations, measurements, dimensions, outcomes; N32 rowsPerPage = 5; N32 matricesPerRow = 2; N32 useLRS = false; Util::readIntParam("db/useLRS", useLRS); if (!Util::readIntParam("db/preparations", preparations)) { Util::errorMsg("preparations parameter file not found"); exit(EXIT_FAILURE); } if (!Util::readIntParam("db/measurements", measurements)) { Util::errorMsg(" measurements file not found"); exit(EXIT_FAILURE); } if(!Util::readIntParam("db/dimensions", dimensions)) { Util::errorMsg("dimensions parameter file not found"); exit(EXIT_FAILURE); } if(!Util::readIntParam("db/outcomes", outcomes)) { Util::errorMsg("oucomes parameter file not found"); exit(EXIT_FAILURE); } Util::readIntParam("rowsPerPage", rowsPerPage); Util::readIntParam("matricesPerRow", matricesPerRow); strcpy(Util::s_folderName, "."); printf("\nFiltering the inequations in porta.poi.ieq with P = %d M = %d D = %d O = %d", preparations, measurements, dimensions, outcomes); try { ExpressionListPtr pList = new ExpressionList; if(useLRS) { parseLRS(pList, preparations, measurements); ilog("\n------------- parsing porta ieq file ----------------------------------------------------------------------------------\n"); } else { parsePorta(pList, preparations, measurements); ilog("\n------------- parsing lrs.hf -----------------------------------------------------------------------------------------\n"); } ilog("\n------------- original expresssions ----------------------------------------------------------------------------------\n"); pList->print(); ilog("\n------------- starting compacting symmetries--------------------------------------------------------------------------\n"); ExpressionListPtr pRowPermutations = Util::quickPerm(preparations); ExpressionListPtr pColPermutations = Util::quickPerm(measurements); ilog("row permutations"); pRowPermutations->print(); ilog("col permutations"); pColPermutations->print(); ExpressionListPtr pCompactedPM = pList->compactSymmetricSlow(pRowPermutations, pColPermutations); ilog("\n------------- compacted symmetries -----------------------------------------------------------------------------------\n"); pCompactedPM->print(); // void printTeX(const char* pName, N32 preparations, N32 measurements, N32 dimensions, N32 outcomes, N32 rowsPerPage, N32 matricesPerRow); pCompactedPM->printTeX("witnesses.tex", preparations, measurements, dimensions, outcomes, rowsPerPage, matricesPerRow); ilog(""); ilog(""); } catch (Exception e) { XK(false); } printf("\n-----------------------------------------------------------------------------"); printf("\n Results and intermediate files are in the folder: %s", Util::getFolderName()); printf("\n-----------------------------------------------------------------------------"); printf("\n\n"); exit(EXIT_SUCCESS); }
void runTests10 (int argc, char* argv[]) { ExpressionListPtr pL = Util::genRotations(5); ilog("rotations"); pL->print(); }