Debian Codegraph @

lib/sparse/general.h

raw
1 /*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11 #pragma once
12
13 #include <stdlib.h>
14 #include <stdio.h>
15 #include <math.h>
16 #include <string.h>
17 #include <assert.h>
18 #include <util/exit.h>
19 /* Applications that do not use the common library can define STANDALONE
20 * to get definitions/definitions that are normally provided there.
21 * In particular, note that Verbose is declared but undefined.
22 */
23 #ifndef STANDALONE
24 #include "cgraph.h"
25 #include "globals.h"
26 #include "arith.h"
27 #endif /* STANDALONE */
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #ifdef STANDALONE
34
35 #define MAX(a,b) ((a)>(b)?(a):b)
36 #define MIN(a,b) ((a)<(b)?(a):b)
37
38 #define POINTS(inch) 72*(inch)
39
40 #ifdef GVDLL
41 __declspec(dllimport) extern unsigned char Verbose;
42 #else
43 extern unsigned char Verbose;
44 #endif
45
46 #endif /* STANDALONE */
47
48 #ifdef DEBUG
49 extern double _statistics[10];
50 #endif
51
52 extern double drand(void);
53
54 double* vector_subtract_to(int n, double *x, double *y);/* y = x-y */
55
56 double vector_product(int n, double *x, double *y);
57
58 double* vector_saxpy(int n, double *x, double *y, double beta); /* y = x+beta*y */
59
60
61 double* vector_saxpy2(int n, double *x, double *y, double beta);/* x = x+beta*y */
62
63 /* take m elements v[p[i]]],i=1,...,m and oput in u. u will be assigned if *u = NULL */
64 void vector_float_take(int n, float *v, int m, int *p, float **u);
65
66 /* give the position of the smallest, second smallest etc in vector v.
67 results in p. If *p == NULL, p is assigned.
68 */
69 void vector_ordering(int n, double *v, int **p);
70 void vector_sort_int(int n, int *v);
71
72 #define MACHINEACC 1.0e-16
73 #define SQRT_MACHINEACC 1.0e-8
74
75 #define MINDIST 1.e-15
76
77 enum {UNMATCHED = -1};
78
79
80 double distance(double *x, int dim, int i, int j);
81 double distance_cropped(double *x, int dim, int i, int j);
82
83 double point_distance(double *p1, double *p2, int dim);
84
85 char *strip_dir(char *s);
86
87 #ifdef __cplusplus
88 }
89 #endif