Loading...
Searching...
No Matches
callgfanlib_conversion.cc File Reference
`#include "gfanlib/gfanlib.h"`
`#include "coeffs/bigintmat.h"`
`#include "coeffs/longrat.h"`
`#include "coeffs/numbers.h"`
`#include "Singular/ipid.h"`

Go to the source code of this file.

## Functions

number | integerToNumber (const gfan::Integer &I)
bigintmat * | zVectorToBigintmat (const gfan::ZVector &zv)
bigintmat * | zMatrixToBigintmat (const gfan::ZMatrix &zm)
gfan::Integer * | numberToInteger (const number &n)
gfan::ZMatrix * | bigintmatToZMatrix (const bigintmat &bim)
gfan::ZVector * | bigintmatToZVector (const bigintmat &bim)
gfan::ZVector | intStar2ZVector (const int d, const int *i)
gfan::ZVector | expvToZVector (const int n, const int *expv)
gfan::ZVector | wvhdlEntryToZVector (const int n, const int *wvhdl0)
int * | ZVectorToIntStar (const gfan::ZVector &v, bool &overflow)
char * | toString (gfan::ZMatrix const &zm)
gfan::ZFan * | toFanStar (std::set< gfan::ZCone > setOfCones)
std::set< gfan::ZVector > | rays (std::set< gfan::ZCone > setOfCones)

## Function Documentation

## bigintmatToZMatrix()

gfan::ZMatrix * bigintmatToZMatrix | ( | const bigintmat & | bim | ) |

Definition at line 57 of file callgfanlib_conversion.cc.

{
int d=bim.rows();
int n=bim.cols();
gfan::ZMatrix* zm = new gfan::ZMatrix(d,n);
for(int i=0;i<d;i++)
for(int j=0;j<n;j++)
{
number temp = BIMATELEM(bim, i+1, j+1);
gfan::Integer* gi = numberToInteger(temp);
(*zm)[i][j] = *gi;
delete gi;
}
return zm;
}
BIMATELEM
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
numberToInteger
gfan::Integer * numberToInteger(const number &n)
Definition callgfanlib_conversion.cc:49
i
int i
Definition cfEzgcd.cc:132
bigintmat::cols
int cols() const
Definition bigintmat.h:144
bigintmat::rows
int rows() const
Definition bigintmat.h:145
j
int j
Definition facHensel.cc:110

## bigintmatToZVector()

gfan::ZVector * bigintmatToZVector | ( | const bigintmat & | bim | ) |

Definition at line 73 of file callgfanlib_conversion.cc.

{
gfan::ZVector* zv=new gfan::ZVector(bim.cols());
for(int j=0; j<bim.cols(); j++)
{
number temp = BIMATELEM(bim, 1, j+1);
gfan::Integer* gi = numberToInteger(temp);
(*zv)[j] = *gi;
delete gi;
}
return zv;
}

## expvToZVector()

gfan::ZVector expvToZVector | ( | const int | n,
|  | const int * | expv )

Definition at line 94 of file callgfanlib_conversion.cc.

{
gfan::ZVector zv(n);
for(int i=0; i<n; i++)
zv[i]=gfan::Integer(expv[i+1]);
return zv;
}

## integerToNumber()

number integerToNumber | ( | const gfan::Integer & | I | ) |

Definition at line 9 of file callgfanlib_conversion.cc.

{
mpz_t i;
mpz_init(i);
I.setGmp(i);
number j = n_InitMPZ(i,coeffs_BIGINT);
mpz_clear(i);
return j;
}
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
coeffs_BIGINT
VAR coeffs coeffs_BIGINT
Definition polys.cc:14

## intStar2ZVector()

gfan::ZVector intStar2ZVector | ( | const int | d,
|  | const int * | i )

Definition at line 86 of file callgfanlib_conversion.cc.

{
gfan::ZVector zv(d);
for(int j=0; j<d; j++)
zv[j]=i[j+1];
return zv;
}

## numberToInteger()

gfan::Integer * numberToInteger | ( | const number & | n | ) |

Definition at line 49 of file callgfanlib_conversion.cc.

{
if (SR_HDL(n) & SR_INT)
return new gfan::Integer(SR_TO_INT(n));
else
return new gfan::Integer(n->z);
}
SR_INT
#define SR_INT
Definition longrat.h:67
SR_TO_INT
#define SR_TO_INT(SR)
Definition longrat.h:69
SR_HDL
#define SR_HDL(A)
Definition tgb.cc:35

## rays()

std::set< gfan::ZVector > rays | ( | std::set< gfan::ZCone > | setOfCones | ) |

Definition at line 151 of file callgfanlib_conversion.cc.

{
std::set<gfan::ZVector> setOfRays;
for (std::set<gfan::ZCone>::iterator cone = setOfCones.begin(); cone!=setOfCones.end(); cone++)
{
gfan::ZMatrix raysOfCone = cone->extremeRays();
for (int i=0; i<raysOfCone.getHeight(); i++)
setOfRays.insert(raysOfCone[i]);
}
return setOfRays;
}

## toFanStar()

gfan::ZFan * toFanStar | ( | std::set< gfan::ZCone > | setOfCones | ) |

Definition at line 137 of file callgfanlib_conversion.cc.

{
if (setOfCones.size() > 0)
{
std::set<gfan::ZCone>::iterator cone = setOfCones.begin();
gfan::ZFan* zf = new gfan::ZFan(cone->ambientDimension());
for (std::set<gfan::ZCone>::iterator cone = setOfCones.begin(); cone!=setOfCones.end(); cone++)
zf->insert(*cone);
return zf;
}
else
return new gfan::ZFan(gfan::ZFan::fullFan(currRing->N));
}
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13

## toString()

char * toString | ( | gfan::ZMatrix const & | zm | ) |

Definition at line 127 of file callgfanlib_conversion.cc.

{
bigintmat* bim = zMatrixToBigintmat(zm);
char* s = bim->StringAsPrinted();
if (s==NULL)
s = (char*) omAlloc0(sizeof(char));
delete bim;
return s;
}
zMatrixToBigintmat
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
Definition callgfanlib_conversion.cc:34
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
bigintmat::StringAsPrinted
char * StringAsPrinted()
Returns a string as it would have been printed in the interpreter.
Definition bigintmat.cc:445
s
const CanonicalForm int s
Definition facAbsFact.cc:51
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12

## wvhdlEntryToZVector()

gfan::ZVector wvhdlEntryToZVector | ( | const int | n,
|  | const int * | wvhdl0 )

Definition at line 102 of file callgfanlib_conversion.cc.

{
gfan::ZVector zv(n);
for(int j=0; j<n; j++)
zv[j]=wvhdl0[j];
return zv;
}

## zMatrixToBigintmat()

bigintmat * zMatrixToBigintmat | ( | const gfan::ZMatrix & | zm | ) |

Definition at line 34 of file callgfanlib_conversion.cc.

{
int d=zm.getHeight();
int n=zm.getWidth();
bigintmat* bim = new bigintmat(d,n,coeffs_BIGINT);
for(int i=1;i<=d;i++)
for(int j=1; j<=n; j++)
{
number temp = integerToNumber(zm[i-1][j-1]);
bim->set(i,j,temp);
n_Delete(&temp,coeffs_BIGINT);
}
return bim;
}
integerToNumber
number integerToNumber(const gfan::Integer &I)
Definition callgfanlib_conversion.cc:9
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

## zVectorToBigintmat()

bigintmat * zVectorToBigintmat | ( | const gfan::ZVector & | zv | ) |

Definition at line 21 of file callgfanlib_conversion.cc.

{
int d=zv.size();
bigintmat* bim = new bigintmat(1,d,coeffs_BIGINT);
for(int i=1;i<=d;i++)
{
number temp = integerToNumber(zv[i-1]);
bim->set(1,i,temp);
n_Delete(&temp,coeffs_BIGINT);
}
return bim;
}

## ZVectorToIntStar()

int * ZVectorToIntStar | ( | const gfan::ZVector & | v,
|  | bool & | overflow )

Definition at line 110 of file callgfanlib_conversion.cc.

{
int* w = (int*) omAlloc(v.size()*sizeof(int));
for (unsigned i=0; i<v.size(); i++)
{
if (!v[i].fitsInInt())
{
omFree(w);
WerrorS("int overflow converting gfan:ZVector to int*");
overflow = true;
return NULL;
}
w[i]=v[i].toInt();
}
return w;
}
w
const CanonicalForm & w
Definition facAbsFact.cc:51
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
omFree
#define omFree(addr)
Definition omAllocDecl.h:261