Changeset d7ce08d in git
- Timestamp:
- May 28, 2009, 8:27:09 AM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- 8528c1f5019b974a855d99986bbb557fb8d66ff1
- Parents:
- a795c77a2788b17b019279e7ee8ba39e3a523d5f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
ra795c77 rd7ce08d 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-05-2 0 09:46:43$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.5 5 2009-05-20 09:46:43monerjan Exp $6 $Id: gfan.cc,v 1.5 5 2009-05-20 09:46:43monerjan Exp $4 $Date: 2009-05-28 06:27:09 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.56 2009-05-28 06:27:09 monerjan Exp $ 6 $Id: gfan.cc,v 1.56 2009-05-28 06:27:09 monerjan Exp $ 7 7 */ 8 8 … … 84 84 * facet::flibGB is set via facet::setFlipGB() and printed via facet::printFlipGB 85 85 */ 86 ideal flipGB; //The Groebner Basis on the other side, computed via gcone::flip 87 86 ideal flipGB; //The Groebner Basis on the other side, computed via gcone::flip 88 87 89 88 public: … … 91 90 bool isIncoming; //Is the facet incoming or outgoing? 92 91 facet *next; //Pointer to next facet 93 intvec *codim2Normals; //Integer matrix containing the (codim-2)-facets 92 //intvec **codim2Normals =(intvec**)omAlloc0(sizeof(intvec*)); //Integer matrix containing the (codim-2)-facets 93 struct c2N{ 94 intvec normal; 95 intvec *next; 96 }; 94 97 95 98 /** The default constructor. Do I need a constructor of type facet(intvec)? */ … … 100 103 this->next=NULL; 101 104 this->UCN=NULL; 102 this->codim2Normals=NULL;105 //this->codim2Normals=NULL; 103 106 } 104 107 … … 544 547 interiorPoint(ddineq, *iv); //NOTE ddineq contains non-flippable facets 545 548 this->setIntPoint(iv); //stores the interior point in gcone::ivIntPt 546 delete iv;549 //delete iv; 547 550 } 548 551 … … 551 554 552 555 //Clean up but don't delete the return value! (Whatever it will turn out to be) 553 dd_FreeMatrix(ddineq);554 set_free(ddredrows);555 free(ddnewpos);556 set_free(ddlinset);556 //dd_FreeMatrix(ddineq); 557 //set_free(ddredrows); 558 //free(ddnewpos); 559 //set_free(ddlinset); 557 560 //NOTE Commented out. Solved the bug that after facet2Matrix there were facets lost 558 561 //THIS SUCKS 559 dd_free_global_constants();562 //dd_free_global_constants(); 560 563 561 564 }//method getConeNormals(ideal I) … … 1432 1435 { 1433 1436 intvec *n = new intvec(this->numVars); 1434 n = normalize(P,jj); 1435 //fAct->addCodim2Facet(n); 1437 normalize(P,jj,*n); 1438 //fAct->addCodim2Facet(n); 1439 n->show(); 1440 delete n; 1436 1441 } 1437 1442 … … 1460 1465 }//void noRevS(gcone &gc) 1461 1466 1462 intvec *normalize(dd_MatrixPtr const &M, int line)1467 void normalize(dd_MatrixPtr const &M, int line, intvec &n) 1463 1468 { 1464 1469 mpz_t denom[this->numVars]; … … 1471 1476 mpz_init(kgV); 1472 1477 mpz_init(tmp); 1473 intvec *ivres = new intvec(this->numVars); 1478 //intvec *ivres = new intvec(this->numVars); 1479 // intvec ivres(this->numVars); 1474 1480 1475 1481 for (int ii=0;ii<(M->colsize)-1;ii++) … … 1480 1486 //mpz_out_str(stdout,10,z); 1481 1487 mpz_set( denom[ii], z); 1482 //mpz_clear(z);1488 mpz_clear(z); 1483 1489 } 1484 1490 /*Compute lcm of the denominators*/ … … 1486 1492 for (int ii=0;ii<(M->colsize)-1;ii++) 1487 1493 { 1488 mpz_lcm(kgV,tmp,denom[ii +1]);1494 mpz_lcm(kgV,tmp,denom[ii]); 1489 1495 } 1490 1496 /*Multiply the nominators by kgV*/ 1491 1497 mpq_t qkgV,res; 1492 1498 mpq_init(qkgV); 1499 // mpq_canonicalize(qkgV); 1500 mpq_set_str(qkgV,"1",10); 1501 // mpq_canonicalize(qkgV); 1493 1502 mpq_init(res); 1494 mpq_set_z(qkgV,kgV); 1503 mpq_set_str(res,"1",10); 1504 // mpq_canonicalize(res); 1505 //mpq_set_z(qkgV,kgV); 1506 mpq_set_num(qkgV,kgV); 1507 //mpq_set_den(qkgV,1); 1508 // mpq_canonicalize(qkgV); 1495 1509 for (int ii=0;ii<(M->colsize)-1;ii++) 1496 1510 { 1497 1511 mpq_mul(res,qkgV,M->matrix[line-1][ii+1]); 1498 (*ivres)[ii]=(int)mpz_get_d(mpq_numref(res)); 1512 // (*ivres)[ii]=(int)mpz_get_d(mpq_numref(res)); 1513 n[ii]=(int)mpz_get_d(mpq_numref(res)); 1499 1514 } 1500 1515 //mpz_clear(denom[this->numVars]); 1501 //mpz_clear(kgV);1502 //mpq_clear(qkgV); mpq_clear(res);1503 1504 return ivres;1516 mpz_clear(kgV); 1517 mpq_clear(qkgV); mpq_clear(res); 1518 1519 //return ivres; 1505 1520 } 1506 1521
Note: See TracChangeset
for help on using the changeset viewer.