Changeset fc4f9a in git
- Timestamp:
- Mar 23, 2009, 5:59:56 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- aba53ce3c77ba50e34a7922b440ad0d9b503f81d
- Parents:
- 4159ffa27176a5b3cf13ba9bc75034da1faab9a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r4159ff rfc4f9a 1 1 /* 2 2 Compute the Groebner fan of an ideal 3 Author:$Author: monerjan $4 Date: $Date: 2009-03-02 14:44:49$5 Header: $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.17 2009-03-02 14:44:49monerjan Exp $6 Id: $Id: gfan.cc,v 1.17 2009-03-02 14:44:49monerjan Exp $3 $Author: monerjan $ 4 $Date: 2009-03-23 16:59:56 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.18 2009-03-23 16:59:56 monerjan Exp $ 6 $Id: gfan.cc,v 1.18 2009-03-23 16:59:56 monerjan Exp $ 7 7 */ 8 8 … … 16 16 #include "ideals.h" 17 17 #include "kmatrix.h" 18 #include "iostream.h" 19 20 //Hacks for different working places 21 #define HOME 22 23 #ifdef UNI 18 24 #include "/users/urmel/alggeom/monerjan/cddlib/include/setoper.h" //Support for cddlib. Dirty hack 19 25 #include "/users/urmel/alggeom/monerjan/cddlib/include/cdd.h" 26 #endif 27 28 #ifdef HOME 29 #include "/home/momo/studium/diplomarbeit/cddlib/include/setoper.h" 30 #include "/home/momo/studium/diplomarbeit/cddlib/include/cdd.h" 31 #endif 32 33 #ifdef ITWM 34 #endif 20 35 21 36 #ifndef gfan_DEBUG … … 28 43 intvec fNormal; //inner normal, describing the facet uniquely 29 44 public: 30 facet(); //constructor 45 facet(intvec FN) //constructor 46 { 47 fNormal = FN; 48 } 49 50 ~facet(); //destructor 51 void printNormal(){ 52 std::cout << "The normal is = " << "fNormal" << endl; 53 return; 54 } 55 31 56 bool isFlippable; //flippable facet? Want to have cone->isflippable.facet[i] 32 57 bool isIncoming; //Is the facet incoming or outgoing? … … 43 68 public: 44 69 gcone(int); //constructor with dimension 45 poly gcMarkedTerm; //marked terms of the cone's Gröbner basis 70 ~gcone(); //destructor 71 poly gcMarkedTerm; //marked terms of the cone's Grᅵbner basis 46 72 ideal gcBasis; //GB of the cone 47 73 gcone *next; //Pointer to *previous* cone in search tree 48 74 49 75 void flip(); //Compute "the other side" 50 void remRedFacets(); //Remove redundant facets of the cone 76 void remRedFacets(); //Remove redundant facets of the cone NOT NEEDED since this is already done by cddlib while compunting the normals 77 78 ideal GenGrbWlk(ideal, ideal); //Implementation of the Generic Groebner Walk. Needed for a) Computing the sink and b) finding search facets 51 79 52 80 … … 56 84 { 57 85 #ifdef gfan_DEBUG 58 printf("Computing a groebner basis...\n");86 cout << "Computing a groebner basis..." << endl; 59 87 #endif 60 88 … … 66 94 } 67 95 68 /****** get WallIneqcomputes the inequalities ***/96 /****** getConeNormals computes the inequalities ***/ 69 97 /*INPUT_TYPE: ideal */ 70 98 /*RETURN_TYPE: matrix */ 71 99 /************************************************/ 72 void get WallIneq(ideal I)73 { 74 #ifdef gfan_DEBUG 75 printf("*** Computing Inequalities... ***\n");100 void getConeNormals(ideal I) 101 { 102 #ifdef gfan_DEBUG 103 cout << "*** Computing Inequalities... ***" << endl; 76 104 #endif 77 105 … … 93 121 // End of var declaration 94 122 95 printf("The Groebner basis has %i elements\n",lengthGB);96 printf("The current ring has %i variables\n",numvar);123 cout << "The Groebner basis has " << lengthGB << " elements" << endl; 124 cout << "The current ring has " << numvar << " variables" << endl; 97 125 cols = numvar; 98 126 … … 104 132 rows=rows+pLength(aktpoly)-1; 105 133 } 106 printf("rows=%i\n",rows);107 printf("Will create a %i x %i - matrix to store inequalities\n",rows,cols);134 cout << "rows=" << rows << endl; 135 cout << "Will create a " << rows << " x " << cols << " matrix to store inequalities" << endl; 108 136 109 137 dd_rowrange aktmatrixrow=0; // needed to store the diffs of the expvects in the rows of ddineq … … 119 147 aktpoly=(poly)I->m[i]; //get aktpoly as i-th component of I 120 148 pCompCount=pLength(aktpoly); //How many terms does aktpoly consist of? 121 printf("Poly No. %i has %i components\n",i,pCompCount);149 cout << "Poly No. " << i << " has " << pCompCount << " components" << endl; 122 150 123 151 int *v=(int *)omAlloc((numvar+1)*sizeof(int)); … … 155 183 156 184 #ifdef gfan_DEBUG 157 printf("The inequality matrix is:\n");185 cout << "The inequality matrix is" << endl; 158 186 dd_WriteMatrix(stdout, ddineq); 159 187 #endif … … 167 195 } else 168 196 { 169 printf("Redundant rows: ");197 cout << "Redundant rows: "; 170 198 set_fwrite(stdout, ddredrows); //otherwise print the redundant rows 171 199 }//if dd_Error … … 174 202 dd_MatrixCanonicalize(&ddineq, &ddlinset, &ddredrows, &ddnewpos, &dderr); 175 203 #ifdef gfan_DEBUG 176 printf("Having removed redundant rows, the inequalities now read:\n");204 cout << "Having removed redundancies, the normals now read:" << endl; 177 205 dd_WriteMatrix(stdout,ddineq); 178 206 #endif 179 207 180 dd_PolyhedraPtr ddpolyh;208 /*dd_PolyhedraPtr ddpolyh; 181 209 dd_MatrixPtr G; 182 210 ddpolyh=dd_DDMatrix2Poly(ddineq, &dderr); … … 184 212 printf("\nSpanning vectors = rows:\n"); 185 213 dd_WriteMatrix(stdout, G); 186 214 */ 215 216 217 /*Write the normals into class facet 218 How do I get the #rows in ddineq? \exists s.th. like dd_NumRows? 219 Strange enough: facet *f=new facet(intvec(2,3)) does work for the constructor facet(intvec FN){fNormal = FN;} 220 */ 221 for (int kk = 1; kk<=2; kk++){ 222 facet *f = new facet(intvec(2,3)); 223 //facet *fPtr = &f; 224 cout << &f << endl; 225 f->printNormal(); 226 } 227 187 228 //ddineq->representation=dd_Inequality; //We want our LP to be Ax>=0 188 229 … … 205 246 { 206 247 #ifdef gfan_DEBUG 207 printf("Now in subroutine gfan\n");248 cout << "Now in subroutine gfan" << endl; 208 249 #endif 209 250 ideal res; 210 251 matrix ineq; //Matrix containing the boundary inequalities 211 252 /* 253 1. Select target order 254 2. Compute GB of inputIdeal wrt target order 255 3. getConeNormals 256 */ 212 257 res=getGB(inputIdeal); 213 get WallIneq(res);258 getConeNormals(res); 214 259 return res; 215 260 }
Note: See TracChangeset
for help on using the changeset viewer.