Changeset d2cd515 in git
- Timestamp:
- Oct 20, 2009, 12:39:18 PM (14 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- bb503c7363e3c90a3b0c5ae93374d5b7b20cc34a
- Parents:
- e9806890fa4b234b8c11d976584cab53f617eb21
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
re98068 rd2cd515 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.32 5 2009-10-09 13:46:30 seelischExp $ */4 /* $Id: extra.cc,v 1.326 2009-10-20 10:39:17 monerjan Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 3467 3467 if (strcmp(sys_cmd,"gfan")==0) 3468 3468 { 3469 if ((h==NULL) || (h!=NULL && h->Typ()!=IDEAL_CMD)) 3470 { 3471 Werror("system(\"gfan\"...) Ideal expected"); 3472 return TRUE; //Ooooops 3473 } 3474 ideal I=((ideal)h->Data()); 3475 res->rtyp=IDEAL_CMD; 3476 res->data=(ideal) gfan(I); 3469 // if ((h==NULL) || (h!=NULL && h->Typ()!=IDEAL_CMD)) 3470 // { 3471 // Werror("system(\"gfan\"...) Ideal expected"); 3472 // return TRUE; //Ooooops 3473 // } 3474 // else if(h->next==NULL) 3475 // { 3476 // Werror("gfan expects an integer parameter"); 3477 // return TRUE; 3478 // } 3479 // else if(h->next!=NULL && h->next->Typ()!=INT_CMD) 3480 // { 3481 // Werror("1st parameter ist no integer"); 3482 // return TRUE; 3483 // } 3484 /* 3485 heuristic: 3486 0 = keep all Gröbner bases in memory 3487 1 = write all Gröbner bases to disk and read whenever necessary 3488 2 = use a mixed heuristic, based on length of Gröbner bases 3489 */ 3490 if( h!=NULL && h->Typ()==IDEAL_CMD && h->next!=NULL && h->next->Typ()==INT_CMD) 3491 { 3492 int heuristic; 3493 heuristic=(int)(long)h->next->Data(); 3494 ideal I=((ideal)h->Data()); 3495 res->rtyp=IDEAL_CMD; 3496 res->data=(ideal) gfan(I,heuristic); 3497 return FALSE; 3498 } 3499 else 3500 { 3501 WerrorS("Usage: system(\"gfan\",I,int)"); 3502 return TRUE; 3503 } 3477 3504 //res->rtyp=LIST_CMD; 3478 3505 //res->data= ??? 3479 3506 3480 return FALSE; //Everything went fine3507 // return FALSE; //Everything went fine 3481 3508 } 3482 3509 else -
kernel/gfan.cc
re98068 rd2cd515 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-10- 19 15:40:39$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.9 7 2009-10-19 15:40:39monerjan Exp $6 $Id: gfan.cc,v 1.9 7 2009-10-19 15:40:39monerjan Exp $4 $Date: 2009-10-20 10:39:18 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.98 2009-10-20 10:39:18 monerjan Exp $ 6 $Id: gfan.cc,v 1.98 2009-10-20 10:39:18 monerjan Exp $ 7 7 */ 8 8 … … 1705 1705 1706 1706 /* Use pure SLA or writeCone2File */ 1707 enum heuristic {1708 ram,1709 hdd1710 };1711 heuristic h;1712 h=hdd;1707 // enum heuristic { 1708 // ram, 1709 // hdd 1710 // }; 1711 // heuristic h; 1712 // h=hdd; 1713 1713 1714 1714 #ifdef gfan_DEBUG … … 1830 1830 gcTmp->showFacets(1); 1831 1831 #endif 1832 if( h==hdd)1832 if(gfanHeuristic==1) 1833 1833 { 1834 1834 gcTmp->writeConeToFile(*gcTmp); … … 1886 1886 else if( gcNext->getUCN() == SearchListRoot->getUCN() ) 1887 1887 {//NOTE: Implement heuristic to be used! 1888 if( h==ram)1888 if(gfanHeuristic==0) 1889 1889 { 1890 1890 gcAct = gcNext; … … 1894 1894 break; 1895 1895 } 1896 else if( h==hdd)1896 else if(gfanHeuristic==1) 1897 1897 { 1898 1898 //Read st00f from file … … 2561 2561 while(!line.empty()) 2562 2562 { 2563 hasNegCoeff = FALSE; 2563 2564 found = line.find_first_of("+-"); //get the first monomial 2564 2565 string tmp; … … 2579 2580 { 2580 2581 hasCoeffInQ = TRUE; 2581 strCoeffNom=strMonom.substr(0,found); 2582 strCoeffDenom=strMonom.substr(found+1,strMonom.find_first_not_of("1234567890"));//string::npos); 2583 ss << strCoeffNom; 2584 ss >> intCoeffNom; 2585 nCoeffNom=nInit(intCoeffNom); 2586 ss << strCoeffDenom; 2587 ss >> intCoeffDenom; 2588 nCoeffDenom=nInit(intCoeffDenom); 2582 strCoeffNom=strMonom.substr(0,found); 2583 strCoeffDenom=strMonom.substr(found+1,strMonom.find_first_not_of("1234567890")); 2584 strMonom.erase(0,found); 2585 strMonom.erase(0,strMonom.find_first_not_of("1234567890/")); 2586 // ss << strCoeffNom; 2587 // ss >> intCoeffNom; 2588 // nCoeffNom=(snumber*)strCoeffNom.c_str(); 2589 nRead(strCoeffNom.c_str(), &nCoeffNom); 2590 nRead(strCoeffDenom.c_str(), &nCoeffDenom); 2591 // nCoeffNom=nInit(intCoeffNom); 2592 // ss << strCoeffDenom; 2593 // ss >> intCoeffDenom; 2594 // nCoeffDenom=nInit(intCoeffDenom); 2595 // nCoeffDenom=(snumber*)strCoeffNom.c_str(); 2589 2596 //NOTE NOT SURE WHETHER THIS WILL WORK! 2590 2597 //nCoeffNom=nInit(intCoeffNom); … … 2598 2605 if(!strCoeff.empty()) 2599 2606 { 2600 // ss << strCoeff; 2601 // ss >> intCoeff; 2602 nCoeff=(snumber*)strCoeff.c_str(); 2607 nRead(strCoeff.c_str(),&nCoeff); 2603 2608 } 2604 2609 else … … 2616 2621 case TRUE: 2617 2622 if(hasNegCoeff) 2618 nCoeff =nNeg(nCoeffNom);2623 nCoeffNom=nNeg(nCoeffNom); 2619 2624 // intCoeffNom *= -1; 2620 2625 // pSetCoeff(strPoly, nDiv((number)intCoeffNom, (number)intCoeffDenom)); 2621 2626 pSetCoeff(strPoly, nDiv(nCoeffNom, nCoeffDenom)); 2627 break; 2622 2628 case FALSE: 2623 2629 if(hasNegCoeff) … … 2631 2637 pSetCoeff(strPoly, nCoeff ); 2632 2638 } 2639 break; 2633 2640 2634 2641 } … … 2655 2662 2656 2663 int gcone::counter=0; 2657 2658 ideal gfan(ideal inputIdeal )2664 int gfanHeuristic; 2665 ideal gfan(ideal inputIdeal, int h) 2659 2666 { 2660 2667 int numvar = pVariables; 2668 gfanHeuristic = h; 2661 2669 2662 2670 enum searchMethod { -
kernel/gfan.h
re98068 rd2cd515 3 3 4 4 $Author: monerjan $ 5 $Date: 2009-10- 13 14:35:18 $6 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.h,v 1.1 0 2009-10-13 14:35:18 monerjan Exp $7 $Id: gfan.h,v 1.1 0 2009-10-13 14:35:18 monerjan Exp $5 $Date: 2009-10-20 10:39:18 $ 6 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.h,v 1.11 2009-10-20 10:39:18 monerjan Exp $ 7 $Id: gfan.h,v 1.11 2009-10-20 10:39:18 monerjan Exp $ 8 8 */ 9 9 #ifdef HAVE_GFAN … … 16 16 #include "../../cddlib/include/cddmp.h" 17 17 #endif 18 extern int gfanHeuristic; 18 19 //ideal getGB(ideal inputIdeal); 19 ideal gfan(ideal inputIdeal );20 ideal gfan(ideal inputIdeal, int heuristic); 20 21 //int dotProduct(intvec a, intvec b); 21 22 //bool isParallel(intvec a, intvec b);
Note: See TracChangeset
for help on using the changeset viewer.