Changeset 69b2c1 in git
- Timestamp:
- Oct 25, 2013, 6:22:49 PM (9 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 62de8de7d677c1aa9a6da3c0e58b04a58a9a884b
- Parents:
- 19addd1fe8e5af5d3cb924815b54b7300d961766
- git-author:
- Yue Ren <ren@mathematik.uni-kl.de>2013-10-25 18:22:49+02:00
- git-committer:
- Yue Ren <ren@mathematik.uni-kl.de>2013-10-25 18:25:28+02:00
- Location:
- dyn_modules/callgfanlib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
dyn_modules/callgfanlib/bbcone.cc
r19addd1 r69b2c1 170 170 } 171 171 172 void* bbcone_Init(blackbox *b)172 void* bbcone_Init(blackbox* /*b*/) 173 173 { 174 174 return (void*)(new gfan::ZCone()); … … 229 229 } 230 230 231 char * bbcone_String(blackbox *b, void *d)231 char* bbcone_String(blackbox* /*b*/, void *d) 232 232 { 233 233 if (d==NULL) return omStrDup("invalid object"); … … 239 239 } 240 240 241 void bbcone_destroy(blackbox *b, void *d)241 void bbcone_destroy(blackbox* /*b*/, void *d) 242 242 { 243 243 if (d!=NULL) … … 248 248 } 249 249 250 void* bbcone_Copy(blackbox* b, void *d)250 void* bbcone_Copy(blackbox* /*b*/, void *d) 251 251 { 252 252 gfan::ZCone* zc = (gfan::ZCone*)d; … … 622 622 { 623 623 leftv u = args; 624 if ((u != NULL) && (u->Typ() == coneID ))624 if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) 625 625 { 626 626 gfan::ZCone* zc = (gfan::ZCone*)u->Data(); … … 638 638 { 639 639 leftv u = args; 640 if ((u != NULL) && (u->Typ() == coneID ))640 if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) 641 641 { 642 642 gfan::ZCone* zc = (gfan::ZCone*)u->Data(); … … 653 653 { 654 654 leftv u = args; 655 if ((u != NULL) && (u->Typ() == coneID ))655 if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) 656 656 { 657 657 gfan::ZCone* zc = (gfan::ZCone*)u->Data(); … … 661 661 return FALSE; 662 662 } 663 if ((u != NULL) && (u->Typ() == polytopeID))664 {665 gfan::ZCone* zc = (gfan::ZCone*)u->Data();666 res->rtyp = BIGINTMAT_CMD;667 res->data = (void*) getFacetNormals(zc);668 return FALSE;669 }670 663 WerrorS("facets: unexpected parameters"); 671 664 return TRUE; … … 675 668 { 676 669 leftv u = args; 677 if ((u != NULL) && (u->Typ() == coneID ))670 if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) 678 671 { 679 672 gfan::ZCone* zc = (gfan::ZCone*)u->Data(); … … 690 683 { 691 684 leftv u = args; 692 if ((u != NULL) && (u->Typ() == coneID ))685 if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) 693 686 { 694 687 gfan::ZCone* zc = (gfan::ZCone*)u->Data(); … … 705 698 { 706 699 leftv u = args; 707 if ((u != NULL) && (u->Typ() == coneID ))700 if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) 708 701 { 709 702 gfan::ZCone* zc = (gfan::ZCone*)u->Data(); … … 1646 1639 1647 1640 1641 lists listOfFacets(const gfan::ZCone &zc) 1642 { 1643 gfan::ZMatrix inequalities = zc.getFacets(); 1644 gfan::ZMatrix equations = zc.getImpliedEquations(); 1645 lists L = (lists)omAllocBin(slists_bin); 1646 int r = inequalities.getHeight(); 1647 int c = inequalities.getWidth(); 1648 L->Init(r); 1649 1650 /* next we iterate over each of the r facets, build the respective cone and add it to the list */ 1651 /* this is the i=0 case */ 1652 gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c); 1653 gfan::ZMatrix newEquations = equations; 1654 newEquations.appendRow(inequalities[0]); 1655 L->m[0].rtyp = coneID; L->m[0].data=(void*) new gfan::ZCone(newInequalities,newEquations); 1656 1657 /* these are the cases i=1,...,r-2 */ 1658 for (int i=1; i<r-1; i++) 1659 { 1660 newInequalities = inequalities.submatrix(0,0,i-1,c); 1661 newInequalities.append(inequalities.submatrix(i+1,0,r,c)); 1662 newEquations = equations; 1663 newEquations.appendRow(inequalities[i]); 1664 L->m[i].rtyp = coneID; L->m[i].data=(void*) new gfan::ZCone(newInequalities,newEquations); 1665 } 1666 1667 /* this is the i=r-1 case */ 1668 newInequalities = inequalities.submatrix(0,0,r-1,c); 1669 newEquations = equations; 1670 newEquations.appendRow(inequalities[r]); 1671 L->m[r-1].rtyp = coneID; L->m[r-1].data=(void*) new gfan::ZCone(newInequalities,newEquations); 1672 1673 return L; 1674 } 1675 1676 1677 BOOLEAN listOfFacets(leftv res, leftv args) 1678 { 1679 leftv u=args; 1680 if ((u != NULL) && (u->Typ() == coneID)) 1681 { 1682 gfan::ZCone* zc = (gfan::ZCone*) u->Data(); 1683 lists L = listOfFacets(*zc); 1684 res->rtyp = LIST_CMD; 1685 res->data = (void*) L; 1686 return FALSE; 1687 } 1688 WerrorS("listOfFacets: unexpected parameters"); 1689 return TRUE; 1690 } 1691 1692 1648 1693 poly initial(poly p) 1649 1694 { … … 1684 1729 ideal I = (ideal) u->Data(); 1685 1730 ideal inI = idInit(IDELEMS(I)); 1686 poly g; poly h; long d;1731 poly g; 1687 1732 for (int i=0; i<IDELEMS(I); i++) 1688 1733 { … … 1908 1953 p->iiAddCproc("","uniquePoint",FALSE,uniquePoint); 1909 1954 p->iiAddCproc("","listContainsCone",FALSE,containsCone); 1955 p->iiAddCproc("","listOfFacets",FALSE,listOfFacets); 1910 1956 p->iiAddCproc("","maximalGroebnerCone",FALSE,maximalGroebnerCone); 1911 1957 p->iiAddCproc("","groebnerCone",FALSE,groebnerCone); -
dyn_modules/callgfanlib/bbfan.cc
r19addd1 r69b2c1 25 25 int fanID; 26 26 27 void* bbfan_Init(blackbox *b)27 void* bbfan_Init(blackbox* /*b*/) 28 28 { 29 29 return (void*) new gfan::ZFan(0); 30 30 } 31 31 32 void bbfan_destroy(blackbox *b, void *d)32 void bbfan_destroy(blackbox* /*b*/, void *d) 33 33 { 34 34 if (d!=NULL) … … 39 39 } 40 40 41 char* bbfan_String(blackbox *b, void *d)41 char* bbfan_String(blackbox* /*b*/, void *d) 42 42 { 43 43 if (d==NULL) return omStrDup("invalid object"); … … 50 50 } 51 51 52 void* bbfan_Copy(blackbox* b, void *d)52 void* bbfan_Copy(blackbox* /*b*/, void *d) 53 53 { 54 54 gfan::ZFan* zf = (gfan::ZFan*)d; … … 502 502 leftv w=v->next; int n = 1; 503 503 if ((w != NULL) && (w->Typ() == INT_CMD)) 504 intn = (int)(long) w;504 n = (int)(long) w; 505 505 506 506 if (n != 0) … … 864 864 } 865 865 866 lists listOfFacets(const gfan::ZCone &zc)867 {868 gfan::ZMatrix inequalities = zc.getFacets();869 gfan::ZMatrix equations = zc.getImpliedEquations();870 lists L = (lists)omAllocBin(slists_bin);871 int r = inequalities.getHeight();872 int c = inequalities.getWidth();873 L->Init(r);874 875 /* next we iterate over each of the r facets, build the respective cone and add it to the list */876 /* this is the i=0 case */877 gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);878 gfan::ZMatrix newEquations = equations;879 newEquations.appendRow(inequalities[0]);880 L->m[0].rtyp = coneID; L->m[0].data=(void*) new gfan::ZCone(newInequalities,newEquations);881 882 /* these are the cases i=1,...,r-2 */883 for (int i=1; i<r-1; i++)884 {885 newInequalities = inequalities.submatrix(0,0,i-1,c);886 newInequalities.append(inequalities.submatrix(i+1,0,r,c));887 newEquations = equations;888 newEquations.appendRow(inequalities[i]);889 L->m[i].rtyp = coneID; L->m[i].data=(void*) new gfan::ZCone(newInequalities,newEquations);890 }891 892 /* this is the i=r-1 case */893 newInequalities = inequalities.submatrix(0,0,r-1,c);894 newEquations = equations;895 newEquations.appendRow(inequalities[r]);896 L->m[r-1].rtyp = coneID; L->m[r-1].data=(void*) new gfan::ZCone(newInequalities,newEquations);897 898 return L;899 }900 901 BOOLEAN listOfFacets(leftv res, leftv args)902 {903 leftv u=args;904 if ((u != NULL) && (u->Typ() == coneID))905 {906 gfan::ZCone* zc = (gfan::ZCone*) u->Data();907 lists L = listOfFacets(*zc);908 res->rtyp = LIST_CMD;909 res->data = (void*) L;910 return FALSE;911 }912 WerrorS("listOfFacets: unexpected parameters");913 return TRUE;914 }915 866 916 867 BOOLEAN tropicalVariety(leftv res, leftv args) -
dyn_modules/callgfanlib/bbpolytope.cc
r19addd1 r69b2c1 38 38 } 39 39 40 void *bbpolytope_Init(blackbox *b)40 void *bbpolytope_Init(blackbox* /*b*/) 41 41 { 42 42 return (void*)(new gfan::ZCone()); … … 97 97 } 98 98 99 char* bbpolytope_String(blackbox *b, void *d)99 char* bbpolytope_String(blackbox* /*b*/, void *d) 100 100 { if (d==NULL) return omStrDup("invalid object"); 101 101 else … … 107 107 } 108 108 109 void bbpolytope_destroy(blackbox *b, void *d)109 void bbpolytope_destroy(blackbox* /*b*/, void *d) 110 110 { 111 111 if (d!=NULL) … … 116 116 } 117 117 118 void* bbpolytope_Copy(blackbox* b, void *d)118 void* bbpolytope_Copy(blackbox* /*b*/, void *d) 119 119 { 120 120 gfan::ZCone* zc = (gfan::ZCone*)d; … … 358 358 WerrorS("vertices: unexpected parameters"); 359 359 return TRUE; 360 }361 362 bigintmat* getFacetNormals(gfan::ZCone* zc)363 {364 gfan::ZMatrix zmat = zc->getFacets();365 return zMatrixToBigintmat(zmat);366 360 } 367 361 … … 482 476 // iiAddCproc("","getCodimension",FALSE,getAmbientDimension); 483 477 // iiAddCproc("","getDimension",FALSE,getDimension); 484 // iiAddCproc("","getFacetNormals",FALSE,getFacetNormals);485 478 /********************************************************/ 486 479 /* the following functions are identical to those in bbcone.cc */ 480 // iiAddCproc("","facets",FALSE,facets); 487 481 // iiAddCproc("","setLinearForms",FALSE,setLinearForms); 488 482 // iiAddCproc("","getLinearForms",FALSE,getLinearForms); -
dyn_modules/callgfanlib/gfan.h
r19addd1 r69b2c1 261 261 }; 262 262 lists lprepareResult(gcone *gc, const int n); 263 static int64 int64gcd(const int64 &a, const int64 &b); 264 static int intgcd(const int &a, const int &b); 265 static int dotProduct(const int64vec &iva, const int64vec &ivb); 266 static bool isParallel(const int64vec &a, const int64vec &b); 267 static int64vec *ivNeg(/*const*/ int64vec *iv); 268 static void idDebugPrint(const ideal &I); 269 static volatile void showSLA(facet &f); 270 static bool isMonomial(const ideal &I); 271 static bool ivAreEqual(const int64vec &a, const int64vec &b); 272 static bool areEqual2(facet *f, facet *g); 273 static bool areEqual( facet *f, facet *g); 263 /* static int64 int64gcd(const int64 &a, const int64 &b); */ 264 /* static int intgcd(const int &a, const int &b); */ 265 /* static int dotProduct(const int64vec &iva, const int64vec &ivb); */ 266 /* static bool isParallel(const int64vec &a, const int64vec &b); */ 267 /* static int64vec *ivNeg(/\*const*\/ int64vec *iv); */ 268 /* static void idDebugPrint(const ideal &I); */ 269 /* static volatile void showSLA(facet &f); */ 270 /* static bool isMonomial(const ideal &I); */ 271 /* static bool ivAreEqual(const int64vec &a, const int64vec &b); */ 272 /* static bool areEqual2(facet *f, facet *g); */ 273 /* static bool areEqual( facet *f, facet *g); */ 274 274 // bool iv64isStrictlyPositive(int64vec *); 275 275 #endif -
dyn_modules/callgfanlib/gitfan.cc
r19addd1 r69b2c1 40 40 gfan::ZVector v = f.interiorPoint; 41 41 gfan::ZVector w = f.facetNormal; 42 assume(c.ambientDimension() == v.size());43 assume(c.ambientDimension() == w.size());42 assume(c.ambientDimension() == (int)v.size()); 43 assume(c.ambientDimension() == (int)w.size()); 44 44 assume(c.contains(v)); 45 45 assume(!c.contains(w)); … … 53 53 { 54 54 #ifndef NDEBUG 55 assume(c.ambientDimension() == v.size());56 assume(c.ambientDimension() == w.size());55 assume(c.ambientDimension() == (int)v.size()); 56 assume(c.ambientDimension() == (int)w.size()); 57 57 assume(c.contains(v)); 58 58 assume(!c.contains(w)); … … 66 66 gfan::ZVector v = this->interiorPoint; 67 67 gfan::ZVector w = this->facetNormal; 68 assume(c.ambientDimension() == v.size());69 assume(c.ambientDimension() == w.size());68 assume(c.ambientDimension() == (int)v.size()); 69 assume(c.ambientDimension() == (int)w.size()); 70 70 assume(c.contains(v)); 71 71 assume(!c.contains(w)); … … 114 114 return F; 115 115 116 int index = 0;116 // int index = 0; 117 117 /* next we iterate over each of the r facets, build the respective cone and add it to the list */ 118 118 /* this is the i=0 case */
Note: See TracChangeset
for help on using the changeset viewer.