#define STANDALONE
#include "country_graph_coloring.h"
+#include <math.h>
#include "power.h"
/* #include "general.h" */
norm[0] = n; norm[1] = 0;
for (j = ia[i]; j < ia[i+1]; j++){
if (ja[j] == i) continue;
- norm[0] = MIN(norm[0], ABS(p[i] - p[ja[j]]));
+ norm[0] = MIN(norm[0], abs(p[i] - p[ja[j]]));
nz++;
- norm[1] += ABS(p[i] - p[ja[j]]);
+ norm[1] += abs(p[i] - p[ja[j]]);
}
if (nz > 0) norm[1] /= nz;
}
tmp = n;
for (j = ia[i]; j < ia[i+1]; j++){
if (ja[j] == i) continue;
- norm[0] = MIN(norm[0], ABS(p[i] - p[ja[j]]));
- norm[1] += ABS(p[i] - p[ja[j]]);
- tmp = MIN(tmp, ABS(p[i] - p[ja[j]]));
+ norm[0] = MIN(norm[0], abs(p[i] - p[ja[j]]));
+ norm[1] += abs(p[i] - p[ja[j]]);
+ tmp = MIN(tmp, abs(p[i] - p[ja[j]]));
nz++;
}
norm[2] += tmp;
pmin[u] = n; pmax[u] = -1; aband_u = n;
for (j = ia[u]; j < ia[u+1]; j++) {
if (ja[j] == u) continue;
- pmin[u] = MIN(pmin[u], ABS(p[u] - p[ja[j]]));
- pmax[u] = MIN(pmax[u], ABS(p[u] - p[ja[j]]));
- aband_u = MIN(aband_u, ABS(p[u] - p[ja[j]]));
+ pmin[u] = MIN(pmin[u], abs(p[u] - p[ja[j]]));
+ pmax[u] = MIN(pmax[u], abs(p[u] - p[ja[j]]));
+ aband_u = MIN(aband_u, abs(p[u] - p[ja[j]]));
}
aband_local[u] = aband_u;
}
/* if swaping u and v makes v worse & becomes/remains critical, don't do. We first quick check using the max/min neighbor indices.
No need to check the other way around since the calling function have ensured that.
*/
- if (ABS(p_u - pmin[v]) < aband_v && ABS(p_u - pmin[v]) <= lambda*aband) return FALSE;
- if (ABS(p_u - pmax[v]) < aband_v && ABS(p_u - pmax[v]) <= lambda*aband) return FALSE;
+ if (abs(p_u - pmin[v]) < aband_v && abs(p_u - pmin[v]) <= lambda*aband) return FALSE;
+ if (abs(p_u - pmax[v]) < aband_v && abs(p_u - pmax[v]) <= lambda*aband) return FALSE;
/* now check in details whether v should swap to u. Do not accept if this makes the antiband width of u worse */
aband_u1 = n;
for (j = ja[u]; j < ja[u+1]; j++){
if (ja[j] == u) continue;
- if (ABS(p_v - p[ja[j]]) < aband_u) {
+ if (abs(p_v - p[ja[j]]) < aband_u) {
return FALSE;
}
- aband_u1 = MIN(aband_u1, ABS(p_v - p[ja[j]]));
+ aband_u1 = MIN(aband_u1, abs(p_v - p[ja[j]]));
}
/* now check in details whether u should swap to v. Do not accept if this makes antibandwidth of v worse && make/keep v in the critical group */
aband_v1 = n;
for (j = ja[v]; j < ja[v+1]; j++){
if (ja[j] == v) continue;
- if (ABS(p_u - p[ja[j]]) < aband_v && ABS(p_u - p[ja[j]]) <= lambda*aband) {
+ if (abs(p_u - p[ja[j]]) < aband_v && abs(p_u - p[ja[j]]) <= lambda*aband) {
return FALSE;
}
- aband_v1 = MIN(aband_v1, ABS(p_u - p[ja[j]]));
+ aband_v1 = MIN(aband_v1, abs(p_u - p[ja[j]]));
}
/* now check if local antiband width has been improved. By that we mean u is improved, or u unchanged, but v improved. */
if (ja[j] == i) continue;
pmax[i] = MAX(pmax[i], p[ja[j]]);
pmin[i] = MIN(pmin[i], p[ja[j]]);
- aband_local[i] = MIN(aband_local[i], ABS(p[i] - p[ja[j]]));
+ aband_local[i] = MIN(aband_local[i], abs(p[i] - p[ja[j]]));
}
aband = MIN(aband, aband_local[i]);
}
#define STANDALONE
#include "SparseMatrix.h"
#include "general.h"
+#include <math.h>
#include "QuadTree.h"
#include "string.h"
/* #include "types.h" */
yp = MALLOC(sizeof(float)*maxlen);
if (Verbose) fprintf(stderr,"npolys = %d\n",npolys);
- first = ABS(a[0]); ipoly = first + 1;
+ first = abs(a[0]); ipoly = first + 1;
for (i = 0; i < npolys; i++){
np = 0;
for (j = ia[i]; j < ia[i+1]; j++){
assert(ja[j] < nverts && ja[j] >= 0);
- if (ABS(a[j]) != ipoly){/* the first poly, or a hole */
- ipoly = ABS(a[j]);
+ if (abs(a[j]) != ipoly){/* the first poly, or a hole */
+ ipoly = abs(a[j]);
is_river = (a[j] < 0);
if (r && g && b) {
rgb2hex(r[polys_groups[i]], g[polys_groups[i]], b[polys_groups[i]], cstring, opacity);
yp = MALLOC(sizeof(float)*maxlen);
if (Verbose) fprintf(stderr,"npolys = %d\n",npolys);
- first = ABS(a[0]); ipoly = first + 1;
+ first = abs(a[0]); ipoly = first + 1;
for (i = 0; i < npolys; i++){
np = 0;
for (j = ia[i]; j < ia[i+1]; j++){
assert(ja[j] < nverts && ja[j] >= 0);
- if (ABS(a[j]) != ipoly){/* the first poly, or a hole */
- ipoly = ABS(a[j]);
+ if (abs(a[j]) != ipoly){/* the first poly, or a hole */
+ ipoly = abs(a[j]);
is_river = (a[j] < 0);
if (r && g && b) {
rr = r[polys_groups[i]]; gg = g[polys_groups[i]]; bb = b[polys_groups[i]];
*/
#include "dot.h"
+#include <math.h>
#ifdef ORTHO
#include <ortho.h>
t0 = ND_rank(agtail(le0)) - ND_rank(aghead(le0));
t1 = ND_rank(agtail(le1)) - ND_rank(aghead(le1));
- v0 = ABS((int)t0); /* ugly, but explicit as to how we avoid equality tests on fp numbers */
- v1 = ABS((int)t1);
+ v0 = abs((int)t0); /* ugly, but explicit as to how we avoid equality tests on fp numbers */
+ v1 = abs((int)t1);
if (v0 != v1)
return (v0 - v1);
t0 = ND_coord(agtail(le0)).x - ND_coord(aghead(le0)).x;
t1 = ND_coord(agtail(le1)).x - ND_coord(aghead(le1)).x;
- v0 = ABS((int)t0);
- v1 = ABS((int)t1);
+ v0 = abs((int)t0);
+ v1 = abs((int)t1);
if (v0 != v1)
return (v0 - v1);
e = ED_to_orig(e);
hn = aghead(e);
tn = agtail(e);
- delr = ABS(ND_rank(hn)-ND_rank(tn));
+ delr = abs(ND_rank(hn)-ND_rank(tn));
if ((delr == 1) || ((delr == 2) && (GD_has_labels(g->root) & EDGE_LABEL)))
return 0;
if (agtail(fe) == agtail(e)) {
sl = 0;
e = edges[ind];
hackflag = FALSE;
- if (ABS(ND_rank(agtail(e)) - ND_rank(aghead(e))) > 1) {
+ if (abs(ND_rank(agtail(e)) - ND_rank(aghead(e))) > 1) {
fwdedgeai = *(Agedgeinfo_t*)e->base.data;
fwdedgea.out = *e;
fwdedgea.in = *AGOUT2IN(e);
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************/
+#include <math.h>
#include "neato.h"
#include "pathutil.h"
#include <setjmp.h>
if (i[2] > 0)
return 0;
if (!intpoint
- (l, m, &x, &y, (i[2] < 0) ? 3 : online(m, l, ABS(i[0]))))
+ (l, m, &x, &y, (i[2] < 0) ? 3 : online(m, l, abs(i[0]))))
return 0;
}
else if (!intpoint(l, m, &x, &y, (i[0] == i[1]) ?
2 * MAX(online(l, m, 0),
- online(l, m, 1)) : online(l, m, ABS(i[0]))))
+ online(l, m, 1)) : online(l, m, abs(i[0]))))
return 0;
#ifdef RECORD_INTERSECTS
int d, x, y, ax, ay, sx, sy, dx, dy;
dx = x2 - x1;
- ax = ABS(dx) << 1;
+ ax = abs(dx) << 1;
sx = SGN(dx);
dy = y2 - y1;
- ay = ABS(dy) << 1;
+ ay = abs(dy) << 1;
sy = SGN(dy);
/* fprintf (stderr, "fillLine %d %d - %d %d\n", x1,y1,x2,y2); */
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************/
+#include <math.h>
#include <stdio.h>
#include "simple.h"
#include <stdlib.h>
if (i[2] > 0)
return;
if (!intpoint
- (l, m, &x, &y, (i[2] < 0) ? 3 : online(m, l, ABS(i[0]))))
+ (l, m, &x, &y, (i[2] < 0) ? 3 : online(m, l, abs(i[0]))))
return;
}
else if (!intpoint(l, m, &x, &y, (i[0] == i[1]) ?
2 * MAX(online(l, m, 0),
- online(l, m, 1)) : online(l, m, ABS(i[0]))))
+ online(l, m, 1)) : online(l, m, abs(i[0]))))
return;
if (input->ninters >= MAXINTS) {