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