Loading...
Searching...
No Matches
polymake_conversion.cc File Reference
`#include "kernel/mod2.h"`
`#include <gmpxx.h>`
`#include <polymake/Main.h>`
`#include <polymake/Matrix.h>`
`#include <polymake/Rational.h>`
`#include <polymake/Integer.h>`
`#include <polymake/Set.h>`
`#include <polymake/common/lattice_tools.h>`
`#include <polymake/IncidenceMatrix.h>`
`#include "gfanlib/gfanlib.h"`
`#include "gfanlib/gfanlib_q.h"`
`#include "misc/intvec.h"`
`#include "coeffs/numbers.h"`
`#include "coeffs/bigintmat.h"`
`#include "Singular/lists.h"`
`#include "Singular/ipid.h"`

Go to the source code of this file.

## Macros

#define | POLYMAKE_VERSION POLYMAKEVERSION

## Functions

polymake::Integer | GfInteger2PmInteger (const gfan::Integer &gi)
polymake::Rational | GfRational2PmRational (const gfan::Rational &gr)
polymake::Vector< polymake::Integer > | Intvec2PmVectorInteger (const intvec *iv)
polymake::Matrix< polymake::Integer > | GfZMatrix2PmMatrixInteger (const gfan::ZMatrix *zm)
polymake::Matrix< polymake::Rational > | GfQMatrix2PmMatrixRational (const gfan::QMatrix *qm)
gfan::Integer | PmInteger2GfInteger (const polymake::Integer &pi)
gfan::Rational | PmRational2GfRational (const polymake::Rational &pr)
gfan::ZMatrix | PmMatrixInteger2GfZMatrix (const polymake::Matrix< polymake::Integer > *mi)
gfan::QMatrix | PmMatrixRational2GfQMatrix (const polymake::Matrix< polymake::Rational > *mr)
int | PmInteger2Int (const polymake::Integer &pi, bool &ok)
number | PmInteger2Number (const polymake::Integer &pi)
intvec * | PmVectorInteger2Intvec (const polymake::Vector< polymake::Integer > *vi, bool &ok)
intvec * | PmMatrixInteger2Intvec (polymake::Matrix< polymake::Integer > *mi, bool &ok)
bigintmat * | PmMatrixInteger2Bigintmat (polymake::Matrix< polymake::Integer > *mi)
lists | PmIncidenceMatrix2ListOfIntvecs (polymake::IncidenceMatrix< polymake::NonSymmetric > *icmat)
lists | PmAdjacencyMatrix2ListOfEdges (polymake::IncidenceMatrix< polymake::NonSymmetric > *icmat)
intvec * | PmSetInteger2Intvec (polymake::Set< polymake::Integer > *si, bool &b)
polymake::Matrix< polymake::Integer > | Intvec2PmMatrixInteger (const intvec *im)
gfan::ZCone * | PmCone2ZCone (polymake::perl::Object *pc)
gfan::ZCone * | PmPolytope2ZPolytope (polymake::perl::Object *pp)
gfan::ZFan * | PmFan2ZFan (polymake::perl::Object *pf)
polymake::perl::Object * | ZCone2PmCone (gfan::ZCone *zc)
polymake::perl::Object * | ZPolytope2PmPolytope (gfan::ZCone *zc)
polymake::Matrix< polymake::Integer > | raysOf (gfan::ZFan *zf)
int | numberOfRaysOf (gfan::ZFan *zf)
int | numberOfMaximalConesOf (gfan::ZFan *zf)
polymake::Array< polymake::Set< int > > | conesOf (gfan::ZFan *zf)
polymake::perl::Object * | ZFan2PmFan (gfan::ZFan *zf)

## Macro Definition Documentation

## POLYMAKE_VERSION

#define POLYMAKE_VERSION POLYMAKEVERSION

Definition at line 5 of file polymake_conversion.cc.

## Function Documentation

## conesOf()

polymake::Array< polymake::Set< int > > conesOf | ( | gfan::ZFan * | zf | ) |

Definition at line 505 of file polymake_conversion.cc.

{
int r = numberOfMaximalConesOf(zf);
polymake::Matrix<polymake::Integer> pm=raysOf(zf);
polymake::Array<polymake::Set<int> > L(r);
int ii = 0;
for (int d=1; d<=zf->getAmbientDimension(); d++)
{
for (int i=0; i<zf->numberOfConesOfDimension(d,0,1); i++)
{
gfan::IntVector v = zf->getConeIndices(d,i,0,1);
polymake::Set<int> s;
for (int j=0; j<(int)v.size(); j++)
{
s = s+v[j];
}
L[ii] = s;
ii = ii + 1;
}
}
return L;
}
i
int i
Definition cfEzgcd.cc:132
s
const CanonicalForm int s
Definition facAbsFact.cc:51
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
j
int j
Definition facHensel.cc:110
raysOf
polymake::Matrix< polymake::Integer > raysOf(gfan::ZFan *zf)
Definition polymake_conversion.cc:467
numberOfMaximalConesOf
int numberOfMaximalConesOf(gfan::ZFan *zf)
Definition polymake_conversion.cc:492

## GfInteger2PmInteger()

polymake::Integer GfInteger2PmInteger | ( | const gfan::Integer & | gi | ) |

Definition at line 33 of file polymake_conversion.cc.

{
mpz_t cache; mpz_init(cache);
gi.setGmp(cache);
polymake::Integer pi(cache);
return pi;
}
pi
#define pi
Definition libparse.cc:1145

## GfQMatrix2PmMatrixRational()

polymake::Matrix< polymake::Rational > GfQMatrix2PmMatrixRational | ( | const gfan::QMatrix * | qm | ) |

Definition at line 70 of file polymake_conversion.cc.

{
int rows=qm->getHeight();
int cols=qm->getWidth();
polymake::Matrix<polymake::Rational> mr(rows,cols);
for(int r=1; r<=rows; r++)
for(int c=1; c<=cols; c++)
mr(r-1,c-1) = GfRational2PmRational((*qm)[r-1][c-1]);
return mr;
}
GfRational2PmRational
polymake::Rational GfRational2PmRational(const gfan::Rational &gr)
Definition polymake_conversion.cc:41

## GfRational2PmRational()

polymake::Rational GfRational2PmRational | ( | const gfan::Rational & | gr | ) |

Definition at line 41 of file polymake_conversion.cc.

{
mpq_t cache; mpq_init(cache);
gr.setGmp(cache);
polymake::Rational pr(cache);
return pr;
}

## GfZMatrix2PmMatrixInteger()

polymake::Matrix< polymake::Integer > GfZMatrix2PmMatrixInteger | ( | const gfan::ZMatrix * | zm | ) |

Definition at line 59 of file polymake_conversion.cc.

{
int rows=zm->getHeight();
int cols=zm->getWidth();
polymake::Matrix<polymake::Integer> mi(rows,cols);
for(int r=1; r<=rows; r++)
for(int c=1; c<=cols; c++)
mi(r-1,c-1) = GfInteger2PmInteger((*zm)[r-1][c-1]);
return mi;
}
GfInteger2PmInteger
polymake::Integer GfInteger2PmInteger(const gfan::Integer &gi)
Definition polymake_conversion.cc:33

## Intvec2PmMatrixInteger()

polymake::Matrix< polymake::Integer > Intvec2PmMatrixInteger | ( | const intvec * | im | ) |

Definition at line 272 of file polymake_conversion.cc.

{
int rows=im->rows();
int cols=im->cols();
polymake::Matrix<polymake::Integer> mi(rows,cols);
for(int r=0; r<rows; r++)
for(int c=0; c<cols; c++)
mi(r,c) = polymake::Integer(IMATELEM(*im, r+1, c+1));
return mi;
}
intvec::cols
int cols() const
Definition intvec.h:96
intvec::rows
int rows() const
Definition intvec.h:97
IMATELEM
#define IMATELEM(M, I, J)
Definition intvec.h:86

## Intvec2PmVectorInteger()

polymake::Vector< polymake::Integer > Intvec2PmVectorInteger | ( | const intvec * | iv | ) |

Definition at line 49 of file polymake_conversion.cc.

{
polymake::Vector<polymake::Integer> vi(iv->length());
for(int i=1; i<=iv->length(); i++)
{
vi[i-1]=(*iv)[i-1];
}
return vi;
}
intvec::length
int length() const
Definition intvec.h:95

## numberOfMaximalConesOf()

int numberOfMaximalConesOf | ( | gfan::ZFan * | zf | ) |

Definition at line 492 of file polymake_conversion.cc.

{
int d = zf->getAmbientDimension();
int n = 0;
for (int i=0; i<=d; i++)
{
n = n + zf->numberOfConesOfDimension(i,0,1);
}
return n;
}

## numberOfRaysOf()

int numberOfRaysOf | ( | gfan::ZFan * | zf | ) |

Definition at line 486 of file polymake_conversion.cc.

{
int n = zf->numberOfConesOfDimension(1,0,0);
return n;
}

## PmAdjacencyMatrix2ListOfEdges()

lists PmAdjacencyMatrix2ListOfEdges | ( | polymake::IncidenceMatrix< polymake::NonSymmetric > * | icmat | ) |

Definition at line 226 of file polymake_conversion.cc.

{
int rows = icmat->rows();
int cols = icmat->cols();
// counting number of edges
int i=0; int r, c;
for (r=0; r<rows; r++)
{
for (c=0; c<cols; c++)
{
if ((*icmat).row(r).exists(c) && r<c)
i++;
}
}
lists L = (lists)omAllocBin(slists_bin);
L->Init(i);
i=0;
for (r=0; r<rows; r++)
{
for (c=0; c<cols; c++)
{
if ((*icmat).row(r).exists(c) && r<c)
{
intvec* iv = new intvec(2);
(*iv)[0]=r; (*iv)[1]=c;
L->m[i].rtyp = INTVEC_CMD;
L->m[i].data = (void*) iv;
i++;
}
}
}
return L;
}
intvec
Definition intvec.h:24
sleftv::rtyp
int rtyp
Definition subexpr.h:91
sleftv::data
void * data
Definition subexpr.h:88
slists::m
sleftv * m
Definition lists.h:46
slists::Init
INLINE_THIS void Init(int l=0)
slists_bin
VAR omBin slists_bin
Definition lists.cc:23
lists
slists * lists
Definition mpr_numeric.h:146
omAllocBin
#define omAllocBin(bin)
Definition omAllocDecl.h:205
INTVEC_CMD
@ INTVEC_CMD
Definition tok.h:101

## PmCone2ZCone()

gfan::ZCone * PmCone2ZCone | ( | polymake::perl::Object * | pc | ) |

Definition at line 286 of file polymake_conversion.cc.

{
if (pc->isa("Cone"))
{
polymake::Integer ambientdim1 = pc->give("CONE_AMBIENT_DIM");
bool ok=true; int ambientdim2 = PmInteger2Int(ambientdim1, ok);
if (!ok)
{
WerrorS("PmCone2ZCone: overflow while converting polymake::Integer to int");
}
polymake::Matrix<polymake::Rational> ineqrational = pc->give("FACETS");
polymake::Matrix<polymake::Rational> eqrational = pc->give("LINEAR_SPAN");
// polymake::Matrix<polymake::Rational> exraysrational = pc->give("RAYS");
// polymake::Matrix<polymake::Rational> linrational = pc->give("LINEALITY_SPACE");
gfan::ZMatrix zv, zw, zx, zy, zz;
// the following branching statements are to cover cases in which polymake returns empty matrices
// by convention, gfanlib ignores empty matrices, hence zero matrices of right dimensions have to be supplied
if (ineqrational.cols()!=0)
{
polymake::Matrix<polymake::Integer> ineqinteger = polymake::common::primitive(ineqrational);
zv = PmMatrixInteger2GfZMatrix(&ineqinteger);
}
else
zv = gfan::ZMatrix(0, ambientdim2);
if (eqrational.cols()!=0)
{
polymake::Matrix<polymake::Integer> eqinteger = polymake::common::primitive(eqrational);
zw = PmMatrixInteger2GfZMatrix(&eqinteger);
}
else
zw = gfan::ZMatrix(0, ambientdim2);
// if (exraysrational.cols()!=0)
// {
// polymake::Matrix<polymake::Integer> exraysinteger = polymake::common::primitive(exraysrational);
// zx = PmMatrixInteger2GfZMatrix(&exraysinteger);
// }
// else
// zx = gfan::ZMatrix(0, ambientdim2);
// if (linrational.cols()!=0)
// {
// polymake::Matrix<polymake::Integer> lininteger = polymake::common::primitive(linrational);
// zy = PmMatrixInteger2GfZMatrix(&lininteger);
// }
// else
// zy = gfan::ZMatrix(0, ambientdim2);
// gfan::ZCone* zc = new gfan::ZCone(zv,zw,zx,zy,zz,3);
gfan::ZCone* zc = new gfan::ZCone(zv,zw,3);
return zc;
}
WerrorS("PmCone2ZCone: unexpected parameters");
return NULL;
}
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
NULL
#define NULL
Definition omList.c:12
PmInteger2Int
int PmInteger2Int(const polymake::Integer &pi, bool &ok)
Definition polymake_conversion.cc:121
PmMatrixInteger2GfZMatrix
gfan::ZMatrix PmMatrixInteger2GfZMatrix(const polymake::Matrix< polymake::Integer > *mi)
Definition polymake_conversion.cc:97

## PmFan2ZFan()

gfan::ZFan * PmFan2ZFan | ( | polymake::perl::Object * | pf | ) |

Definition at line 399 of file polymake_conversion.cc.

{
if (pf->isa("PolyhedralFan"))
{
int d = (int) pf->give("FAN_AMBIENT_DIM");
gfan::ZFan* zf = new gfan::ZFan(d);
int n = pf->give("N_MAXIMAL_CONES");
for (int i=0; i<n; i++)
{
#if (POLYMAKE_VERSION >= 305)
polymake::perl::Object pmcone=pf->call_method("cone",i);
#else
polymake::perl::Object pmcone=pf->CallPolymakeMethod("cone",i);
#endif
gfan::ZCone* zc=PmCone2ZCone(&pmcone);
zf->insert(*zc);
}
return zf;
}
WerrorS("PmFan2ZFan: unexpected parameters");
return NULL;
}
PmCone2ZCone
gfan::ZCone * PmCone2ZCone(polymake::perl::Object *pc)
Definition polymake_conversion.cc:286

## PmIncidenceMatrix2ListOfIntvecs()

lists PmIncidenceMatrix2ListOfIntvecs | ( | polymake::IncidenceMatrix< polymake::NonSymmetric > * | icmat | ) |

Definition at line 203 of file polymake_conversion.cc.

{
int rows = icmat->rows();
int cols = icmat->cols();
lists L = (lists)omAllocBin(slists_bin);
L->Init(rows);
for (int r = 0; r < rows; r++)
{
intvec* iv = new intvec(cols); int i=0;
for (int c = 0; c < cols; c++)
{
if ((*icmat).row(r).exists(c))
{ (*iv)[i]=c; i++; }
}
iv->resize(i);
L->m[r].rtyp = INTVEC_CMD;
L->m[r].data = (void*) iv;
}
return L;
}
intvec::resize
void resize(int new_length)
Definition intvec.cc:106

## PmInteger2GfInteger()

gfan::Integer PmInteger2GfInteger | ( | const polymake::Integer & | pi | ) |

Definition at line 83 of file polymake_conversion.cc.

{
mpz_class cache(pi.get_rep());
gfan::Integer gi(cache.get_mpz_t());
return gi;
}

## PmInteger2Int()

int PmInteger2Int | ( | const polymake::Integer & | pi,
|  | bool & | ok )

Definition at line 121 of file polymake_conversion.cc.

{
int i=0;
try
{
#if POLYMAKE_VERSION >= 301 /* 3.1 */
i=int(pi);
#else
i = pi.to_int();
#endif
}
catch (const std::exception& ex)
{
WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
ok = false;
}
return i;
}

## PmInteger2Number()

number PmInteger2Number | ( | const polymake::Integer & | pi | ) |

Definition at line 140 of file polymake_conversion.cc.

{
mpz_class cache(pi.get_rep());
long m = 268435456;
if(mpz_cmp_si(cache.get_mpz_t(),m))
{
int temp = (int) mpz_get_si(cache.get_mpz_t());
return n_Init(temp,coeffs_BIGINT);
}
else
return n_InitMPZ(cache.get_mpz_t(),coeffs_BIGINT);
}
m
int m
Definition cfEzgcd.cc:128
n_InitMPZ
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
Definition coeffs.h:545
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
coeffs_BIGINT
VAR coeffs coeffs_BIGINT
Definition polys.cc:14

## PmMatrixInteger2Bigintmat()

bigintmat * PmMatrixInteger2Bigintmat | ( | polymake::Matrix< polymake::Integer > * | mi | ) |

Definition at line 182 of file polymake_conversion.cc.

{
int rows = mi->rows();
int cols = mi->cols();
bigintmat* bim= new bigintmat(rows,cols,coeffs_BIGINT);
#if POLYMAKE_VERSION >= 301 /*3.1*/
pm::array_traits<pm::Integer>::iterator pi = concat_rows(*mi).begin();
#else
const polymake::Integer* pi = concat_rows(*mi).begin();
#endif
for (int r = 1; r <= rows; r++)
for (int c = 1; c <= cols; c++)
{
number temp = PmInteger2Number(*pi);
bim->set(r,c,temp);
n_Delete(&temp,coeffs_BIGINT);
pi++;
}
return bim;
}
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
bigintmat::set
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition bigintmat.cc:93
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
PmInteger2Number
number PmInteger2Number(const polymake::Integer &pi)
Definition polymake_conversion.cc:140

## PmMatrixInteger2GfZMatrix()

gfan::ZMatrix PmMatrixInteger2GfZMatrix | ( | const polymake::Matrix< polymake::Integer > * | mi | ) |

Definition at line 97 of file polymake_conversion.cc.

{
int rows=mi->rows();
int cols=mi->cols();
gfan::ZMatrix zm(rows,cols);
for(int r=1; r<=rows; r++)
for(int c=1; c<=cols; c++)
zm[r-1][c-1] = PmInteger2GfInteger((*mi)(r-1,c-1));
return zm;
}
PmInteger2GfInteger
gfan::Integer PmInteger2GfInteger(const polymake::Integer &pi)
Definition polymake_conversion.cc:83

## PmMatrixInteger2Intvec()

intvec * PmMatrixInteger2Intvec | ( | polymake::Matrix< polymake::Integer > * | mi,
|  | bool & | ok )

Definition at line 163 of file polymake_conversion.cc.

{
int rows = mi->rows();
int cols = mi->cols();
intvec* iv = new intvec(rows,cols,0);
#if POLYMAKE_VERSION >= 301 /*3.1*/
pm::array_traits<pm::Integer>::iterator pi = concat_rows(*mi).begin();
#else
const polymake::Integer* pi = concat_rows(*mi).begin();
#endif
for (int r = 1; r <= rows; r++)
for (int c = 1; c <= cols; c++)
{
IMATELEM(*iv,r,c) = PmInteger2Int(*pi, ok);
pi++;
}
return iv;
}

## PmMatrixRational2GfQMatrix()

gfan::QMatrix PmMatrixRational2GfQMatrix | ( | const polymake::Matrix< polymake::Rational > * | mr | ) |

Definition at line 108 of file polymake_conversion.cc.

{
int rows=mr->rows();
int cols=mr->cols();
gfan::QMatrix qm(rows,cols);
for(int r=1; r<=rows; r++)
for(int c=1; c<=cols; c++)
qm[r-1][c-1] = PmRational2GfRational((*mr)(r-1,c-1));
return qm;
}
PmRational2GfRational
gfan::Rational PmRational2GfRational(const polymake::Rational &pr)
Definition polymake_conversion.cc:90

## PmPolytope2ZPolytope()

gfan::ZCone * PmPolytope2ZPolytope | ( | polymake::perl::Object * | pp | ) |

Definition at line 341 of file polymake_conversion.cc.

{
if (pp->isa("Polytope<Rational>"))
{
polymake::Integer ambientdim1 = pp->give("CONE_AMBIENT_DIM");
bool ok=true; int ambientdim2 = PmInteger2Int(ambientdim1, ok);
if (!ok)
{
WerrorS("overflow while converting polymake::Integer to int");
}
polymake::Matrix<polymake::Rational> ineqrational = pp->give("FACETS");
polymake::Matrix<polymake::Rational> eqrational = pp->give("AFFINE_HULL");
// polymake::Matrix<polymake::Rational> vertrational = pp->give("VERTICES");
// polymake::Matrix<polymake::Rational> linrational = pp->give("LINEALITY_SPACE");
gfan::ZMatrix zv, zw;
// the following branching statements are to cover the cases when polymake returns empty matrices
// by convention, gfanlib ignores empty matrices, hence zero matrices of right dimensions have to be supplied
if (ineqrational.cols()!=0)
{
polymake::Matrix<polymake::Integer> ineqinteger = polymake::common::primitive(ineqrational);
zv = PmMatrixInteger2GfZMatrix(&ineqinteger);
}
else
zv = gfan::ZMatrix(0, ambientdim2);
if (eqrational.cols()!=0)
{
polymake::Matrix<polymake::Integer> eqinteger = polymake::common::primitive(eqrational);
zw = PmMatrixInteger2GfZMatrix(&eqinteger);
}
else
zw = gfan::ZMatrix(0, ambientdim2);
// if (vertrational.cols()!=0)
// {
// polymake::Matrix<polymake::Integer> vertinteger = polymake::common::primitive(vertrational);
// zx = PmMatrixInteger2GfZMatrix(&vertinteger);
// }
// else
// zx = gfan::ZMatrix(0, ambientdim2);
// if (linrational.cols()!=0)
// {
// polymake::Matrix<polymake::Integer> lininteger = polymake::common::primitive(linrational);
// zy = PmMatrixInteger2GfZMatrix(&lininteger);
// }
// else
// zy = gfan::ZMatrix(0, ambientdim2);
// gfan::ZCone* zp = new gfan::ZCone(zv,zw,zx,zy,zz,3);
gfan::ZCone* zp = new gfan::ZCone(zv,zw,3);
return zp;
}
WerrorS("PmPolytope2ZPolytope: unexpected parameters");
return NULL;
}
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676

## PmRational2GfRational()

gfan::Rational PmRational2GfRational | ( | const polymake::Rational & | pr | ) |

Definition at line 90 of file polymake_conversion.cc.

{
mpq_class cache(pr.get_rep());
gfan::Rational gr(cache.get_mpq_t());
return gr;
}

## PmSetInteger2Intvec()

intvec * PmSetInteger2Intvec | ( | polymake::Set< polymake::Integer > * | si,
|  | bool & | b )

Definition at line 264 of file polymake_conversion.cc.

{
polymake::Vector<polymake::Integer> vi(*si);
return PmVectorInteger2Intvec(&vi,b);
}
b
CanonicalForm b
Definition cfModGcd.cc:4111
PmVectorInteger2Intvec
intvec * PmVectorInteger2Intvec(const polymake::Vector< polymake::Integer > *vi, bool &ok)
Definition polymake_conversion.cc:153

## PmVectorInteger2Intvec()

intvec * PmVectorInteger2Intvec | ( | const polymake::Vector< polymake::Integer > * | vi,
|  | bool & | ok )

Definition at line 153 of file polymake_conversion.cc.

{
intvec* iv = new intvec(vi->size());
for(int i=1; i<=vi->size(); i++)
{
(*iv)[i-1] = PmInteger2Int((*vi)[i-1],ok);
}
return iv;
}

## raysOf()

polymake::Matrix< polymake::Integer > raysOf | ( | gfan::ZFan * | zf | ) |

Definition at line 467 of file polymake_conversion.cc.

{
int d = zf->getAmbientDimension();
int n = zf->numberOfConesOfDimension(1,0,0);
gfan::ZMatrix zm(n,d);
for (int i=0; i<n; i++)
{
gfan::ZCone zc = zf->getCone(1,i,0,0);
gfan::ZMatrix ray = zc.extremeRays();
for (int j=0; j<d; j++)
{
zm[i][j]=ray[0][j];
}
}
return GfZMatrix2PmMatrixInteger(&zm);
}
GfZMatrix2PmMatrixInteger
polymake::Matrix< polymake::Integer > GfZMatrix2PmMatrixInteger(const gfan::ZMatrix *zm)
Definition polymake_conversion.cc:59

## ZCone2PmCone()

polymake::perl::Object * ZCone2PmCone | ( | gfan::ZCone * | zc | ) |

Definition at line 423 of file polymake_conversion.cc.

{
polymake::perl::Object* gc = new polymake::perl::Object("Cone<Rational>");
gfan::ZMatrix inequalities = zc->getInequalities();
gc->take("FACETS") << GfZMatrix2PmMatrixInteger(&inequalities);
gfan::ZMatrix equations = zc->getEquations();
gc->take("LINEAR_SPAN") << GfZMatrix2PmMatrixInteger(&equations);
// if(zc->areExtremeRaysKnown())
// {
// gfan::ZMatrix extremeRays = zc->extremeRays();
// gc->take("RAYS") << GfZMatrix2PmMatrixInteger(&extremeRays);
// }
// if(zc->areGeneratorsOfLinealitySpaceKnown())
// {
// gfan::ZMatrix lineality = zc->generatorsOfLinealitySpace();
// gc->take("LINEALITY_SPACE") << GfZMatrix2PmMatrixInteger(&lineality);
// }
return gc;
}
equations
BOOLEAN equations(leftv res, leftv args)
Definition bbcone.cc:577
inequalities
BOOLEAN inequalities(leftv res, leftv args)
Definition bbcone.cc:560

## ZFan2PmFan()

polymake::perl::Object * ZFan2PmFan | ( | gfan::ZFan * | zf | ) |

Definition at line 530 of file polymake_conversion.cc.

{
polymake::perl::Object* pf = new polymake::perl::Object("PolyhedralFan");
polymake::Matrix<polymake::Integer> zm = raysOf(zf);
pf->take("RAYS") << zm; // using rays here instead of INPUT_RAYS prevents redundant computations
polymake::Array<polymake::Set<int> > ar = conesOf(zf);
pf->take("MAXIMAL_CONES") << ar;
return pf;
}
conesOf
polymake::Array< polymake::Set< int > > conesOf(gfan::ZFan *zf)
Definition polymake_conversion.cc:505

## ZPolytope2PmPolytope()

polymake::perl::Object * ZPolytope2PmPolytope | ( | gfan::ZCone * | zc | ) |

Definition at line 448 of file polymake_conversion.cc.

{
polymake::perl::Object* pp = new polymake::perl::Object("Polytope<Rational>");
gfan::ZMatrix inequalities = zc->getInequalities();
pp->take("FACETS") << GfZMatrix2PmMatrixInteger(&inequalities);
gfan::ZMatrix equations = zc->getEquations();
pp->take("LINEAR_SPAN") << GfZMatrix2PmMatrixInteger(&equations);
// if(zc->areExtremeRaysKnown())
// {
// gfan::ZMatrix vertices = zc->extremeRays();
// pp->take("VERTICES") << GfZMatrix2PmMatrixInteger(&vertices);
// }
return pp;
}