Changeset 6aacb6 in git for kernel/weight.cc


Ignore:
Timestamp:
Apr 4, 2007, 4:13:31 PM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
d2891e1d3947c09a85c4a63722c29bab5d5db606
Parents:
96dff7b28aa80d21e3cbe5afdbe9afcad5004cb0
Message:
*hannes: global wNsqr removed


git-svn-id: file:///usr/local/Singular/svn/trunk@9970 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/weight.cc

    r96dff7 r6aacb6  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: weight.cc,v 1.3 2006-06-16 17:17:14 Singular Exp $ */
     4/* $Id: weight.cc,v 1.4 2007-04-04 14:13:31 Singular Exp $ */
    55
    66/*
     
    2020/*0 implementation*/
    2121extern "C" double (*wFunctional)(int *degw, int *lpol, int npol,
    22        double *rel, double wx);
     22       double *rel, double wx, double wNsqr);
    2323extern "C" double wFunctionalMora(int *degw, int *lpol, int npol,
    24        double *rel, double wx);
     24       double *rel, double wx, double wNsqr);
    2525extern "C" double wFunctionalBuch(int *degw, int *lpol, int npol,
    26        double *rel, double wx);
     26       double *rel, double wx, double wNsqr);
    2727extern "C" void wAdd(int *A, int mons, int kn, int xx);
    2828extern "C" void wNorm(int *degw, int *lpol, int npol, double *rel);
    2929extern "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);
    3131extern "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);
    3333extern "C" void wGcd(int *x, int n);
    34 extern double wNsqr;
    3534
    3635static void wDimensions(polyset s, int sl, int *lpol, int *npol, int *mons)
     
    108107}
    109108
    110 void wCall(polyset s, int sl, int *x)
     109void wCall(polyset s, int sl, int *x, double wNsqr)
    111110{
    112111  int  n, q, npol, mons, i;
     
    136135    wAdd(A, mons, i, 1);
    137136  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);
    139138  if (TEST_OPT_PROT) Print("// %e\n",f1);
    140139  eps = f1;
    141140  fx = (double)2.0 * eps;
    142141  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);
    144143  if (TEST_OPT_PROT) Print("// %e\n",fx);
    145144  memcpy(x + 1, xopt + 1, n * sizeof(int));
     
    150149    wAdd(A, mons, i, x[i]);
    151150  }
    152   wSecondSearch(A, x, lpol, npol, mons, rel, &fx);
     151  wSecondSearch(A, x, lpol, npol, mons, rel, &fx, wNsqr);
    153152  if (TEST_OPT_PROT) Print("// %e\n",fx);
    154153  if (fx >= eps)
     
    189188  *eweight = 0;
    190189  n = pVariables;
    191   wNsqr = (double)2.0 / (double)n;
    192190  if (pOrdSgn == -1)
    193191    wFunctional = wFunctionalMora;
     
    195193    wFunctional = wFunctionalBuch;
    196194  x = (int * )omAlloc(2 * (n + 1) * sizeof(int));
    197   wCall(s, sl, x);
     195  wCall(s, sl, x, (double)2.0 / (double)n);
    198196  for (i = n; i!=0; i--)
    199197    eweight[i] = x[i + n + 1];
Note: See TracChangeset for help on using the changeset viewer.