Loading...
Searching...
No Matches
fglm.h File Reference
`#include "kernel/mod2.h"`
`#include "kernel/ideals.h"`
`#include "kernel/structs.h"`

Go to the source code of this file.

## Functions

BOOLEAN | fglmProc (leftv result, leftv first, leftv second)
BOOLEAN | fglmQuotProc (leftv result, leftv first, leftv second)
ideal | fglmQuot (ideal first, poly second)
BOOLEAN | FindUnivariateWrapper (ideal source, ideal &dest)
BOOLEAN | findUniProc (leftv result, leftv first)
ideal | findUni (ideal first)
ideal | fglmhomProc (leftv first, leftv second)

## Function Documentation

## fglmhomProc()

ideal fglmhomProc | ( | leftv | first,
|  | leftv | second )

## fglmProc()

BOOLEAN fglmProc | ( | leftv | result,
|  | leftv | first,
|  | leftv | second )

Definition at line 277 of file fglm.cc.

{
FglmState state = FglmOk;
ring destRing = currRing;
// ring destRing = currRing;
ideal destIdeal = NULL;
ring sourceRing = (ring)first->Data();
rChangeCurrRing( sourceRing );
// ring sourceRing = currRing;
int * vperm = (int *)omAlloc0( (sourceRing->N+1)*sizeof( int ) );
state= fglmConsistency( sourceRing, destRing, vperm );
omFreeSize( (ADDRESS)vperm, (sourceRing->N+1)*sizeof(int) );
if ( state == FglmOk )
{
idhdl ih = sourceRing->idroot->get( second->Name(), myynest );
if ( (ih != NULL) && (IDTYP(ih)==IDEAL_CMD) )
{
ideal sourceIdeal;
if ( sourceRing->qideal != NULL )
sourceIdeal= fglmUpdatesource( IDIDEAL( ih ) );
else
sourceIdeal = IDIDEAL( ih );
state= fglmIdealcheck( sourceIdeal );
if ( state == FglmOk )
{
// Now the settings are compatible with FGLM
assumeStdFlag( (leftv)ih );
if ( fglmzero( sourceRing, sourceIdeal, destRing, destIdeal, FALSE, (currRing->qideal != NULL) ) == FALSE )
state= FglmNotReduced;
}
} else state= FglmNoIdeal;
}
if ( currRing != destRing )
rChangeCurrRing( destRing );
switch (state)
{
case FglmOk:
if ( currRing->qideal != NULL ) fglmUpdateresult( destIdeal );
break;
case FglmHasOne:
destIdeal= idInit(1,1);
(destIdeal->m)[0]= pOne();
state= FglmOk;
break;
case FglmIncompatibleRings:
WerrorS( "source ring and current ring are incompatible" );
destIdeal= NULL;
break;
case FglmNoIdeal:
Werror( "Can't find ideal %s in source ring", second->Name() );
destIdeal= NULL;
break;
case FglmNotZeroDim:
Werror( "The ideal %s has to be 0-dimensional", second->Name() );
destIdeal= NULL;
break;
case FglmNotReduced:
Werror( "The ideal %s has to be given by a reduced SB", second->Name() );
destIdeal= NULL;
break;
default:
destIdeal= idInit(1,1);
}
result->rtyp = IDEAL_CMD;
result->data= (void *)destIdeal;
setFlag( result, FLAG_STD );
return (state != FglmOk);
}
FALSE
#define FALSE
Definition auxiliary.h:97
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
sleftv::Data
void * Data()
Definition subexpr.cc:1192
sleftv::Name
const char * Name()
Definition subexpr.h:120
result
return result
Definition facAbsBiFact.cc:76
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
myynest
VAR int myynest
Definition febase.cc:41
fglmConsistency
FglmState fglmConsistency(ring sring, ring dring, int *vperm)
Definition fglm.cc:121
fglmIdealcheck
FglmState fglmIdealcheck(const ideal theIdeal)
Definition fglm.cc:240
fglmUpdatesource
ideal fglmUpdatesource(const ideal sourceIdeal)
Definition fglm.cc:57
fglmUpdateresult
void fglmUpdateresult(ideal &result)
Definition fglm.cc:89
FglmState
FglmState
Definition fglm.cc:39
FglmOk
@ FglmOk
Definition fglm.cc:40
FglmNotReduced
@ FglmNotReduced
Definition fglm.cc:43
FglmHasOne
@ FglmHasOne
Definition fglm.cc:41
FglmNotZeroDim
@ FglmNotZeroDim
Definition fglm.cc:44
FglmIncompatibleRings
@ FglmIncompatibleRings
Definition fglm.cc:45
FglmNoIdeal
@ FglmNoIdeal
Definition fglm.cc:42
IDEAL_CMD
@ IDEAL_CMD
Definition grammar.cc:285
setFlag
#define setFlag(A, F)
Definition ipid.h:113
IDIDEAL
#define IDIDEAL(a)
Definition ipid.h:133
IDTYP
#define IDTYP(a)
Definition ipid.h:119
FLAG_STD
#define FLAG_STD
Definition ipid.h:106
fglmzero
BOOLEAN fglmzero(ring sourceRing, ideal &sourceIdeal, ring destRing, ideal &destideal, BOOLEAN switchBack=TRUE, BOOLEAN deleteIdeal=FALSE)
Definition fglmzero.cc:1193
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
pOne
#define pOne()
Definition polys.h:316
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189
idhdl
idrec * idhdl
Definition ring.h:22
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
leftv
sleftv * leftv
Definition structs.h:53
assumeStdFlag
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1587

## fglmQuot()

ideal fglmQuot | ( | ideal | first,
|  | poly | second )

Definition at line 350 of file fglm.cc.

{
FglmState state = FglmOk;
ideal sourceIdeal = first;
poly quot = second;
ideal destIdeal = NULL;
state = fglmIdealcheck( sourceIdeal );
if ( state == FglmOk )
{
if ( quot == NULL ) state= FglmPolyIsZero;
else if ( pIsConstant( quot ) ) state= FglmPolyIsOne;
}
if ( state == FglmOk )
{
if ( fglmquot( sourceIdeal, quot, destIdeal ) == FALSE )
state= FglmNotReduced;
}
switch (state)
{
case FglmOk:
break;
case FglmHasOne:
destIdeal= idInit(1,1);
(destIdeal->m)[0]= pOne();
state= FglmOk;
break;
case FglmNotZeroDim:
WerrorS( "The ideal has to be 0-dimensional" );
destIdeal= idInit(1,1);
break;
case FglmNotReduced:
WerrorS( "The poly has to be reduced" );
destIdeal= idInit(1,1);
break;
case FglmPolyIsOne:
int k;
destIdeal= idInit( IDELEMS(sourceIdeal), 1 );
for ( k= IDELEMS( sourceIdeal )-1; k >=0; k-- )
(destIdeal->m)[k]= pCopy( (sourceIdeal->m)[k] );
state= FglmOk;
break;
case FglmPolyIsZero:
destIdeal= idInit(1,1);
(destIdeal->m)[0]= pOne();
state= FglmOk;
break;
default:
destIdeal= idInit(1,1);
}
return destIdeal;
}
k
int k
Definition cfEzgcd.cc:99
FglmPolyIsOne
@ FglmPolyIsOne
Definition fglm.cc:47
FglmPolyIsZero
@ FglmPolyIsZero
Definition fglm.cc:48
fglmquot
BOOLEAN fglmquot(ideal sourceIdeal, poly quot, ideal &destIdeal)
Definition fglmzero.cc:1218
pIsConstant
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23

## fglmQuotProc()

BOOLEAN fglmQuotProc | ( | leftv | result,
|  | leftv | first,
|  | leftv | second )

Definition at line 411 of file fglm.cc.

{
FglmState state = FglmOk;
// STICKYPROT("quotstart\n");
ideal sourceIdeal = (ideal)first->Data();
poly quot = (poly)second->Data();
ideal destIdeal = NULL;
state = fglmIdealcheck( sourceIdeal );
if ( state == FglmOk )
{
if ( quot == NULL ) state= FglmPolyIsZero;
else if ( pIsConstant( quot ) ) state= FglmPolyIsOne;
}
if ( state == FglmOk )
{
assumeStdFlag( first );
if ( fglmquot( sourceIdeal, quot, destIdeal ) == FALSE )
state= FglmNotReduced;
}
switch (state)
{
case FglmOk:
break;
case FglmHasOne:
destIdeal= idInit(1,1);
(destIdeal->m)[0]= pOne();
state= FglmOk;
break;
case FglmNotZeroDim:
Werror( "The ideal %s has to be 0-dimensional", first->Name() );
destIdeal= NULL;
break;
case FglmNotReduced:
Werror( "The poly %s has to be reduced", second->Name() );
destIdeal= NULL;
break;
case FglmPolyIsOne:
int k;
destIdeal= idInit( IDELEMS(sourceIdeal), 1 );
for ( k= IDELEMS( sourceIdeal )-1; k >=0; k-- )
(destIdeal->m)[k]= pCopy( (sourceIdeal->m)[k] );
state= FglmOk;
break;
case FglmPolyIsZero:
destIdeal= idInit(1,1);
(destIdeal->m)[0]= pOne();
state= FglmOk;
break;
default:
destIdeal= idInit(1,1);
}
result->rtyp = IDEAL_CMD;
result->data= (void *)destIdeal;
setFlag( result, FLAG_STD );
// STICKYPROT("quotend\n");
return (state != FglmOk);
} // fglmQuotProt

## findUni()

ideal findUni | ( | ideal | first | ) |

Definition at line 474 of file fglm.cc.

{
ideal sourceIdeal;
ideal destIdeal = NULL;
FglmState state;
sourceIdeal = first;
state= fglmIdealcheck( sourceIdeal );
if ( state == FglmOk )
{
// check for special cases: if the input contains
// univariate polys, try to reduce the problem
int i,k;
int count=0;
BOOLEAN * purePowers = (BOOLEAN *)omAlloc0( currRing->N*sizeof( BOOLEAN ) );
for ( k= IDELEMS( sourceIdeal ) - 1; k >= 0; k-- )
{
if((i=pIsUnivariate(sourceIdeal->m[k]))>0)
{
if (purePowers[i-1]==0)
{
purePowers[i-1]=k;
count++;
if (count==currRing->N) break;
}
}
}
if (count==currRing->N)
{
destIdeal=idInit(currRing->N,1);
for(k=currRing->N-1; k>=0; k--) destIdeal->m[k]=pCopy(sourceIdeal->m[purePowers[k]]);
}
omFreeSize((ADDRESS)purePowers, currRing->N*sizeof( BOOLEAN ) );
if (destIdeal!=NULL)
state = FglmOk;
else if ( FindUnivariateWrapper( sourceIdeal, destIdeal ) == FALSE )
state = FglmNotReduced;
}
switch (state)
{
case FglmOk:
break;
case FglmHasOne:
destIdeal= idInit(1,1);
(destIdeal->m)[0]= pOne();
state= FglmOk;
break;
case FglmNotZeroDim:
WerrorS( "The ideal has to be 0-dimensional" );
destIdeal= idInit(1,1);
break;
case FglmNotReduced:
Werror( "The ideal has to be reduced" );
destIdeal= idInit(1,1);
break;
default:
destIdeal= idInit(1,1);
}
return destIdeal;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
i
int i
Definition cfEzgcd.cc:132
FindUnivariateWrapper
BOOLEAN FindUnivariateWrapper(ideal source, ideal &destIdeal)
Definition fglmzero.cc:1236
pIsUnivariate
#define pIsUnivariate(p)
Definition polys.h:250
count
int status int void size_t count
Definition si_signals.h:69

## findUniProc()

BOOLEAN findUniProc | ( | leftv | result,
|  | leftv | first )

Definition at line 541 of file fglm.cc.

{
ideal sourceIdeal;
ideal destIdeal = NULL;
FglmState state;
sourceIdeal = (ideal)first->Data();
assumeStdFlag( first );
state= fglmIdealcheck( sourceIdeal );
if ( state == FglmOk )
{
// check for special cases: if the input contains
// univariate polys, try to reduce the problem
int i,k;
int count=0;
BOOLEAN * purePowers = (BOOLEAN *)omAlloc0( currRing->N*sizeof( BOOLEAN ) );
for ( k= IDELEMS( sourceIdeal ) - 1; k >= 0; k-- )
{
if((i=pIsUnivariate(sourceIdeal->m[k]))>0)
{
if (purePowers[i-1]==0)
{
purePowers[i-1]=k;
count++;
if (count==currRing->N) break;
}
}
}
if (count==currRing->N)
{
destIdeal=idInit(currRing->N,1);
for(k=currRing->N-1; k>=0; k--) destIdeal->m[k]=pCopy(sourceIdeal->m[purePowers[k]]);
}
omFreeSize((ADDRESS)purePowers, currRing->N*sizeof( BOOLEAN ) );
if (destIdeal!=NULL)
state = FglmOk;
else if ( FindUnivariateWrapper( sourceIdeal, destIdeal ) == FALSE )
state = FglmNotReduced;
}
switch (state)
{
case FglmOk:
break;
case FglmHasOne:
destIdeal= idInit(1,1);
(destIdeal->m)[0]= pOne();
state= FglmOk;
break;
case FglmNotZeroDim:
Werror( "The ideal %s has to be 0-dimensional", first->Name() );
destIdeal= NULL;
break;
case FglmNotReduced:
Werror( "The ideal %s has to be reduced", first->Name() );
destIdeal= NULL;
break;
default:
destIdeal= idInit(1,1);
}
result->rtyp = IDEAL_CMD;
result->data= (void *)destIdeal;
return FALSE;
}

## FindUnivariateWrapper()

BOOLEAN FindUnivariateWrapper | ( | ideal | source,
|  | ideal & | dest )

Definition at line 1236 of file fglmzero.cc.

{
BOOLEAN fglmok;
idealFunctionals L( 100, (currRing->N) );
fglmok = CalculateFunctionals( source, L );
if ( fglmok == TRUE ) {
destIdeal= FindUnivariatePolys( L );
return TRUE;
}
else
return FALSE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
idealFunctionals
Definition fglmzero.cc:75
FindUnivariatePolys
static ideal FindUnivariatePolys(const idealFunctionals &l)
Definition fglmzero.cc:1118
CalculateFunctionals
static BOOLEAN CalculateFunctionals(const ideal &theIdeal, idealFunctionals &l)
Definition fglmzero.cc:673