#include <misc/auxiliary.h>
#include <omalloc/omalloc.h>
#include <math.h>
#include <string.h>
Go to the source code of this file.
|
| double | wFunctionalMora (int *degw, int *lpol, int npol, double *rel, double wx, double wwNsqr) |
| |
| double | wFunctionalBuch (int *degw, int *lpol, int npol, double *rel, double wx, double wwNsqr) |
| |
| void | wAdd (int *A, int mons, int kn, int xx, int rvar) |
| |
| void | wNorm (int *degw, int *lpol, int npol, double *rel) |
| |
| void | wFirstSearch (int *A, int *x, int mons, int *lpol, int npol, double *rel, double *fopt, double wNsqr, int rvar) |
| |
| void | wSecondSearch (int *A, int *x, int *lpol, int npol, int mons, double *rel, double *fk, double wNsqr, int rvar) |
| |
| void | wGcd (int *x, int n) |
| |
| static void | wSub (int *A, int mons, int kn, int xx, int rvar) |
| |
| static double | wPrWeight (int *x, int n) |
| |
| static void | wEstimate (int *A, int *x, int *lpol, int npol, int mons, double wx, double *rel, double *fopt, int *s0, int *s1, int *s2, double wNsqr, int rvar) |
| |
Definition at line 136 of file weight0.c.
140 B =
A + ((kn - 1) * mons);
141 ex =
A + (rvar * mons);
151 *ex++ += (*
B++) * xx;
| static void wEstimate |
( |
int * |
A, |
|
|
int * |
x, |
|
|
int * |
lpol, |
|
|
int |
npol, |
|
|
int |
mons, |
|
|
double |
wx, |
|
|
double * |
rel, |
|
|
double * |
fopt, |
|
|
int * |
s0, |
|
|
int * |
s1, |
|
|
int * |
s2, |
|
|
double |
wNsqr, |
|
|
int |
rvar |
|
) |
| |
|
static |
Definition at line 241 of file weight0.c.
244 int n, i1, i2, k0 = 0, k1 = 0, k2 = 0;
246 double fo1, fo2, fmax, wx1, wx2;
249 degw =
A + (n * mons);
250 fo2 = fo1 = (double)1.0e10;
251 for (i1 = n; i1!=0 ; i1--)
255 wSub(
A, mons, i1, 1, rvar);
256 wx1 = wx - wx / (double)
x[i1];
258 fmax = (*wFunctional)(degw, lpol, npol, rel, wx1,wNsqr);
264 for (i2 = i1; i2!=0 ; i2--)
268 wSub(
A, mons, i2, 1, rvar);
269 wx2 = wx1 - wx1 / (double)
x[i2];
270 fmax = (*wFunctional)(degw, lpol, npol, rel, wx2, wNsqr);
277 wAdd(
A, mons, i2, 1, rvar);
280 wAdd(
A, mons, i1, 1, rvar);
const CanonicalForm CFMap CFMap int &both_non_zero int n
static void wSub(int *A, int mons, int kn, int xx, int rvar)
void wAdd(int *A, int mons, int kn, int xx, int rvar)
| void wFirstSearch |
( |
int * |
A, |
|
|
int * |
x, |
|
|
int |
mons, |
|
|
int * |
lpol, |
|
|
int |
npol, |
|
|
double * |
rel, |
|
|
double * |
fopt, |
|
|
double |
wNsqr, |
|
|
int |
rvar |
|
) |
| |
Definition at line 156 of file weight0.c.
159 int a0,
a,
n,
xn, t, xx, y1;
160 int *
y, *degw, *xopt;
167 xn = n + 6 + (21 /
n);
168 a0 = n *
sizeof(double);
175 degw =
A + (n * mons);
183 wx = pr[t-1] * (double)xx;
185 if ((y1 + n - t) <=
xn)
191 wAdd(
A, mons, t, 1, rvar);
199 wSub(
A, mons, t, xx, rvar);
211 wx = pr[t-1] * (double)xx;
215 wAdd(
A, mons, t, xx, rvar);
216 fmax = (*wFunctional)(degw, lpol, npol, rel, wx,wNsqr);
218 wSub(
A, mons, t, xx, rvar);
222 memcpy(xopt, x + 1, a);
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
const CanonicalForm int const CFList const Variable & y
#define omFreeSize(addr, size)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static void wSub(int *A, int mons, int kn, int xx, int rvar)
void wAdd(int *A, int mons, int kn, int xx, int rvar)
| double wFunctionalBuch |
( |
int * |
degw, |
|
|
int * |
lpol, |
|
|
int |
npol, |
|
|
double * |
rel, |
|
|
double |
wx, |
|
|
double |
wwNsqr |
|
) |
| |
Definition at line 82 of file weight0.c.
85 int i,
j, ecl, ecu, ec;
87 double gfmax, ghom, pfmax;
94 for (i = 0; i < npol; i++)
97 for (j = lpol[i] - 1; j!=0 ; j--)
105 pfmax = (double)ecl / (
double)ecu;
108 gfmax += (double)(ecu * ecu) * (*r++);
110 if (ghom > (
double)0.5)
111 gfmax *= ((double)1.0 - (ghom * ghom)) / (
double)0.75;
112 return gfmax /
pow(wx, wNsqr);
Rational pow(const Rational &a, int e)
| double wFunctionalMora |
( |
int * |
degw, |
|
|
int * |
lpol, |
|
|
int |
npol, |
|
|
double * |
rel, |
|
|
double |
wx, |
|
|
double |
wwNsqr |
|
) |
| |
Definition at line 38 of file weight0.c.
41 int i,
j, e1, ecu, ecl, ec;
43 double gfmax, gecart, ghom, pfmax;
49 gecart = (double)0.4 + (
double)npol;
51 for (i = 0; i < npol; i++)
53 ecl = ecu = e1 = *ex++;
54 for (j = lpol[i] - 1; j!=0; j--)
62 pfmax = (double)ecl / (
double)ecu;
65 pfmax = (double)e1 / (
double)ecu;
66 if (pfmax > (
double)0.5)
67 gecart -= (pfmax * pfmax);
69 gecart -= (double)0.25;
71 gfmax += (double)(ecu * ecu) * (*r++);
73 if (ghom > (
double)0.8)
76 gecart *= ((double)5.0 - ghom);
78 return (gfmax * gecart) /
pow(wx, wNsqr);
Rational pow(const Rational &a, int e)
Definition at line 356 of file weight0.c.
385 for (i =
n; i!=0 ; i--)
const CanonicalForm CFMap CFMap int &both_non_zero int n
| void wNorm |
( |
int * |
degw, |
|
|
int * |
lpol, |
|
|
int |
npol, |
|
|
double * |
rel |
|
) |
| |
Definition at line 467 of file weight0.c.
475 for (i = 0; i < npol; i++)
478 for (j = lpol[i] - 1; j!=0 ; j--)
484 *r = (double)1.0 / (
double)(ecu * ecu);
| static double wPrWeight |
( |
int * |
x, |
|
|
int |
n |
|
) |
| |
|
static |
Definition at line 229 of file weight0.c.
235 for (i =
n - 1; i!=0 ; i--)
const CanonicalForm int const CFList const Variable & y
const CanonicalForm CFMap CFMap int &both_non_zero int n
| void wSecondSearch |
( |
int * |
A, |
|
|
int * |
x, |
|
|
int * |
lpol, |
|
|
int |
npol, |
|
|
int |
mons, |
|
|
double * |
rel, |
|
|
double * |
fk, |
|
|
double |
wNsqr, |
|
|
int |
rvar |
|
) |
| |
Definition at line 299 of file weight0.c.
302 int n, s0, s1, s2, *xopt;
307 fopt = *fk * (double)0.999999999999;
311 wEstimate(
A,
x, lpol, npol, mons, wx, rel, &fx, &s0, &s1, &s2, wNsqr, rvar);
330 memcpy(xopt,
x + 1, n *
sizeof(
int));
338 memcpy(xopt,
x + 1, n *
sizeof(
int));
344 wSub(
A, mons, s0, 1, rvar);
347 wSub(
A, mons, s1, 1, rvar);
348 wSub(
A, mons, s2, 1, rvar);
static double wPrWeight(int *x, int n)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static void wSub(int *A, int mons, int kn, int xx, int rvar)
static void wEstimate(int *A, int *x, int *lpol, int npol, int mons, double wx, double *rel, double *fopt, int *s0, int *s1, int *s2, double wNsqr, int rvar)
Definition at line 116 of file weight0.c.
120 B =
A + ((kn - 1) * mons);
121 ex =
A + (rvar * mons);
131 *ex++ -= (*
B++) * xx;
| short* ecartWeights =NULL |
| double(* wFunctional) (int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr) |