Exemple #1
0
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);
}