#include "matrixconstructiondefault.h" #include "../matrix/invert.h" #include "../matrix/rank.h" #include "../yal/logger.h" using namespace sympol; using namespace yal; static LoggerPtr logger(Logger::getLogger("SymMatrixD")); bool MatrixConstructionDefault::construct(const Polyhedron& poly) { YALLOG_DEBUG(logger, "matrix construction with default"); const ulong matrixRank = poly.dimension() - 1; const ulong matrixRows = poly.rows(); typedef matrix::Matrix QMatrix; // compute column defect of inequality matrix QMatrix* Acopy = new QMatrix(poly.rows(), matrixRank); {ulong j=0; BOOST_FOREACH(const QArray& row, poly.rowPair()) { for (ulong i=0; iat(j,i).get_mpq_t(), row[i+1]); } ++j; }} matrix::Rank r(Acopy); // freeColumns will contain the column indices we may skip to get a full dimensional polyhedron std::set freeColumns; r.columnDefect(std::inserter(freeColumns, freeColumns.end())); delete Acopy; typedef std::map WeightMap; WeightMap weights; mpq_t temp; mpq_init(temp); // // calculate vertex weights // QMatrix Q(matrixRank - freeColumns.size()); ulong iQ = 0, jQ = 0; for (ulong i=0; i