#ifndef aa_compile_H #define aa_compile_H /* aa_compile.h -- Compile pcode functions to C routine that calls AA ops */ /* Last edited on 2021-06-26 22:09:51 by jstolfi */ #define _GNU_SOURCE_ #include #include #include #include void aa_compile( pcode_proc_t *p, /* The expression in p-code format. */ bool_t **arg_depends, /* Dependency between arguments and shared epsilons. */ bool_t **res_depends, /* Required depcy between results and shared epsilons. */ int32_t shared_ne, /* Number of shared epsilons */ char *proc_name, /* Name of generated procedure */ FILE *c_file /* File for C code */ ); /* Compiles a p-code expression into a C program that evaluates it using affine arithmetic. In what follows, a "value" is a distinct affine form created in the course of one interpretation of the p-code {p}. Values are numbered from 0 to nv-1. The procedure assumes that the arguments of {p} depend on {shared_ne} "shared" epsilons; and, more exactly, that argument {iv} of {p} depends on the {ie}th epsilon iff arg_depends[iv][ie] is TRUE, for {iv} in {[0..p->nin-1]}, and {ie} in {[0..shared_ne-1]}. In addition, each argument is assumed to depend on a "specific" epsilon, referenced only by that argument, which is not included in {shared_ne} nor in {arg_depends}. (This last feature is intended to simplify the use of this procedure in the special case where the inputs to the p-code are ordinary intervals. In that case the {arg_depends} and {res_depends} tables are The C code generated by aa_compile will take as parameters the coefficients of the affine forms that are input to {p}. More precisely, let {x} be argument number {iv} of {p}; the C procedure will expect {x} to be passed as the following separate Float parameters: * the central value {x_ctr}; * one coefficient {x_ie} for every {ie} that has arg_depends[iv][ie] == TRUE * one coefficient {x_{arg_ne+iv}} for the "specific" epsilon of {x}. The compiled C procedure will return the results through separate Float* arguments. Specifically, if {z} is result number {ir} of {p}, its affine form will be returned in the following Float* parameters: * the central value {z_ctr} * one coefficient {z_ie} for each {ie} in [0..shared_ne-1] that has res_depends[ir][ie] == TRUE; * one coefficient {z_{(shared_ne+p->nin)+ir}} for the remaining uncertainty of {z}. Note that the result will not record any correlations between the results which are due to sharing of the "specific" argument epsilons, or epsilons that represent internal truncation errors. The former correlations can be recovered by using shared epsilons in the argument forms, instead of specific epsilons. */ #endif