66 for ( k=
IDELEMS( sourceIdeal )-1; k >=0; k-- )
67 (newSource->m)[
k]=
pCopy( (sourceIdeal->m)[k] );
74 for ( k=
IDELEMS( sourceIdeal )-1; (k >= 0) && (found ==
FALSE); k-- )
97 for ( k=
IDELEMS( result )-1; k >=0; k-- )
99 if ( (result->m)[k] !=
NULL )
105 if ( found )
pDelete( & ((result->m)[k]) );
129 ring dring =
IDRING( dringHdl );
130 ring sring =
IDRING( sringHdl );
134 WerrorS(
"rings must have same characteristic" );
137 if ( (sring->OrdSgn != 1) || (dring->OrdSgn != 1) )
139 WerrorS(
"only works for global orderings" );
142 if ( sring->N != dring->N )
144 WerrorS(
"rings must have same number of variables" );
149 WerrorS(
"rings must have same number of parameters" );
152 if ( state !=
FglmOk )
return state;
156 int npar =
rPar(sring);
159 pperm= (
int *)
omAlloc0( (npar+1)*
sizeof( int ) );
163 dring->names, nvar,
rParameter(dring), npar, vperm, pperm,
165 for ( k= nvar; (k > 0) && (state ==
FglmOk); k-- )
168 WerrorS(
"variable names do not agree" );
171 for ( k= npar-1; (k >= 0) && (state ==
FglmOk); k-- )
174 WerrorS(
"parameter names do not agree" );
179 if ( state !=
FglmOk )
return state;
181 if ( sring->qideal !=
NULL )
183 if ( dring->qideal ==
NULL )
185 Werror(
"%s is a qring, current ring not", sringHdl->
id );
193 for ( k=
IDELEMS( sring->qideal )-1; k >= 0; k-- )
194 (sqind->m)[k]=
p_PermPoly( (sring->qideal->m)[
k], vperm, sring,
196 ideal sqindred =
kNF( dring->qideal,
NULL, sqind );
197 if ( !
idIs0( sqindred ) )
199 WerrorS(
"the quotients do not agree" );
205 if ( state !=
FglmOk )
return state;
207 int * dsvperm = (
int *)
omAlloc0( (nvar+1)*
sizeof( int ) );
209 dsvperm,
NULL, sring->cf->type);
210 nMap=
n_SetMap(currRing->cf, dring->cf);
212 for ( k=
IDELEMS( dring->qideal )-1; k >= 0; k-- )
213 (dqins->m)[k]=
p_PermPoly( (dring->qideal->m)[
k], dsvperm, sring,
215 ideal dqinsred =
kNF( sring->qideal,
NULL, dqins );
216 if ( !
idIs0( dqinsred ) )
218 WerrorS(
"the quotients do not agree" );
224 if ( state !=
FglmOk )
return state;
228 if ( dring->qideal !=
NULL )
230 Werror(
"current ring is a qring, %s not", sringHdl->
id );
253 for ( k=
IDELEMS( theIdeal ) - 1; (state ==
FglmOk) && (k >= 0); k-- )
255 poly p = (theIdeal->m)[k];
261 fglmASSERT( 0 < power && power <= currRing->
N,
"illegal power" );
263 else purePowers[power-1]=
TRUE;
265 for (
int l =
IDELEMS( theIdeal ) - 1; state ==
FglmOk &&
l >= 0; l-- )
289 ideal destIdeal =
NULL;
327 (destIdeal->m)[0]=
pOne();
331 Werror(
"ring %s and current ring are incompatible", first->
Name() );
335 Werror(
"Can't find ideal %s in ring %s", second->
Name(), first->
Name() );
339 Werror(
"The ideal %s has to be 0-dimensional", second->
Name() );
343 Werror(
"The ideal %s has to be given by a reduced SB", second->
Name() );
351 result->
data= (
void *)destIdeal;
365 ideal sourceIdeal = (ideal)first->
Data();
367 ideal destIdeal =
NULL;
389 (destIdeal->m)[0]=
pOne();
393 Werror(
"The ideal %s has to be 0-dimensional", first->
Name() );
397 Werror(
"The poly %s has to be reduced", second->
Name() );
403 for ( k=
IDELEMS( sourceIdeal )-1; k >=0; k-- )
404 (destIdeal->m)[
k]=
pCopy( (sourceIdeal->m)[k] );
409 (destIdeal->m)[0]=
pOne();
417 result->
data= (
void *)destIdeal;
431 ideal destIdeal =
NULL;
434 sourceIdeal = (ideal)first->
Data();
445 for ( k=
IDELEMS( sourceIdeal ) - 1; k >= 0; k-- )
449 if (purePowers[i-1]==0)
460 for(k=
currRing->N-1; k>=0; k--) destIdeal->m[
k]=
pCopy(sourceIdeal->m[purePowers[k]]);
474 (destIdeal->m)[0]=
pOne();
478 Werror(
"The ideal %s has to be 0-dimensional", first->
Name() );
482 Werror(
"The ideal %s has to be reduced", first->
Name() );
490 result->
data= (
void *)destIdeal;
int status int void size_t count
Class used for (list of) interpreter objects.
#define fglmASSERT(ignore1, ignore2)
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
FglmState fglmIdealcheck(const ideal theIdeal)
#define idDelete(H)
delete an ideal
Compatiblity layer for legacy polynomial operations (over currRing)
static int rPar(const ring r)
(r->cf->P)
FglmState fglmConsistency(idhdl sringHdl, idhdl dringHdl, int *vperm)
BOOLEAN fglmquot(ideal sourceIdeal, poly quot, ideal &destIdeal)
#define omFreeSize(addr, size)
BOOLEAN fglmzero(ring sourceRing, ideal &sourceIdeal, ring destRing, ideal &destideal, BOOLEAN switchBack=TRUE, BOOLEAN deleteIdeal=FALSE)
void WerrorS(const char *s)
static char const ** rParameter(const ring r)
(r->cf->parameter)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
ideal fglmUpdatesource(const ideal sourceIdeal)
const CanonicalForm CFMap CFMap & N
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
void fglmUpdateresult(ideal &result)
#define pIsConstant(p)
like above, except that Comp might be != 0
BOOLEAN assumeStdFlag(leftv h)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
BOOLEAN fglmQuotProc(leftv result, leftv first, leftv second)
ideal idInit(int idsize, int rank)
initialise an ideal / module
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
BOOLEAN fglmProc(leftv result, leftv first, leftv second)
BOOLEAN FindUnivariateWrapper(ideal source, ideal &destIdeal)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void Werror(const char *fmt,...)
BOOLEAN findUniProc(leftv result, leftv first)
#define pCopy(p)
return a copy of the poly