Changeset 64b6c6 in git
- Timestamp:
- Sep 13, 2010, 2:46:28 PM (13 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- ce35eb186c60fc2922d2d106228a4d3a2cb87a5b
- Parents:
- c292b2f02aae398d9441027fcf6031ee977365e1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
rc292b2 r64b6c6 62 62 63 63 #ifdef p800 64 #include <../ cddlib/include/setoper.h>65 #include <../ cddlib/include/cdd.h>66 #include <../ cddlib/include/cddmp.h>64 #include <../../cddlib/include/setoper.h> 65 #include <../../cddlib/include/cdd.h> 66 #include <../../cddlib/include/cddmp.h> 67 67 #endif 68 68 … … 3036 3036 { 3037 3037 facet *SearchListRoot = new facet(); //The list containing ALL facets we come across 3038 // vector<facet> stlRoot;3039 3038 facet *SearchListAct; 3040 3039 SearchListAct = NULL; 3041 //SearchListAct = SearchListRoot; 3042 3040 //SearchListAct = SearchListRoot; 3043 3041 gcone *gcAct; 3044 3042 gcAct = &gcRoot; … … 3048 3046 gcNext = &gcRoot; 3049 3047 gcone *gcHead; 3050 gcHead = &gcRoot; 3051 3048 gcHead = &gcRoot; 3052 3049 facet *fAct; 3053 fAct = gcAct->facetPtr; 3054 3050 fAct = gcAct->facetPtr; 3055 3051 ring rAct; 3056 3052 rAct = currRing; 3057 3058 int UCNcounter=gcAct->getUCN(); 3059 3053 int UCNcounter=gcAct->getUCN(); 3060 3054 #ifdef gfan_DEBUG 3061 3055 printf("NoRevs\n"); … … 3068 3062 dd_LinealitySpace = gcAct->computeLinealitySpace(); 3069 3063 /*End of lineality space computation*/ 3070 //gcAct->getCodim2Normals(*gcAct);3064 //gcAct->getCodim2Normals(*gcAct); 3071 3065 if(fAct->codim2Ptr==NULL) 3072 gcAct->getExtremalRays(*gcAct); 3073 3074 //Compute unique representation of Facets and rays, i.e. primitive vectors 3075 // gcAct->normalize(); 3076 3066 gcAct->getExtremalRays(*gcAct); 3077 3067 /* Make a copy of the facet list of first cone 3078 3068 Since the operations getCodim2Normals and normalize affect the facets … … 3090 3080 if( ii==0 || (ii>0 && SearchListAct==NULL) ) //1st facet may be non-flippable 3091 3081 { 3092 if(SearchListRoot!=NULL) 3093 delete(SearchListRoot); 3082 if(SearchListRoot!=NULL) delete(SearchListRoot); 3094 3083 SearchListRoot = fAct->shallowCopy(*fAct); 3095 3084 SearchListAct = SearchListRoot; //SearchListRoot is already 'new'ed at beginning of method! … … 3119 3108 SearchListAct->isFlippable=TRUE; 3120 3109 //Copy int point as well 3121 int64vec *ivIntPt; // = new int64vec(this->numVars);3110 int64vec *ivIntPt; 3122 3111 ivIntPt = fAct->getInteriorPoint(); 3123 3112 SearchListAct->setInteriorPoint(ivIntPt); … … 3131 3120 SearchListAct->codim2Ptr = new facet(2); 3132 3121 sl2Root = SearchListAct->codim2Ptr; 3133 sl2Act = sl2Root; 3134 //while(codim2Act!=NULL) 3122 sl2Act = sl2Root; 3135 3123 for(int jj=0;jj<fAct->numCodim2Facets;jj++) 3136 3124 // for(int jj=0;jj<fAct->numRays-1;jj++) … … 3176 3164 if(SearchListAct->next!=NULL){ 3177 3165 #endif 3178 // if(SearchListAct->next!=NULL)3179 // {3180 3166 SearchListAct->next->prev = SearchListAct; 3181 3167 } … … 3202 3188 //NOTE rCopy needed? 3203 3189 ring rTmp=rCopy(fAct->flipRing); 3204 // ring rTmp=fAct->flipRing; //segfaults3205 3190 rComplete(rTmp); 3206 3191 rChangeCurrRing(rTmp); … … 3215 3200 */ 3216 3201 idDelete((ideal *)&fAct->flipGB); 3217 rDelete(fAct->flipRing); 3218 3219 gcTmp->getConeNormals(gcTmp->gcBasis/*, FALSE*/); //TODO FALSE is default, so should not be needed here 3202 rDelete(fAct->flipRing); 3203 gcTmp->getConeNormals(gcTmp->gcBasis/*, FALSE*/); 3220 3204 // gcTmp->getCodim2Normals(*gcTmp); 3221 3205 gcTmp->getExtremalRays(*gcTmp); … … 3233 3217 /*add facets to SLA here*/ 3234 3218 #ifdef SHALLOW 3235 // printf("fActUCN before enq2: %i\n",fAct->getUCN()); 3236 facet *tmp; tmp=gcTmp->enqueue2(SearchListRoot); 3237 // printf("\nheadUCN=%i\n",tmp->getUCN()); 3238 // printf("fActUCN after enq2: %i\n",fAct->getUCN()); 3219 #ifdef gfan_DEBUG 3220 printf("fActUCN before enq2: %i\n",fAct->getUCN()); 3221 #endif 3222 facet *tmp; 3223 tmp=gcTmp->enqueue2(SearchListRoot); 3224 #ifdef gfan_DEBUG 3225 printf("\nheadUCN=%i\n",tmp->getUCN()); 3226 printf("fActUCN after enq2: %i\n",fAct->getUCN()); 3227 #endif 3239 3228 SearchListRoot=tmp; 3240 //SearchListRoot=gcTmp->enqueue2/*NewFacets*/(SearchListRoot);3241 #else 3229 //SearchListRoot=gcTmp->enqueue2/*NewFacets*/(SearchListRoot); 3230 #else 3242 3231 SearchListRoot=gcTmp->enqueueNewFacets(SearchListRoot); 3243 #endif 3232 #endif //ifdef SHALLOW 3244 3233 gcTmp->writeConeToFile(*gcTmp); 3245 3234 if(gfanHeuristic==1) 3246 3235 { 3247 // gcTmp->writeConeToFile(*gcTmp);3248 3236 idDelete((ideal*)&gcTmp->gcBasis);//Whonder why? 3249 3237 rDelete(gcTmp->baseRing); … … 3350 3338 void gcone::makeInt(const dd_MatrixPtr &M, const int line, int64vec &n) 3351 3339 { 3352 // mpz_t denom[this->numVars];3353 3340 mpz_t *denom = new mpz_t[this->numVars]; 3354 3341 for(int ii=0;ii<this->numVars;ii++) … … 3390 3377 mpq_set_num(qkgV,kgV); 3391 3378 3392 // 3379 // mpq_canonicalize(qkgV); 3393 3380 // int ggT=1; 3394 3381 for (int ii=0;ii<(M->colsize)-1;ii++) … … 3401 3388 for(int ii=0;ii<this->numVars;ii++) 3402 3389 ggT=int64gcd(ggT,n[ii]); 3403 //Normali zation3390 //Normalisation 3404 3391 if(ggT>1) 3405 3392 { … … 3514 3501 * If slAct->next==NULL AND maybe==TRUE we know, that fAct must be added 3515 3502 */ 3516 // volatile bool maybe=FALSE; 3503 3517 3504 /**A facet was removed, lengthOfSearchlist-- thus we must not rely on 3518 3505 * if(notParallelCtr==lengthOfSearchList) but rather … … 3520 3507 */ 3521 3508 volatile bool removalOccured=FALSE; 3522 // int ctr=0; //encountered equalities in SLA3523 // int notParallelCtr=0;3524 // gcone::lengthOfSearchList=1;3525 3509 while(slEnd->next!=NULL) 3526 3510 { 3527 3511 slEnd=slEnd->next; 3528 // gcone::lengthOfSearchList++;3529 3512 } 3530 3513 /*1st step: compare facetNormals*/ … … 3536 3519 fNormal=fAct->getFacetNormal(); 3537 3520 slAct = slHead; 3538 //notParallelCtr=0;3539 3521 /*If slAct==NULL and fAct!=NULL 3540 3522 we just copy all remaining facets into SLA*/ … … 3689 3671 }//addC2N 3690 3672 3691 /** Tryusing shallow copies*/3673 /** Enqueuing using shallow copies*/ 3692 3674 facet * gcone::enqueue2(facet *f) 3693 3675 { … … 3709 3691 facet *codim2Act; 3710 3692 codim2Act = this->facetPtr->codim2Ptr; 3711 // facet *sl2Act;3712 // sl2Act = f->codim2Ptr;3713 3693 volatile bool removalOccured=FALSE; 3714 3694 while(slEnd->next!=NULL) … … 3744 3724 fCopy = fCopy->next; 3745 3725 } 3746 break; 3726 break; //WTF? 3747 3727 } 3748 3728 /*Comparison starts here*/ … … 3767 3747 } 3768 3748 fDeleteMarker->shallowDelete(); 3769 //delete fDeleteMarker;//NOTE this messes up fAct in noRevS!3749 //delete fDeleteMarker;//NOTE this messes up fAct in noRevS! 3770 3750 // printf("headUCN@enq=%i\n",slHead->getUCN()); 3771 3751 } … … 3775 3755 slEnd->next = NULL; 3776 3756 fDeleteMarker->shallowDelete(); 3777 //delete(fDeleteMarker);3757 delete(fDeleteMarker); 3778 3758 } 3779 3759 else … … 3782 3762 slAct->next->prev = slAct->prev; 3783 3763 fDeleteMarker->shallowDelete(); 3784 //delete(fDeleteMarker);3764 delete(fDeleteMarker); 3785 3765 } 3786 3766 removalOccured=TRUE; … … 3789 3769 printf("Removing (");fAct->fNormal->show(1,1);printf(") from list\n"); 3790 3770 #endif 3791 /*fDeleteMarker->shallowDelete();*///Sets everything to NULL3792 // delete(fDeleteMarker);3793 3771 break;//leave the while loop, since we found fAct=slAct thus delete slAct and do not add fAct 3794 3772 } … … 3855 3833 replacementRing->order[2]=ringorder_C; 3856 3834 3857 int64vec *ivw = this->getIntPoint(TRUE); 3835 int64vec *ivw = this->getIntPoint(TRUE);//returns a reference 3858 3836 // assert(this->ivIntPt); 3859 3837 int length=ivw->length(); … … 3864 3842 if((*ivw)[jj]>=INT_MAX) WarnS("A[jj] exceeds INT_MAX in gcone::replaceDouble_ringorder_a_ByASingleOne!\n"); 3865 3843 } 3866 // delete ivw; 3844 //delete ivw; //Not needed if this->getIntPoint(TRUE) 3867 3845 replacementRing->wvhdl[0]=(int *)A; 3868 3846 replacementRing->block1[0]=length; … … 3873 3851 rDelete(this->baseRing); 3874 3852 this->baseRing=rCopy(replacementRing); 3875 this->gcBasis=idCopy(temporaryGroebnerBasis); 3876 //FIXME idDelete & rDelete!!! DONE! 3853 this->gcBasis=idCopy(temporaryGroebnerBasis); 3877 3854 /*And back to where we came from*/ 3878 3855 rChangeCurrRing(srcRing); … … 3972 3949 filename.append(UCNstr); 3973 3950 filename.append(suffix); 3974 3975 3951 3976 3952 // int thisPID = getpid(); 3977 3953 // ss << thisPID; … … 4016 3992 for (int ii=0;ii<iv->length();ii++) 4017 3993 { 4018 if (ii<iv->length()-1) 4019 { 4020 gcOutputFile << (*iv)[ii] << ","; 4021 } 4022 else 4023 { 4024 gcOutputFile << (*iv)[ii] << " "; 4025 } 3994 // if (ii<iv->length()-1) 3995 // gcOutputFile << (*iv)[ii] << ","; 3996 // else 3997 // gcOutputFile << (*iv)[ii] << " "; 3998 gcOutputFile << (*iv)[ii]; 3999 (ii<iv->length()-1) ? gcOutputFile << "," : gcOutputFile << " "; 4026 4000 } 4027 //delete iv;4001 //delete iv; 4028 4002 while(f2Act!=NULL) 4029 4003 { 4030 4004 const int64vec *iv2; 4031 iv2=f2Act->getRef2FacetNormal(); //->getFacetNormal();4005 iv2=f2Act->getRef2FacetNormal(); 4032 4006 for(int jj=0;jj<iv2->length();jj++) 4033 4007 { 4034 if (jj<iv2->length()-1) 4035 { 4036 gcOutputFile << (*iv2)[jj] << ","; 4037 } 4038 else 4039 { 4040 gcOutputFile << (*iv2)[jj] << " "; 4041 } 4008 // if (jj<iv2->length()-1) 4009 // gcOutputFile << (*iv2)[jj] << ","; 4010 // else 4011 // gcOutputFile << (*iv2)[jj] << " "; 4012 gcOutputFile << (*iv2)[jj]; 4013 (jj<iv2->length()-1) ? gcOutputFile << "," : gcOutputFile << " "; 4042 4014 } 4043 // delete iv2;4044 4015 f2Act = f2Act->next; 4045 4016 } … … 4065 4036 string UCNstr = ss.str(); 4066 4037 int gcBasisLength=0; 4067 size_t found; 4038 size_t found; //used for find_first_(not)_of 4068 4039 4069 4040 string prefix="/tmp/Singular/cone"; … … 4411 4382 } 4412 4383 fAct = fAct->next; 4413 // delete fNormal;4414 4384 } 4415 4385 return *res; … … 4474 4444 gcAct = gcRoot; 4475 4445 gcone::numVars=pVariables; 4476 //gcAct->numVars=pVariables;//NOTE is now static4446 //gcAct->numVars=pVariables;//NOTE is now static 4477 4447 gcAct->getGB(inputIdeal); 4478 4448 /*Check whether input is homogeneous … … 4500 4470 dd_free_global_constants(); 4501 4471 //This is filthy 4502 goto pointOfNoReturn; 4503 //return lResList; 4472 goto pointOfNoReturn; 4504 4473 } 4505 4474 gcAct->getConeNormals(gcAct->gcBasis); … … 4530 4499 //Simply return an empty list 4531 4500 WerrorS("Ring has non-global ordering.\nThis function requires your current ring to be endowed with a global ordering.\n Now terminating!"); 4532 gcone *gcRoot=new gcone();4533 gcone *gcPtr = gcRoot;4534 for(int ii=0;ii<10000;ii++)4535 {4536 gcPtr->setBaseRing(currRing);4537 facet *fPtr=gcPtr->facetPtr=new facet();4538 for(int jj=0;jj<5;jj++)4539 {4540 int64vec *iv=new int64vec(pVariables);4541 fPtr->setFacetNormal(iv);4542 delete(iv);4543 fPtr->next=new facet();4544 fPtr=fPtr->next;4545 }4546 gcPtr->next=new gcone();4547 gcPtr->next->prev=gcPtr;4548 gcPtr=gcPtr->next;4549 }4550 gcPtr=gcRoot;4551 while(gcPtr!=NULL)4552 {4553 gcPtr=gcPtr->next;4554 // delete(gcPtr->prev);4555 }4501 // gcone *gcRoot=new gcone(); 4502 // gcone *gcPtr = gcRoot; 4503 // for(int ii=0;ii<10000;ii++) 4504 // { 4505 // gcPtr->setBaseRing(currRing); 4506 // facet *fPtr=gcPtr->facetPtr=new facet(); 4507 // for(int jj=0;jj<5;jj++) 4508 // { 4509 // int64vec *iv=new int64vec(pVariables); 4510 // fPtr->setFacetNormal(iv); 4511 // delete(iv); 4512 // fPtr->next=new facet(); 4513 // fPtr=fPtr->next; 4514 // } 4515 // gcPtr->next=new gcone(); 4516 // gcPtr->next->prev=gcPtr; 4517 // gcPtr=gcPtr->next; 4518 // } 4519 // gcPtr=gcRoot; 4520 // while(gcPtr!=NULL) 4521 // { 4522 // gcPtr=gcPtr->next; 4523 // // delete(gcPtr->prev); 4524 // } 4556 4525 goto pointOfNoReturn; 4557 4526 } … … 4559 4528 #ifdef gfanp 4560 4529 cout << endl << "t_getConeNormals:" << gcone::time_getConeNormals << endl; 4561 //cout << "t_getCodim2Normals:" << gcone::time_getCodim2Normals << endl;4562 //cout << " t_ddMC:" << gcone::t_ddMC << endl;4563 //cout << " t_mI:" << gcone::t_mI << endl;4564 // cout << " t_iP:" << gcone::t_iP << endl; 4530 /*cout << "t_getCodim2Normals:" << gcone::time_getCodim2Normals << endl; 4531 cout << " t_ddMC:" << gcone::t_ddMC << endl; 4532 cout << " t_mI:" << gcone::t_mI << endl; 4533 cout << " t_iP:" << gcone::t_iP << endl;*/ 4565 4534 cout << "t_getExtremalRays:" << gcone::t_getExtremalRays << endl; 4566 4535 cout << " t_ddPolyh:" << gcone::t_ddPolyh << endl;
Note: See TracChangeset
for help on using the changeset viewer.