Changeset aba53c in git
- Timestamp:
- Mar 24, 2009, 6:37:40 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- fe919cbede83a96748fd037a48aa15876e31e41e
- Parents:
- fc4f9a6dc1aa8816f99642c699541cb71324666f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
rfc4f9a raba53c 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-03-2 3 16:59:56$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.1 8 2009-03-23 16:59:56monerjan Exp $6 $Id: gfan.cc,v 1.1 8 2009-03-23 16:59:56monerjan Exp $4 $Date: 2009-03-24 17:37:40 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.19 2009-03-24 17:37:40 monerjan Exp $ 6 $Id: gfan.cc,v 1.19 2009-03-24 17:37:40 monerjan Exp $ 7 7 */ 8 8 … … 16 16 #include "ideals.h" 17 17 #include "kmatrix.h" 18 #include "iostream.h" 18 #include "iostream.h" //deprecated 19 19 20 20 //Hacks for different working places … … 32 32 33 33 #ifdef ITWM 34 #include "/u/slg/monerjan/cddlib/include/setoper.h" 35 #include "/u/slg/monerjan/cddlib/include/cdd.h" 34 36 #endif 35 37 … … 43 45 intvec fNormal; //inner normal, describing the facet uniquely 44 46 public: 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; 47 facet() //default constructor. Do I need a constructor of type facet(intvec) ? 48 { 49 //fNormal = FN; 50 this->next=NULL; //By default each facet is last 51 } 52 53 ~facet(){;} //destructor 54 void setFacetNormal(intvec iv){ 55 fNormal = iv; 53 56 return; 54 57 } … … 56 59 bool isFlippable; //flippable facet? Want to have cone->isflippable.facet[i] 57 60 bool isIncoming; //Is the facet incoming or outgoing? 61 facet *next; //Pointer to next facet 58 62 }; 59 63 … … 69 73 gcone(int); //constructor with dimension 70 74 ~gcone(); //destructor 71 poly gcMarkedTerm; //marked terms of the cone's Gr ᅵbner basis75 poly gcMarkedTerm; //marked terms of the cone's Groebner basis 72 76 ideal gcBasis; //GB of the cone 73 77 gcone *next; //Pointer to *previous* cone in search tree … … 96 100 /****** getConeNormals computes the inequalities ***/ 97 101 /*INPUT_TYPE: ideal */ 98 /*RETURN_TYPE: matrix*/102 /*RETURN_TYPE: pointer to first facet */ 99 103 /************************************************/ 100 voidgetConeNormals(ideal I)104 facet getConeNormals(ideal I) 101 105 { 102 106 #ifdef gfan_DEBUG … … 201 205 //Remove reduntant rows here! 202 206 dd_MatrixCanonicalize(&ddineq, &ddlinset, &ddredrows, &ddnewpos, &dderr); 207 ddrows = ddineq->rowsize; //Size of the matrix with redundancies removed 208 ddcols = ddineq->colsize; 203 209 #ifdef gfan_DEBUG 204 210 cout << "Having removed redundancies, the normals now read:" << endl; 205 211 dd_WriteMatrix(stdout,ddineq); 212 cout << "Rows = " << ddrows << endl; 213 cout << "Cols = " << ddcols << endl; 206 214 #endif 207 215 … … 216 224 217 225 /*Write the normals into class facet 218 How do I get the #rows in ddineq? \exists s.th. like dd_NumRows? 226 How do I get the #rows in ddineq? \exists s.th. like dd_NumRows? dd_get_si(ddineq->matrix[i][j]) ? 219 227 Strange enough: facet *f=new facet(intvec(2,3)) does work for the constructor facet(intvec FN){fNormal = FN;} 220 228 */ 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(); 229 #ifdef gfan_DEBUG 230 cout << "Creating list of normals" << endl; 231 #endif 232 /*The pointer *fRoot should be the return value of this function*/ 233 facet *fRoot = new facet(); //instantiate new facet with intvec with numvar rows, one column and initial values all 0 234 //facet *fRoot; 235 facet *fAct; //instantiate pointer to active facet 236 fAct = (facet*)&fRoot; 237 //fAct = fRoot; //Let fAct point to fRoot 238 for (int kk = 0; kk<ddrows; kk++) 239 { 240 intvec load; //intvec to sto 241 for (int jj = 1; jj <ddcols; jj++) 242 { 243 double *foo; 244 foo = (double*)ddineq->matrix[kk][jj]; //get entry from actual position 245 #ifdef gfan_DEBUG 246 std::cout << "fAct is " << *foo << " at " << fAct << endl; 247 #endif 248 /*next two lines commented out. How to store values into intvec? */ 249 //load[jj] = (int)*foo; //store typecasted entry at pos jj of load 250 //fAct->setFacetNormal(load); 251 if (jj<ddcols) //Is this facet NOT the last facet? Writing while instead of if is a really bad idea :) 252 { 253 fAct->next = new facet(); //If so: instantiate new facet. Otherwise this->next=NULL due to the constructor 254 fAct = fAct->next; //scary :) 255 } 256 } 226 257 } 258 /* 259 Now we should have a concatenated list containing the facet normals which we can adress via *f 260 */ 227 261 228 262 //ddineq->representation=dd_Inequality; //We want our LP to be Ax>=0 229 230 263 //Clean up but don't delete the return value! (Whatever it will turn out to be) 231 264 dd_FreeMatrix(ddineq); … … 239 272 dd_free_global_constants(); 240 273 241 //res=(ideal)aktpoly; 242 //return res;274 275 return *fRoot; 243 276 } 244 277 … … 252 285 /* 253 286 1. Select target order 254 2. Compute GB of inputIdeal wrt target order 287 2. Compute GB of inputIdeal wrt target order -> newRing, setCurrRing etc... 255 288 3. getConeNormals 256 289 */
Note: See TracChangeset
for help on using the changeset viewer.