The main function for the fglm-Algorithm. Checks the input-data, and calls fglmzero (see fglmzero.cc). Returns the new groebnerbasis or 0 if an error occoured.
| 274 | // Checks the input-data, and calls fglmzero (see fglmzero.cc). |
| 275 | // Returns the new groebnerbasis or 0 if an error occoured. |
| 276 | BOOLEAN |
| 277 | fglmProc( leftv result, leftv first, leftv second ) |
| 278 | { |
| 279 | FglmState state = FglmOk; |
| 280 | |
| 281 | ring destRing = currRing; |
| 282 | // ring destRing = currRing; |
| 283 | ideal destIdeal = NULL; |
| 284 | ring sourceRing = (ring)first->Data(); |
| 285 | rChangeCurrRing( sourceRing ); |
| 286 | // ring sourceRing = currRing; |
| 287 | |
| 288 | int * vperm = (int *)omAlloc0( (sourceRing->N+1)*sizeof( int ) ); |
| 289 | state= fglmConsistency( sourceRing, destRing, vperm ); |
| 290 | omFreeSize( (ADDRESS)vperm, (sourceRing->N+1)*sizeof(int) ); |
| 291 | |
| 292 | if ( state == FglmOk ) |
| 293 | { |
| 294 | idhdl ih = sourceRing->idroot->get( second->Name(), myynest ); |
| 295 | if ( (ih != NULL) && (IDTYP(ih)==IDEAL_CMD) ) |
| 296 | { |
| 297 | ideal sourceIdeal; |
| 298 | if ( sourceRing->qideal != NULL ) |
| 299 | sourceIdeal= fglmUpdatesource( IDIDEAL( ih ) ); |
| 300 | else |
| 301 | sourceIdeal = IDIDEAL( ih ); |
| 302 | state= fglmIdealcheck( sourceIdeal ); |
| 303 | if ( state == FglmOk ) |
| 304 | { |
| 305 | // Now the settings are compatible with FGLM |
| 306 | assumeStdFlag( (leftv)ih ); |
| 307 | if ( fglmzero( sourceRing, sourceIdeal, destRing, destIdeal, FALSE, (currRing->qideal != NULL) ) == FALSE ) |
| 308 | state= FglmNotReduced; |
| 309 | } |
| 310 | } else state= FglmNoIdeal; |
| 311 | } |
| 312 | if ( currRing != destRing ) |
| 313 | rChangeCurrRing( destRing ); |
| 314 | switch (state) |
| 315 | { |
| 316 | case FglmOk: |
| 317 | if ( currRing->qideal != NULL ) fglmUpdateresult( destIdeal ); |
| 318 | break; |
| 319 | case FglmHasOne: |
| 320 | destIdeal= idInit(1,1); |
| 321 | (destIdeal->m)[0]= pOne(); |
| 322 | state= FglmOk; |
| 323 | break; |
| 324 | case FglmIncompatibleRings: |
| 325 | WerrorS( "source ring and current ring are incompatible" ); |
| 326 | destIdeal= NULL; |
| 327 | break; |
| 328 | case FglmNoIdeal: |
| 329 | Werror( "Can't find ideal %s in source ring", second->Name() ); |
| 330 | destIdeal= NULL; |
| 331 | break; |
| 332 | case FglmNotZeroDim: |
| 333 | Werror( "The ideal %s has to be 0-dimensional", second->Name() ); |
nothing calls this directly
no test coverage detected