Loading...
Searching...
No Matches
tropicalVariety.cc File Reference
`#include "callgfanlib_conversion.h"`
`#include "std_wrapper.h"`
`#include "bbfan.h"`
`#include "groebnerCone.h"`
`#include "tropicalVarietyOfPolynomials.h"`
`#include "tropicalVarietyOfIdeals.h"`
`#include "coeffs/numbers.h"`
`#include "misc/options.h"`
`#include "kernel/structs.h"`
`#include "gfanlib/gfanlib_zfan.h"`

Go to the source code of this file.

## Functions

static void | setOptionRedSB ()
static void | undoSetOptionRedSB ()
static gfan::ZFan * | toZFan (std::set< gfan::ZCone > maxCones, int d)
BOOLEAN | tropicalVariety (leftv res, leftv args)

## Variables

VAR BITSET | bitsetSave1
VAR BITSET | bitsetSave2

## Function Documentation

## setOptionRedSB()

void setOptionRedSB | ( |  | ) |

static

Definition at line 19 of file tropicalVariety.cc.

{
SI_SAVE_OPT(bitsetSave1,bitsetSave2);
si_opt_1|=Sy_bit(OPT_REDSB);
}
si_opt_1
VAR unsigned si_opt_1
Definition options.c:5
SI_SAVE_OPT
#define SI_SAVE_OPT(A, B)
Definition options.h:20
OPT_REDSB
#define OPT_REDSB
Definition options.h:77
Sy_bit
#define Sy_bit(x)
Definition options.h:31
bitsetSave2
VAR BITSET bitsetSave2
Definition tropicalVariety.cc:13
bitsetSave1
VAR BITSET bitsetSave1
Definition tropicalVariety.cc:13

## toZFan()

gfan::ZFan * toZFan | ( | std::set< gfan::ZCone > | maxCones,
|  | int | d )

static

Definition at line 34 of file tropicalVariety.cc.

{
gfan::ZFan* zf = new gfan::ZFan(d);
for (std::set<gfan::ZCone>::iterator sigma = maxCones.begin(); sigma!=maxCones.end(); sigma++)
zf->insert(*sigma);
return zf;
}

## tropicalVariety()

BOOLEAN tropicalVariety | ( | leftv | res,
|  | leftv | args )

Definition at line 43 of file tropicalVariety.cc.

{
leftv u = args;
if ((u!=NULL) && (u->Typ()==POLY_CMD))
{
poly g = (poly) u->Data();
leftv v = u->next;
if (v==NULL)
{
try
{
ideal I = idInit(1);
I->m[0] = g;
tropicalStrategy currentStrategy(I,currRing);
std::set<gfan::ZCone> maxCones = tropicalVariety(g,currRing,&currentStrategy);
res->rtyp = fanID;
res->data = (char*) toZFan(maxCones,currentStrategy.getExpectedAmbientDimension());
I->m[0] = NULL;
id_Delete(&I,currRing);
return FALSE;
}
catch (const std::exception& ex)
{
Werror("ERROR: %s",ex.what());
return TRUE;
}
}
if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
{
try
{
ideal I = idInit(1);
I->m[0] = g;
number p = (number) v->Data();
tropicalStrategy currentStrategy(I,p,currRing);
ideal startingIdeal = currentStrategy.getStartingIdeal();
ring startingRing = currentStrategy.getStartingRing();
poly gStart = startingIdeal->m[0];
std::set<gfan::ZCone> maxCones = tropicalVariety(gStart,startingRing,&currentStrategy);
res->rtyp = fanID;
res->data = (char*) toZFan(maxCones,currentStrategy.getExpectedAmbientDimension());
I->m[0] = NULL;
id_Delete(&I,currRing);
return FALSE;
}
catch (const std::exception& ex)
{
Werror("ERROR: %s",ex.what());
return TRUE;
}
}
}
if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
{
ideal I = (ideal) u->Data();
leftv v = u->next;
if ((I->m[0]!=NULL) && (idElem(I)==1))
{
poly g = I->m[0];
if (v==NULL)
{
try
{
tropicalStrategy currentStrategy(I,currRing);
std::set<gfan::ZCone> maxCones = tropicalVariety(g,currRing,&currentStrategy);
res->rtyp = fanID;
res->data = (char*) toZFan(maxCones,currentStrategy.getExpectedAmbientDimension());
return FALSE;
}
catch (const std::exception& ex)
{
Werror("ERROR: %s",ex.what());
return TRUE;
}
}
if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
{
try
{
number p = (number) v->Data();
tropicalStrategy currentStrategy(I,p,currRing);
ideal startingIdeal = currentStrategy.getStartingIdeal();
ring startingRing = currentStrategy.getStartingRing();
poly gStart = startingIdeal->m[0];
std::set<gfan::ZCone> maxCones = tropicalVariety(gStart,startingRing,&currentStrategy);
res->rtyp = fanID;
res->data = (char*) toZFan(maxCones,currentStrategy.getExpectedAmbientDimension());
return FALSE;
}
catch (const std::exception& ex)
{
Werror("ERROR: %s",ex.what());
return TRUE;
}
}
}
if (v==NULL)
{
try
{
setOptionRedSB();
ideal stdI;
if (!hasFlag(u,FLAG_STD))
stdI = gfanlib_kStd_wrapper(I,currRing);
else
stdI = id_Copy(I,currRing);
tropicalStrategy currentStrategy(stdI,currRing);
gfan::ZFan* tropI = tropicalVariety(currentStrategy);
res->rtyp = fanID;
res->data = (char*) tropI;
undoSetOptionRedSB();
id_Delete(&stdI,currRing);
return FALSE;
}
catch (const std::exception& ex)
{
Werror("ERROR: %s",ex.what());
return TRUE;
}
}
if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
{
try
{
number p = (number) v->Data();
ideal stdI;
if (!hasFlag(u,FLAG_STD))
stdI = gfanlib_kStd_wrapper(I,currRing);
else
stdI = id_Copy(I,currRing);
tropicalStrategy currentStrategy(stdI,p,currRing);
gfan::ZFan* tropI = tropicalVariety(currentStrategy);
res->rtyp = fanID;
res->data = (char*) tropI;
id_Delete(&stdI,currRing);
return FALSE;
}
catch (const std::exception& ex)
{
Werror("ERROR: %s",ex.what());
return TRUE;
}
}
return FALSE;
}
WerrorS("tropicalVariety: unexpected parameters");
return TRUE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
fanID
VAR int fanID
Definition bbfan.cc:19
p
int p
Definition cfModGcd.cc:4086
g
g
Definition cfModGcd.cc:4098
sleftv::Typ
int Typ()
Definition subexpr.cc:1048
sleftv::Data
void * Data()
Definition subexpr.cc:1192
sleftv::next
leftv next
Definition subexpr.h:86
tropicalStrategy
Definition tropicalStrategy.h:37
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
IDEAL_CMD
@ IDEAL_CMD
Definition grammar.cc:285
NUMBER_CMD
@ NUMBER_CMD
Definition grammar.cc:289
POLY_CMD
@ POLY_CMD
Definition grammar.cc:290
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition simpleideals.cc:542
hasFlag
#define hasFlag(A, F)
Definition ipid.h:112
FLAG_STD
#define FLAG_STD
Definition ipid.h:106
NULL
#define NULL
Definition omList.c:12
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
idElem
static int idElem(const ideal F)
number of non-zero polys in F
Definition simpleideals.h:69
gfanlib_kStd_wrapper
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition std_wrapper.cc:6
leftv
sleftv * leftv
Definition structs.h:53
setOptionRedSB
static void setOptionRedSB()
Definition tropicalVariety.cc:19
tropicalVariety
BOOLEAN tropicalVariety(leftv res, leftv args)
Definition tropicalVariety.cc:43
undoSetOptionRedSB
static void undoSetOptionRedSB()
Definition tropicalVariety.cc:29
toZFan
static gfan::ZFan * toZFan(std::set< gfan::ZCone > maxCones, int d)
Definition tropicalVariety.cc:34

## undoSetOptionRedSB()

void undoSetOptionRedSB | ( |  | ) |

static

Definition at line 29 of file tropicalVariety.cc.

{
SI_RESTORE_OPT(bitsetSave1,bitsetSave2);
}
SI_RESTORE_OPT
#define SI_RESTORE_OPT(A, B)
Definition options.h:23

## Variable Documentation

## bitsetSave1

VAR BITSET bitsetSave1

Definition at line 13 of file tropicalVariety.cc.

## bitsetSave2

VAR BITSET bitsetSave2

Definition at line 13 of file tropicalVariety.cc.