Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
general.h
Go to the documentation of this file.
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
30extern "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
43extern unsigned char Verbose;
44#endif
45
46#endif /* STANDALONE */
47
48#ifdef DEBUG
49extern double _statistics[10];
50#endif
51
52
53extern int irand(int n);
54extern double drand(void);
55extern int *random_permutation(int n);/* random permutation of 0 to n-1 */
56
57
58double* vector_subtract_to(int n, double *x, double *y);/* y = x-y */
59
60double vector_product(int n, double *x, double *y);
61
62double* vector_saxpy(int n, double *x, double *y, double beta); /* y = x+beta*y */
63
64
65double* vector_saxpy2(int n, double *x, double *y, double beta);/* x = x+beta*y */
66
67/* take m elements v[p[i]]],i=1,...,m and oput in u. u will be assigned if *u = NULL */
68void vector_float_take(int n, float *v, int m, int *p, float **u);
69
70/* give the position of the smallest, second smallest etc in vector v.
71 results in p. If *p == NULL, p is assigned.
72*/
73void vector_ordering(int n, double *v, int **p);
74void vector_sort_int(int n, int *v);
75
76#define MACHINEACC 1.0e-16
77#define SQRT_MACHINEACC 1.0e-8
78
79#define MINDIST 1.e-15
80
81enum {UNMATCHED = -1};
82
83
84double distance(double *x, int dim, int i, int j);
85double distance_cropped(double *x, int dim, int i, int j);
86
87double point_distance(double *p1, double *p2, int dim);
88
89char *strip_dir(char *s);
90
91#ifdef __cplusplus
92}
93#endif
abstract graph C library, Cgraph API
int * random_permutation(int n)
Definition general.c:33
@ UNMATCHED
Definition general.h:81
double * vector_saxpy(int n, double *x, double *y, double beta)
Definition general.c:64
double drand(void)
Definition general.c:22
double * vector_saxpy2(int n, double *x, double *y, double beta)
Definition general.c:71
char * strip_dir(char *s)
Definition general.c:161
void vector_ordering(int n, double *v, int **p)
Definition general.c:115
double distance(double *x, int dim, int i, int j)
Definition general.c:145
double vector_product(int n, double *x, double *y)
Definition general.c:57
void vector_float_take(int n, float *v, int m, int *p, float **u)
Definition general.c:78
void vector_sort_int(int n, int *v)
Definition general.c:136
int irand(int n)
Definition general.c:26
double * vector_subtract_to(int n, double *x, double *y)
Definition general.c:51
double distance_cropped(double *x, int dim, int i, int j)
Definition general.c:140
double point_distance(double *p1, double *p2, int dim)
Definition general.c:153
static bool Verbose
Definition gml2gv.c:23
static const int dim
Definition grammar.c:93