Changeset 6aacb6 in git for kernel/weight.cc
- Timestamp:
- Apr 4, 2007, 4:13:31 PM (17 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- d2891e1d3947c09a85c4a63722c29bab5d5db606
- Parents:
- 96dff7b28aa80d21e3cbe5afdbe9afcad5004cb0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/weight.cc
r96dff7 r6aacb6 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: weight.cc,v 1. 3 2006-06-16 17:17:14Singular Exp $ */4 /* $Id: weight.cc,v 1.4 2007-04-04 14:13:31 Singular Exp $ */ 5 5 6 6 /* … … 20 20 /*0 implementation*/ 21 21 extern "C" double (*wFunctional)(int *degw, int *lpol, int npol, 22 double *rel, double wx );22 double *rel, double wx, double wNsqr); 23 23 extern "C" double wFunctionalMora(int *degw, int *lpol, int npol, 24 double *rel, double wx );24 double *rel, double wx, double wNsqr); 25 25 extern "C" double wFunctionalBuch(int *degw, int *lpol, int npol, 26 double *rel, double wx );26 double *rel, double wx, double wNsqr); 27 27 extern "C" void wAdd(int *A, int mons, int kn, int xx); 28 28 extern "C" void wNorm(int *degw, int *lpol, int npol, double *rel); 29 29 extern "C" void wFirstSearch(int *A, int *x, int mons, 30 int *lpol, int npol, double *rel, double *fopt );30 int *lpol, int npol, double *rel, double *fopt, double wNsqr); 31 31 extern "C" void wSecondSearch(int *A, int *x, int *lpol, 32 int npol, int mons, double *rel, double *fk );32 int npol, int mons, double *rel, double *fk, double wNsqr); 33 33 extern "C" void wGcd(int *x, int n); 34 extern double wNsqr;35 34 36 35 static void wDimensions(polyset s, int sl, int *lpol, int *npol, int *mons) … … 108 107 } 109 108 110 void wCall(polyset s, int sl, int *x )109 void wCall(polyset s, int sl, int *x, double wNsqr) 111 110 { 112 111 int n, q, npol, mons, i; … … 136 135 wAdd(A, mons, i, 1); 137 136 wNorm(degw, lpol, npol, rel); 138 f1 = (*wFunctional)(degw, lpol, npol, rel, (double)1.0 );137 f1 = (*wFunctional)(degw, lpol, npol, rel, (double)1.0, wNsqr); 139 138 if (TEST_OPT_PROT) Print("// %e\n",f1); 140 139 eps = f1; 141 140 fx = (double)2.0 * eps; 142 141 memset(x, 0, (n + 1) * sizeof(int)); 143 wFirstSearch(A, x, mons, lpol, npol, rel, &fx );142 wFirstSearch(A, x, mons, lpol, npol, rel, &fx, wNsqr); 144 143 if (TEST_OPT_PROT) Print("// %e\n",fx); 145 144 memcpy(x + 1, xopt + 1, n * sizeof(int)); … … 150 149 wAdd(A, mons, i, x[i]); 151 150 } 152 wSecondSearch(A, x, lpol, npol, mons, rel, &fx );151 wSecondSearch(A, x, lpol, npol, mons, rel, &fx, wNsqr); 153 152 if (TEST_OPT_PROT) Print("// %e\n",fx); 154 153 if (fx >= eps) … … 189 188 *eweight = 0; 190 189 n = pVariables; 191 wNsqr = (double)2.0 / (double)n;192 190 if (pOrdSgn == -1) 193 191 wFunctional = wFunctionalMora; … … 195 193 wFunctional = wFunctionalBuch; 196 194 x = (int * )omAlloc(2 * (n + 1) * sizeof(int)); 197 wCall(s, sl, x );195 wCall(s, sl, x, (double)2.0 / (double)n); 198 196 for (i = n; i!=0; i--) 199 197 eweight[i] = x[i + n + 1];
Note: See TracChangeset
for help on using the changeset viewer.