Changeset df83c0 in git
- Timestamp:
- Nov 24, 1999, 1:29:38 PM (24 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 015eaa982b5452b61c7e2510ba7ecfcfc9606d1a
- Parents:
- d47e6fd256e2e97a44cc9bae4b289a40732b3e98
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/fglm.cc
rd47e6f rdf83c0 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fglm.cc,v 1. 19 1999-11-15 17:19:59 obachman Exp $2 // $Id: fglm.cc,v 1.20 1999-11-24 12:29:38 wichmann Exp $ 3 3 4 4 /**************************************** … … 41 41 FglmNotReduced, 42 42 FglmNotZeroDim, 43 FglmIncompatibleRings 43 FglmIncompatibleRings, 44 // for fglmquot: 45 FglmPolyIsOne, 46 FglmPolyIsZero 44 47 }; 45 48 … … 321 324 } 322 325 326 // fglmQuotProc: Calculate I:f with FGLM methods. 327 // Checks the input-data, and calls fglmquot (see fglmzero.cc). 328 // Returns the new groebnerbasis if I:f or 0 if an error occoured. 329 BOOLEAN 330 fglmQuotProc( leftv result, leftv first, leftv second ) 331 { 332 FglmState state = FglmOk; 333 334 // STICKYPROT("quotstart\n"); 335 ideal sourceIdeal = IDIDEAL( (idhdl)first->data ); 336 poly quot = (poly)second->Data(); 337 ideal destIdeal = NULL; 338 339 state = fglmIdealcheck( sourceIdeal ); 340 if ( state == FglmOk ) { 341 if ( quot == NULL ) state= FglmPolyIsZero; 342 else if ( pIsConstant( quot ) ) state= FglmPolyIsOne; 343 } 344 345 if ( state == FglmOk ) { 346 assumeStdFlag( first ); 347 if ( fglmquot( sourceIdeal, quot, destIdeal ) == FALSE ) 348 state= FglmNotReduced; 349 } 350 351 switch (state) { 352 case FglmOk: 353 break; 354 case FglmHasOne: 355 destIdeal= idInit(1,1); 356 (destIdeal->m)[0]= pOne(); 357 state= FglmOk; 358 break; 359 case FglmNotZeroDim: 360 Werror( "The ideal %s has to be 0-dimensional", first->Name() ); 361 destIdeal= idInit(0,0); 362 break; 363 case FglmNotReduced: 364 Werror( "The poly %s has to be reduced", second->Name() ); 365 destIdeal= idInit(0,0); 366 break; 367 case FglmPolyIsOne: 368 int k; 369 destIdeal= idInit( IDELEMS(sourceIdeal), 1 ); 370 for ( k= IDELEMS( sourceIdeal )-1; k >=0; k-- ) 371 (destIdeal->m)[k]= pCopy( (sourceIdeal->m)[k] ); 372 state= FglmOk; 373 break; 374 case FglmPolyIsZero: 375 destIdeal= idInit(1,1); 376 (destIdeal->m)[0]= pOne(); 377 state= FglmOk; 378 break; 379 default: 380 destIdeal= idInit(1,1); 381 } 382 383 result->rtyp = IDEAL_CMD; 384 result->data= (void *)destIdeal; 385 setFlag( result, FLAG_STD ); 386 // STICKYPROT("quotend\n"); 387 return (state != FglmOk); 388 } // fglmQuotProt 389 323 390 // The main function for finduni(). 324 391 // Checks the input-data, and calls FindUnivariateWrapper (see fglmzero.cc). -
Singular/fglm.h
rd47e6f rdf83c0 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fglm.h,v 1.1 1 1999-11-15 17:20:00 obachman Exp $2 // $Id: fglm.h,v 1.12 1999-11-24 12:29:37 wichmann Exp $ 3 3 4 4 /**************************************** … … 69 69 fglmzero( idhdl sourceRingHdl, ideal & sourceIdeal, idhdl destRingHdl, ideal & destideal, BOOLEAN switchBack = TRUE, BOOLEAN deleteIdeal = FALSE ); 70 70 71 BOOLEAN 72 fglmquot( ideal sourceIdeal, poly quot, ideal & destIdeal ); 73 71 74 // fglmproc(...): 72 // The procedure which has to be called from the interpreter .75 // The procedure which has to be called from the interpreter for fglm. 73 76 // first is the sourceRing, second is the given ideal in sourceRing. 74 77 // Returns the groebnerbasis of the sourceIdeal in the currentRing. … … 77 80 BOOLEAN 78 81 fglmProc( leftv result, leftv first, leftv second ); 82 83 // fglmquotproc(...): 84 // The procedure which has to be called from the interpreter for fglmquot. 85 // first is the ideal I, second is the polynomial q. The polynomial must 86 // be reduced with respect to I. 87 // Returns the groebnerbasis of I:q in the currentRing. 88 // Checks, if the ideal is really a reduced groebner basis of a 89 // 0-dimensional Ideal and if q is really reduced. 90 // Returns TRUE if an error occoured. 91 BOOLEAN 92 fglmQuotProc( leftv result, leftv first, leftv second ); 79 93 80 94 // FindUnivariatePolys (test) -
Singular/fglmzero.cc
rd47e6f rdf83c0 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fglmzero.cc,v 1.2 6 1999-11-15 17:20:03 obachman Exp $2 // $Id: fglmzero.cc,v 1.27 1999-11-24 12:29:37 wichmann Exp $ 3 3 4 4 /**************************************** … … 31 31 #include "maps.h" 32 32 #include "mmemory.h" 33 #include "kstd1.h" // for kNF (see fglmquot) 33 34 #include "fglm.h" 34 35 #include "fglmvec.h" … … 540 541 // This is the place where we can detect if the sourceIdeal 541 542 // is not reduced. In this case m is not in basis[]. Since basis[] 542 // is ordered this is the n and only then the case,if basis[i]<m543 // is ordered this is the case, if and only if basis[i]<m 543 544 // and basis[j]>m for all j>i 544 545 _state= FALSE; … … 584 585 } 585 586 586 // Calculates the defining Functionals for the ideal "theIdeal" and 587 // returns them in "l". 588 // The ideal has to be zero-dimensional and reduced and has to be a 589 // real subset of the polynomal ring. 590 // In any case it has to be zero-dimensional and minimal (check this 591 // via fglmIdealcheck). Any minimal but not reduced ideal is detected. 592 // In this case it returns FglmNotReduced. 593 // If the base domain is Q, the leading coefficients of the polys 594 // have to be in Z. 595 // returns TRUE if the result is valid, FALSE if theIdeal 596 // is not reduced. 597 static BOOLEAN 598 CalculateFunctionals( const ideal & theIdeal, idealFunctionals & l ) 599 { 600 fglmSdata data( theIdeal ); 587 void 588 internalCalculateFunctionals( const ideal & theIdeal, idealFunctionals & l, 589 fglmSdata & data ) 590 { 601 591 602 592 // insert pOne() into basis and update the workingList: … … 643 633 l.endofConstruction(); 644 634 STICKYPROT2( "\nvdim= %i\n", data.getBasisSize() ); 635 return; 636 } 637 638 // Calculates the defining Functionals for the ideal "theIdeal" and 639 // returns them in "l". 640 // The ideal has to be zero-dimensional and reduced and has to be a 641 // real subset of the polynomal ring. 642 // In any case it has to be zero-dimensional and minimal (check this 643 // via fglmIdealcheck). Any minimal but not reduced ideal is detected. 644 // In this case it returns FglmNotReduced. 645 // If the base domain is Q, the leading coefficients of the polys 646 // have to be in Z. 647 // returns TRUE if the result is valid, FALSE if theIdeal 648 // is not reduced. 649 static BOOLEAN 650 CalculateFunctionals( const ideal & theIdeal, idealFunctionals & l ) 651 { 652 fglmSdata data( theIdeal ); 653 internalCalculateFunctionals( theIdeal, l, data ); 654 return ( data.state() ); 655 } 656 657 static BOOLEAN 658 CalculateFunctionals( const ideal & theIdeal, idealFunctionals & l, 659 poly & p, fglmVector & v ) 660 { 661 fglmSdata data( theIdeal ); 662 internalCalculateFunctionals( theIdeal, l, data ); 663 // STICKYPROT("Calculating vector rep\n"); 664 v = data.getVectorRep( p ); 665 // if ( v.isZero() ) 666 // STICKYPROT("vectorrep is 0\n"); 645 667 return ( data.state() ); 646 668 } … … 765 787 fglmDdata::~fglmDdata() 766 788 { 767 fglmASSERT( dimen == basisSize, "Es wurden nicht alle BasisElemente gefunden!" ); 789 // STICKYPROT2("dimen= %i", dimen); 790 // STICKYPROT2("basisSize= %i", basisSize); 791 // fglmASSERT( dimen == basisSize, "Es wurden nicht alle BasisElemente gefunden!" ); 768 792 int k; 769 793 #ifndef HAVE_EXPLICIT_CONSTR 770 794 delete [] gauss; 771 795 #else 772 for ( k= dimen; k > 0; k-- ) 796 // use basisSize instead of dimen because of fglmquot! 797 for ( k= basisSize; k > 0; k-- ) 773 798 gauss[k].~oldGaussElem(); 774 799 Free( (ADDRESS)gauss, (dimen+1)*sizeof( oldGaussElem ) ); … … 776 801 Free( (ADDRESS)isPivot, (dimen+1)*sizeof( BOOLEAN ) ); 777 802 Free( (ADDRESS)perm, (dimen+1)*sizeof( int ) ); 803 // use basisSize instead of dimen because of fglmquot! 778 804 //. Remember: There is no poly in basis[0], thus k > 0 779 for ( k= dimen; k > 0; k-- )805 for ( k= basisSize; k > 0; k-- ) 780 806 pDelete1( basis + k ); 781 807 Free( (ADDRESS)basis, (dimen+1)*sizeof( poly ) ); … … 975 1001 976 1002 static ideal 977 GroebnerViaFunctionals( const idealFunctionals & l ) 978 // Calculates the groebnerBasis for the ideal which is defined by l. 1003 GroebnerViaFunctionals( const idealFunctionals & l, 1004 fglmVector iv = fglmVector() ) 1005 // If iv is zero, calculates the groebnerBasis for the ideal which is 1006 // defined by l. 1007 // If iv is not zero, then the groebnerBasis if i:p is calculated where 1008 // i is defined by l and iv is the vector-representation of nf(p) wrt. i 979 1009 // The dimension of l has to be finite. 980 1010 // The result is in reduced form. … … 982 1012 fglmDdata data( l.dimen() ); 983 1013 984 // insert pOne() and update workinglist: 1014 // insert pOne() and update workinglist according to iv: 1015 fglmVector initv; 1016 if ( iv.isZero() ) { 1017 // STICKYPROT("initv is zero\n"); 1018 initv = fglmVector( l.dimen(), 1 ); 1019 } 1020 else { 1021 // STICKYPROT("initv is not zero\n"); 1022 initv = iv; 1023 } 1024 985 1025 poly one = pOne(); 986 data.updateCandidates( one, fglmVector(l.dimen(), 1));1026 data.updateCandidates( one, initv ); 987 1027 number nOne = nInit( 1 ); 988 data.newBasisElem( one, fglmVector( l.dimen(), 1 ), fglmVector( 1, 1 ), nOne );1028 data.newBasisElem( one, initv, fglmVector( 1, 1 ), nOne ); 989 1029 STICKYPROT( "." ); 990 1030 while ( data.candidatesLeft() == TRUE ) { … … 1113 1153 1114 1154 BOOLEAN 1155 fglmquot( ideal sourceIdeal, poly quot, ideal & destIdeal) 1156 { 1157 BOOLEAN fglmok; 1158 fglmVector v; 1159 1160 idealFunctionals L( 100, pVariables ); 1161 // STICKYPROT("calculating normal form\n"); 1162 // poly p = kNF( sourceIdeal, currRing->qideal, quot ); 1163 // STICKYPROT("calculating functionals\n"); 1164 fglmok = CalculateFunctionals( sourceIdeal, L, quot, v ); 1165 if ( fglmok == TRUE ) { 1166 // STICKYPROT("calculating groebner basis\n"); 1167 destIdeal= GroebnerViaFunctionals( L, v ); 1168 } 1169 return fglmok; 1170 } 1171 1172 BOOLEAN 1115 1173 FindUnivariateWrapper( ideal source, ideal & destIdeal ) 1116 1174 {
Note: See TracChangeset
for help on using the changeset viewer.