Changeset a7f2073 in git
- Timestamp:
- May 18, 2009, 5:11:53 PM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 3131f355cc7139ed1bca8dd189bd09b02d51dc35
- Parents:
- 4e636006a036122ffe86cbfd6e636134782f6672
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r4e63600 ra7f2073 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-05-1 5 13:54:46$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.5 2 2009-05-15 13:54:46monerjan Exp $6 $Id: gfan.cc,v 1.5 2 2009-05-15 13:54:46monerjan Exp $4 $Date: 2009-05-18 15:11:53 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.53 2009-05-18 15:11:53 monerjan Exp $ 6 $Id: gfan.cc,v 1.53 2009-05-18 15:11:53 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 91 intvec *codim2Normals; 92 92 93 /** The default constructor. Do I need a constructor of type facet(intvec)? */ 93 94 facet() … … 293 294 294 295 fAct->setFacetNormal(ivtmp); 295 delete ivtmp; 296 delete ivtmp; 297 delete fAct; 296 298 } 297 299 … … 315 317 { 316 318 ivIntPt->show(); 319 } 320 321 void showFacets() 322 { 323 facet *f = new facet(); 324 f = this->facetPtr; 325 intvec *iv = new intvec(this->numVars); 326 327 while (f!=NULL) 328 { 329 iv = f->getFacetNormal(); 330 iv->show(); 331 f=f->next; 332 } 333 //delete iv; 334 //delete f; 317 335 } 318 336 … … 488 506 (*ivCanonical)[jj]=1; 489 507 cout << "dotProd=" << dotProduct(*load,*ivCanonical) << endl; 490 if (dotProduct(*load,*ivCanonical)<0) 508 if (dotProduct(*load,*ivCanonical)<0) 509 //if (ivMult(load,ivCanonical)<0) 491 510 { 492 511 isFlippable=TRUE; … … 506 525 fAct=fAct->next; //this should definitely not be called in the above while-loop :D 507 526 }//if (isFlippable==FALSE) 508 delete load;527 //delete load; 509 528 }//for (int kk = 0; kk<ddrows; kk++) 510 529 … … 532 551 free(ddnewpos); 533 552 set_free(ddlinset); 553 //NOTE Commented out. Solved the bug that after facet2Matrix there were facets lost 554 //THIS SUCKS 534 555 dd_free_global_constants(); 535 556 … … 1316 1337 1317 1338 /** \brief The new method of Markwig and Jensen 1339 * Compute gcBasis and facets for the arbitrary starting cone. Store \f$(codim-1)\f$-facets as normals. 1340 * In order to represent a facet uniquely compute also the \f$(codim-2)\f$-facets and norm by the gcd of the components. 1341 * Keep a list of facets as a linked list containing an intvec and an integer matrix. 1342 * Since a \f$(codim-1)\f$-facet belongs to exactly two full dimensional cones, we remove a facet from the list as 1343 * soon as we compute this facet again. Comparison of facets is done by... 1318 1344 */ 1319 1345 void noRevS(gcone &gc, bool usingIntPoint=FALSE) … … 1322 1348 facet *fAct = new facet(); 1323 1349 fAct = gc.facetPtr; 1324 1350 1351 #ifdef gfan_DEBUG 1352 cout << "NoRevs" << endl; 1353 cout << "Facets are:" << endl; 1354 gc.showFacets(); 1355 #endif 1356 1325 1357 dd_set_global_constants(); 1326 1358 dd_rowrange ddrows; … … 1350 1382 #endif 1351 1383 //Store the interior point and the UCN 1352 fListPtr->setInteriorPoint( comp );1353 fListPtr->setUCN( gc.getUCN() );1384 fListPtr->setInteriorPoint( comp ); 1385 fListPtr->setUCN( gc.getUCN() ); 1354 1386 1355 1387 dd_FreeMatrix(ddineq); … … 1362 1394 dd_rowset impl_linset, redset; 1363 1395 dd_ErrorType err; 1364 dd_rowindex newpos; 1365 1396 dd_rowindex newpos; 1397 1398 #ifdef gfan_DEBUG 1399 cout << "before f2M" << endl; 1400 gc.showFacets(); 1366 1401 ddineq = facets2Matrix(gc); 1402 cout << "after f2M" << endl; 1403 gc.showFacets(); 1404 #endif 1367 1405 1368 1406 /*Now set appropriate linearity*/ … … 1377 1415 dd_MatrixCanonicalize(&ddakt, &impl_linset, &redset, &newpos, &err); 1378 1416 1379 //dd_WriteMatrix(stdout,ddakt);1417 dd_WriteMatrix(stdout,ddakt); 1380 1418 ddpolyh=dd_DDMatrix2Poly(ddakt, &err); 1381 1419 P=dd_CopyGenerators(ddpolyh); 1382 1420 dd_WriteMatrix(stdout,P); 1383 1421 1384 intvec *load = new intvec(this->numVars);1422 //intvec *load = new intvec(this->numVars); 1385 1423 1386 1424 dd_FreeMatrix(ddakt); 1387 1425 dd_FreePolyhedra(ddpolyh); 1388 1426 } 1427 gc.showFacets(); 1389 1428 1390 } 1429 } 1430 #ifdef gfan_DEBUG 1431 cout << "Before writeConeToFile" << endl; 1432 gc.showFacets(); 1433 #endif 1434 1391 1435 1392 1436 //NOTE Hm, comment in and get a crash for free... 1393 1437 //dd_free_global_constants(); 1394 1438 gc.writeConeToFile(gc); 1439 #ifdef gfan_DEBUG 1440 cout << "After writeConeToFile" << endl; 1441 gc.showFacets(); 1442 #endif 1395 1443 1396 1444 /*2nd step … … 1398 1446 */ 1399 1447 fAct = fListPtr; 1400 gcone *gcTmp = new gcone(gc); //copy1448 //gcone *gcTmp = new gcone(gc); //copy 1401 1449 //gcTmp->flip(gcTmp->gcBasis,fAct); 1402 1450 //NOTE: gcTmp may be deleted, gcRoot from main proc should probably not! … … 1410 1458 { 1411 1459 facet *fAct = new facet(); 1412 fAct = gc.facetPtr; 1460 fAct = gc.facetPtr; 1461 #ifdef gfan_DEBUG 1462 cout << "gcFacetPtr is at" << &gc.facetPtr << endl; 1463 cout << "fAct is at" << &fAct << endl; 1464 #endif 1413 1465 dd_MatrixPtr M; 1414 1466 dd_rowrange ddrows; … … 1416 1468 ddcols=(this->numVars)+1; 1417 1469 ddrows=this->numFacets; 1418 M=dd_CreateMatrix(ddrows,ddcols); 1470 M=dd_CreateMatrix(ddrows,ddcols); 1471 #ifdef gfan_DEBUG 1472 cout << "in f2M" << endl; 1473 showFacets(); 1474 #endif 1419 1475 1420 1476 //dd_set_global_constants(); … … 1431 1487 fAct = fAct->next; 1432 1488 }//jj 1433 delete comp; 1434 1489 #ifdef gfan_DEBUG 1490 cout << "in f2M" << endl; 1491 showFacets(); 1492 #endif 1493 1494 //delete fAct; 1495 //delete comp; 1435 1496 return M; 1436 1497 } … … 1449 1510 { 1450 1511 ofstream gcOutputFile("/tmp/cone1.gc"); 1512 facet *fAct = new facet(); 1513 fAct = gc.facetPtr; 1514 1451 1515 if (!gcOutputFile) 1452 1516 { … … 1462 1526 { 1463 1527 gcOutputFile << p_String((poly)gc.gcBasis->m[ii],gc.baseRing) << endl; 1464 } 1528 } 1465 1529 1466 facet *fAct = new facet();1467 fAct = gc.facetPtr;1468 1530 gcOutputFile << "FACETS" << endl; 1469 1531 while(fAct!=NULL) … … 1483 1545 } 1484 1546 fAct=fAct->next; 1547 //delete iv; iv=NULL; 1485 1548 } 1486 1549 1487 1550 gcOutputFile.close(); 1488 delete fAct; fAct=NULL; 1489 } 1551 //delete fAct; fAct=NULL; 1552 } 1553 1490 1554 }//writeConeToFile(gcone const &gc) 1491 1555
Note: See TracChangeset
for help on using the changeset viewer.