Changeset a9fa92 in git
- Timestamp:
- Apr 2, 2009, 11:44:23 AM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- f6c6b01d649bc867417af16dfdfc71c7a9785e8d
- Parents:
- 95a5d329460059206ad840fd798ce5fe36656f1f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r95a5d3 ra9fa92 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-04-0 1 14:07:20$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.2 6 2009-04-01 14:07:20monerjan Exp $6 $Id: gfan.cc,v 1.2 6 2009-04-01 14:07:20monerjan Exp $4 $Date: 2009-04-02 09:44:23 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.27 2009-04-02 09:44:23 monerjan Exp $ 6 $Id: gfan.cc,v 1.27 2009-04-02 09:44:23 monerjan Exp $ 7 7 */ 8 8 … … 68 68 /** Stores the facet normal \param intvec*/ 69 69 void setFacetNormal(intvec *iv){ 70 fNormal = iv;70 this->fNormal = ivCopy(iv); 71 71 //return; 72 } 73 74 /** Hopefully returns the facet normal */ 75 intvec *getFacetNormal() 76 { 77 //this->fNormal->show(); cout << endl; 78 return this->fNormal; 72 79 } 73 80 … … 250 257 #endif 251 258 /*The pointer *fRoot should be the return value of this function*/ 252 facet *fRoot = new facet(); //instantiate new facet with intvec with numvar rows, one column and initial values all 0253 facetPtr = fRoot; //set variable facetPtr of class gcone to first facet259 facet *fRoot = new facet(); //instantiate new facet 260 this->facetPtr = fRoot; //set variable facetPtr of class gcone to first facet 254 261 facet *fAct; //instantiate pointer to active facet 255 262 fAct = fRoot; //This does not seem to do the trick. fRoot and fAct have to point to the same adress! … … 269 276 if (jj<ddcols) //Is this facet NOT the last facet? Writing while instead of if is a really bad idea :) 270 277 { 271 fAct->next = new facet(); //If so: instantiate new facet. Otherwise this->next=NULL due to the constructor 272 fAct = fAct->next; //scary :) 278 fAct->next = new facet(); //If so: instantiate new facet. Otherwise this->next=NULL due to the constructor 273 279 } 274 280 }//for jj<ddcols … … 276 282 fAct->setFacetNormal(load); 277 283 fAct->printNormal(); 284 fAct=fAct->next; //this should definitely not be called in the above while-loop :D 285 delete load; 278 286 } 279 287 /* … … 312 320 void flip(ideal gb, facet *f) //Compute "the other side" 313 321 { 314 intvec fNormal; //facet normal, check for parallelity 315 /* EXTREMELY EXPERIMENTAL CODE AHEAD*/ 322 323 intvec *fNormal = new intvec(this->numVars); //facet normal, check for parallelity 324 fNormal = f->getFacetNormal(); //read this->fNormal; 325 fNormal->show(); 326 327 bool isParallel=TRUE; 328 double lambda=0; 329 double lambda_temp=lambda; 330 /* EXTREMELY EXPERIMENTAL CODE AHEAD - NUMERICAL INSTABILITIES GUARANTEED DUE TO DIVISONS*/ 316 331 /*1st step: Compute the initial ideal*/ 317 332 poly initialForm[IDELEMS(gb)]; //array of #polys in GB to store initial form 318 333 poly aktpoly; 319 334 int check[this->numVars]; //array to store the difference of LE and v 335 320 336 for (int ii=0;ii<IDELEMS(gb);ii++) 321 337 { 322 aktpoly = (poly)gb->m[ii]; 338 aktpoly = (poly)gb->m[ii]; 323 339 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int)); 324 340 int *leadExpV=(int *)omAlloc((this->numVars+1)*sizeof(int)); 341 intvec *iv=(intvec *)omAlloc((this->numVars+1)*sizeof(intvec)); //let's try this 342 intvec *ivLeadExpV=(intvec *)omAlloc((this->numVars+1)*sizeof(intvec)); 325 343 pGetExpV(aktpoly,leadExpV); //find the leading exponent in leadExpV[1],...,leadExpV[n], use pNext(p) 344 //pGetExpV(aktpoly,ivLeadExpV); 326 345 initialForm[ii]=pHead(aktpoly); 346 327 347 while(pNext(aktpoly)!=NULL) /*loop trough terms and check for parallelity*/ 328 348 { 329 349 aktpoly=pNext(aktpoly); //next term 330 350 pGetExpV(aktpoly,v); 351 331 352 for (int i=0;i<pVariables;i++) 332 353 { 333 354 check[i] = v[i]-leadExpV[i]; 355 cout << "check["<<i<<"]="<<check[i]<<endl; 334 356 } 335 if (isParallel(*check,fNormal)) //pass *check when 357 lambda=check[0]/(*fNormal)[0]; 358 lambda_temp=lambda; 359 cout << "lambda="<<lambda<<endl; 360 for (int i=0;i<pVariables;i++) 336 361 { 362 lambda_temp=check[i]/(*fNormal)[i]; 363 cout<<"lambda_temp="<<lambda_temp<<endl; 364 if (lambda_temp!=lambda) 365 { 366 isParallel=FALSE; 367 } 368 } 369 if (isParallel==TRUE) //pass *check when 370 { 371 cout << "PARALLEL" << endl; 337 372 //initialForm[ii] += pHead(aktpoly); //This should add the respective term to 338 373 } … … 417 452 gcAct->getGB(inputIdeal); 418 453 gcAct->getConeNormals(gcAct->gcBasis); //hopefully compute the normals 419 454 gcAct->flip(gcAct->gcBasis,gcAct->facetPtr); 420 455 /*Now it is time to compute the search facets, respectively start the reverse search. 421 456 But since we are in the root all facets should be search facets. IS THIS TRUE?
Note: See TracChangeset
for help on using the changeset viewer.