/usr/include/ap_coeff.h is in libapron-dev 0.9.10-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | /* ************************************************************************* */
/* ap_coeff.h: coefficients, that are either scalars or intervals */
/* ************************************************************************* */
/* This file is part of the APRON Library, released under LGPL license. Please
read the COPYING file packaged in the distribution */
#ifndef _AP_COEFF_H_
#define _AP_COEFF_H_
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include "ap_config.h"
#include "ap_scalar.h"
#include "ap_interval.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum ap_coeff_discr_t {
AP_COEFF_SCALAR,
AP_COEFF_INTERVAL
} ap_coeff_discr_t;
/* Discriminant for coefficients */
typedef struct ap_coeff_t {
ap_coeff_discr_t discr; /* discriminant for coefficient */
union {
ap_scalar_t* scalar; /* cst (normal linear expression) */
ap_interval_t* interval; /* interval (quasi-linear expression) */
} val;
} ap_coeff_t;
/* ====================================================================== */
/* Basics */
/* ====================================================================== */
ap_coeff_t* ap_coeff_alloc(ap_coeff_discr_t ap_coeff_discr);
/* Initialization, specifying the type of the coefficient */
void ap_coeff_reinit(ap_coeff_t* coeff, ap_coeff_discr_t ap_coeff_discr, ap_scalar_discr_t ap_scalar_discr);
/* Changing the type of scalar(s) and the type of the coefficient */
void ap_coeff_free(ap_coeff_t* a);
/* Free a coefficient */
void ap_coeff_fprint(FILE* stream, ap_coeff_t* a);
static inline
void ap_coeff_print(ap_coeff_t* a)
{ ap_coeff_fprint(stdout,a); }
/* Printing */
void ap_coeff_reduce(ap_coeff_t* coeff);
/* If the coefficient is an interval [a;a], convert it to a scalar */
static inline
void ap_coeff_swap(ap_coeff_t* a, ap_coeff_t* b)
{ ap_coeff_t t = *a; *a = *b; *b = t; }
/* Exchange */
/* ====================================================================== */
/* Assignments */
/* ====================================================================== */
void ap_coeff_set(ap_coeff_t* a, ap_coeff_t* b);
/* Assignment */
void ap_coeff_set_scalar(ap_coeff_t* coeff, ap_scalar_t* scalar);
void ap_coeff_set_scalar_mpq(ap_coeff_t* coeff, mpq_t mpq);
void ap_coeff_set_scalar_int(ap_coeff_t* coeff, long int num);
void ap_coeff_set_scalar_frac(ap_coeff_t* coeff, long int num, unsigned long int den);
void ap_coeff_set_scalar_double(ap_coeff_t* coeff, double num);
void ap_coeff_set_scalar_mpfr(ap_coeff_t* coeff, mpfr_t mpfr);
/* Assign a coefficient of type SCALAR, with resp.
- a coeff
- a rational of type mpq_t, converted to type MPQ
- an integer, converted to type MPQ
- a rational, converted to type MPQ
- a double, converted to type DOUBLE
- a MPFR, converted to type MPFR
*/
void ap_coeff_set_interval(ap_coeff_t* coeff, ap_interval_t* itv);
void ap_coeff_set_interval_scalar(ap_coeff_t* coeff, ap_scalar_t* inf, ap_scalar_t* sup);
void ap_coeff_set_interval_mpq(ap_coeff_t* coeff, mpq_t inf, mpq_t sup);
void ap_coeff_set_interval_int(ap_coeff_t* coeff, long int inf, long int sup);
void ap_coeff_set_interval_frac(ap_coeff_t* coeff,
long int numinf, unsigned long int deninf,
long int numsup, unsigned long int densup);
void ap_coeff_set_interval_double(ap_coeff_t* coeff, double inf, double sup);
void ap_coeff_set_interval_top(ap_coeff_t* coeff);
void ap_coeff_set_interval_mpfr(ap_coeff_t* coeff, mpfr_t inf, mpfr_t sup);
/* Assign a coefficient of type INTERVAL, with resp.
- an interval of coeff
- an interval of rationals of type MPQ
- an interval of integers, converted to type MPQ
- an interval of rationals, converted to type MPQ
- an interval of double, converted to type DOUBLE
- an interval of MPFR, converted to type MPFR
- a top interval (type not precised).
*/
/* ====================================================================== */
/* Combined allocation and assignment */
/* ====================================================================== */
ap_coeff_t* ap_coeff_alloc_set(ap_coeff_t* coeff);
ap_coeff_t* ap_coeff_alloc_set_scalar(ap_scalar_t* scalar);
ap_coeff_t* ap_coeff_alloc_set_interval(ap_interval_t* interval);
/* ====================================================================== */
/* Tests */
/* ====================================================================== */
int ap_coeff_cmp(ap_coeff_t* coeff1, ap_coeff_t* coeff2);
/* Non Total Comparison:
- If the 2 coefficients are both scalars, corresp. to ap_scalar_cmp
- If the 2 coefficients are both intervals, corresp. to ap_interval_cmp
- otherwise, -3 if the first is a scalar, 3 otherwise
*/
bool ap_coeff_equal(ap_coeff_t* coeff1, ap_coeff_t* coeff2);
/* Equality */
bool ap_coeff_zero(ap_coeff_t* coeff);
/* Return true iff coeff is a zero scalar or an interval with zero bounds */
bool ap_coeff_equal_int(ap_coeff_t* coeff, int i);
/* Return true iff coeff is a scalar equals to i or an interval with bounds equal to i */
/* ====================================================================== */
/* Other operations */
/* ====================================================================== */
void ap_coeff_neg(ap_coeff_t* a, ap_coeff_t* b);
/* Negation */
long ap_coeff_hash(ap_coeff_t* coeff);
/* Hash code */
/* ====================================================================== */
/* FOR INTERNAL USE ONLY */
/* ====================================================================== */
void ap_coeff_init(ap_coeff_t* coeff, ap_coeff_discr_t ap_coeff_discr);
void ap_coeff_init_set(ap_coeff_t* coeff, ap_coeff_t* coeff2);
void ap_coeff_clear(ap_coeff_t* coeff);
#ifdef __cplusplus
}
#endif
#endif
|