Changeset 7d10b3 in git
- Timestamp:
- May 19, 2009, 5:49:04 PM (15 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 7853542cfd96856d73fbeb9148ebfe5b4637561b
- Parents:
- a0e0a80f7016d7e5784251e3e3e4a6b26ae2f3fb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
ra0e0a80 r7d10b3 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-05-1 8 15:11:53$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.5 3 2009-05-18 15:11:53monerjan Exp $6 $Id: gfan.cc,v 1.5 3 2009-05-18 15:11:53monerjan Exp $4 $Date: 2009-05-19 15:49:04 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.54 2009-05-19 15:49:04 monerjan Exp $ 6 $Id: gfan.cc,v 1.54 2009-05-19 15:49:04 monerjan Exp $ 7 7 */ 8 8 … … 89 89 bool isIncoming; //Is the facet incoming or outgoing? 90 90 facet *next; //Pointer to next facet 91 intvec *codim2Normals; 91 intvec *codim2Normals; //Integer matrix containing the (codim-2)-facets 92 92 93 93 /** The default constructor. Do I need a constructor of type facet(intvec)? */ … … 97 97 /* Defaults to NULL. This way there is no need to check explicitly */ 98 98 this->next=NULL; 99 this->UCN=NULL; 100 this->codim2Normals=NULL; 99 101 } 100 102 … … 325 327 intvec *iv = new intvec(this->numVars); 326 328 327 while (f !=NULL)329 while (f->next!=NULL) 328 330 { 329 331 iv = f->getFacetNormal(); … … 1395 1397 dd_ErrorType err; 1396 1398 dd_rowindex newpos; 1399 1400 fAct = fListPtr; 1397 1401 1398 1402 #ifdef gfan_DEBUG … … 1406 1410 /*Now set appropriate linearity*/ 1407 1411 dd_PolyhedraPtr ddpolyh; 1408 for (int ii=0; ii< ddineq->rowsize; ii++)1412 for (int ii=0; ii<this->numFacets; ii++) 1409 1413 { 1410 1414 cout << "------------" << endl; 1411 1415 ddakt = dd_CopyMatrix(ddineq); 1412 1416 set_addelem(ddakt->linset,ii+1); 1413 // dd_WriteMatrix(stdout,ddakt);1414 1417 1415 1418 dd_MatrixCanonicalize(&ddakt, &impl_linset, &redset, &newpos, &err); … … 1420 1423 dd_WriteMatrix(stdout,P); 1421 1424 1425 /* We loop through each row of P 1426 * normalize it by making all entries integer ones 1427 * and add the resulting vector to the int matrix facet::codim2Facets 1428 */ 1429 for (int jj=1;jj<=P->rowsize;jj++) 1430 { 1431 intvec *n = new intvec(this->numVars); 1432 n = normalize(P,jj); 1433 //fAct->addCodim2Facet(n); 1434 } 1435 1422 1436 //intvec *load = new intvec(this->numVars); 1423 1437 … … 1428 1442 1429 1443 } 1430 #ifdef gfan_DEBUG 1431 cout << "Before writeConeToFile" << endl; 1432 gc.showFacets(); 1433 #endif 1434 1444 1435 1445 1436 1446 //NOTE Hm, comment in and get a crash for free... 1437 1447 //dd_free_global_constants(); 1438 1448 gc.writeConeToFile(gc); 1439 #ifdef gfan_DEBUG1440 cout << "After writeConeToFile" << endl;1441 gc.showFacets();1442 #endif1443 1449 1444 1450 /*2nd step … … 1452 1458 }//void noRevS(gcone &gc) 1453 1459 1454 /** \brief Construct a ddMatrix from a cone's list of facets 1460 intvec *normalize(dd_MatrixPtr const &M, int line) 1461 { 1462 mpz_t denom[this->numVars]; 1463 for(int ii=0;ii<this->numVars;ii++) 1464 { 1465 mpz_init_set_str(denom[ii],"0",10); 1466 } 1467 1468 mpz_t kgV; 1469 mpz_init(kgV); 1470 intvec *ivres = new intvec(this->numVars); 1471 1472 for (int ii=0;ii<(M->colsize)-1;ii++) 1473 { 1474 mpz_t z; 1475 mpz_init(z); 1476 mpq_get_den(z,M->matrix[line-1][ii+1]); 1477 //mpz_out_str(stdout,10,z); 1478 mpz_set( denom[ii], z); 1479 mpz_clear(z); 1480 } 1481 /*Compute lcm of the denominators*/ 1482 mpz_set(kgV,denom[0]); 1483 for (int ii=0;ii<(M->colsize)-1;ii++) 1484 { 1485 mpz_lcm(kgV,kgV,denom[ii+1]); 1486 } 1487 /*Multiply the nominators by kgV*/ 1488 mpq_t qkgV,res; 1489 mpq_init(qkgV); 1490 mpq_init(res); 1491 mpq_set_z(qkgV,kgV); 1492 for (int ii=0;ii<(M->colsize)-1;ii++) 1493 { 1494 mpq_mul(res,qkgV,M->matrix[line-1][ii+1]); 1495 (*ivres)[ii]=(int)mpz_get_d(mpq_numref(res)); 1496 } 1497 return ivres; 1498 } 1499 1500 /** \brief Construct a dd_MatrixPtr from a cone's list of facets 1455 1501 * 1456 1502 */ … … 1459 1505 facet *fAct = new facet(); 1460 1506 fAct = gc.facetPtr; 1461 #ifdef gfan_DEBUG 1462 cout << "gcFacetPtr is at" << &gc.facetPtr << endl; 1463 cout << "fAct is at" << &fAct << endl; 1464 #endif 1507 1465 1508 dd_MatrixPtr M; 1466 1509 dd_rowrange ddrows; … … 1468 1511 ddcols=(this->numVars)+1; 1469 1512 ddrows=this->numFacets; 1513 dd_NumberType numb = dd_Integer; 1470 1514 M=dd_CreateMatrix(ddrows,ddcols); 1471 #ifdef gfan_DEBUG1472 cout << "in f2M" << endl;1473 showFacets();1474 #endif1475 1515 1476 1516 //dd_set_global_constants(); … … 1487 1527 fAct = fAct->next; 1488 1528 }//jj 1489 #ifdef gfan_DEBUG1490 cout << "in f2M" << endl;1491 showFacets();1492 #endif1493 1529 1494 1530 //delete fAct; … … 1529 1565 1530 1566 gcOutputFile << "FACETS" << endl; 1531 while(fAct !=NULL)1567 while(fAct->next!=NULL) 1532 1568 { 1533 1569 intvec *iv = new intvec(gc.numVars);
Note: See TracChangeset
for help on using the changeset viewer.