Graphviz 16.0.1~dev.20260815.2250
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 v2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.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
52extern double drand(void);
53
54double *vector_subtract_to(size_t n, double *x, double *y);
55
56double vector_product(int n, double *x, double *y);
57
58double *vector_saxpy(size_t n, double *x, double *y, double beta);
59
60double *vector_saxpy2(size_t n, double *x, double *y, double beta);
61
62/* take m elements v[p[i]]],i=1,...,m and oput in u. u will be assigned if *u = NULL */
63void vector_float_take(size_t n, float *v, size_t m, size_t *p, float **u);
64
68size_t *vector_ordering(size_t n, double *v);
69
70#define MACHINEACC 1.0e-16
71#define SQRT_MACHINEACC 1.0e-8
72
73#define MINDIST 1.e-15
74
75enum {UNMATCHED = -1};
76
77
78double distance(double *x, int dim, int i, int j);
79double distance_cropped(double *x, int dim, int i, int j);
80
81double point_distance(double *p1, double *p2, int dim);
82
83char *strip_dir(char *s);
84
85#ifdef __cplusplus
86}
87#endif
abstract graph C library, Cgraph API
size_t * vector_ordering(size_t n, double *v)
Definition general.c:84
double * vector_saxpy(size_t n, double *x, double *y, double beta)
y = x+beta*y
Definition general.c:41
double drand(void)
Definition general.c:25
char * strip_dir(char *s)
Definition general.c:116
double distance(double *x, int dim, int i, int j)
Definition general.c:100
@ UNMATCHED
Definition general.h:75
double vector_product(int n, double *x, double *y)
Definition general.c:34
double * vector_subtract_to(size_t n, double *x, double *y)
y = x-y
Definition general.c:29
double * vector_saxpy2(size_t n, double *x, double *y, double beta)
x = x+beta*y
Definition general.c:47
void vector_float_take(size_t n, float *v, size_t m, size_t *p, float **u)
Definition general.c:53
double distance_cropped(double *x, int dim, int i, int j)
Definition general.c:95
double point_distance(double *p1, double *p2, int dim)
Definition general.c:108
static bool Verbose
Definition gml2gv.c:26
static const int dim
Definition grammar.c:90