Graphviz 15.1.1~dev.20260630.1303
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, int *p, float **u);
64
65/* give the position of the smallest, second smallest etc in vector v.
66 results in p. If *p == NULL, p is assigned.
67*/
68void vector_ordering(size_t n, double *v, int **p);
69void vector_sort_int(int n, int *v);
70
71#define MACHINEACC 1.0e-16
72#define SQRT_MACHINEACC 1.0e-8
73
74#define MINDIST 1.e-15
75
76enum {UNMATCHED = -1};
77
78
79double distance(double *x, int dim, int i, int j);
80double distance_cropped(double *x, int dim, int i, int j);
81
82double point_distance(double *p1, double *p2, int dim);
83
84char *strip_dir(char *s);
85
86#ifdef __cplusplus
87}
88#endif
abstract graph C library, Cgraph API
void vector_ordering(size_t n, double *v, int **p)
Definition general.c:88
double * vector_saxpy(size_t n, double *x, double *y, double beta)
y = x+beta*y
Definition general.c:40
double drand(void)
Definition general.c:24
char * strip_dir(char *s)
Definition general.c:132
double distance(double *x, int dim, int i, int j)
Definition general.c:116
double vector_product(int n, double *x, double *y)
Definition general.c:33
double * vector_subtract_to(size_t n, double *x, double *y)
y = x-y
Definition general.c:28
void vector_float_take(size_t n, float *v, size_t m, int *p, float **u)
Definition general.c:52
double * vector_saxpy2(size_t n, double *x, double *y, double beta)
x = x+beta*y
Definition general.c:46
void vector_sort_int(int n, int *v)
Definition general.c:107
double distance_cropped(double *x, int dim, int i, int j)
Definition general.c:111
double point_distance(double *p1, double *p2, int dim)
Definition general.c:124
@ UNMATCHED
Definition general.h:76
static bool Verbose
Definition gml2gv.c:26
static const int dim
Definition grammar.c:90