-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpe.h
More file actions
31 lines (25 loc) · 1.04 KB
/
Copy pathcpe.h
File metadata and controls
31 lines (25 loc) · 1.04 KB
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
/* Compute CPE for function */
/* Compute for function that is linear in some parameter cnt */
typedef void (*elem_fun_t)(long int);
/* Different ways of finding samples
UNI_SAMPLE: samples uniformly spaced between bias*maxcnt and maxcnt
RAN_SAMPLE: samples randomly selected between bias*maxcnt and maxcnt
*/
typedef enum {UNI_SAMPLE, RAN_SAMPLE}
sample_t;
/* Find cpe for function f, which allows cnt up to maxcnt.
Uses default parameters
*/
double find_cpe(elem_fun_t f, long int maxcnt);
/* Find cpe for function f, which allows cnt up to maxcnt, using
specified number of sample points.
If data_file, then print data so that can plot points with Excel
smethod determines method for generating samples
*/
double find_cpe_full(elem_fun_t f, long int maxcnt, long int samples, FILE *data_file,
sample_t smethod, double bias, long int verbose);
/* Find number of cycles taken by function.
Do this by running number of trials until best two within TOL (2%) of
each other
*/
double measure_function(elem_fun_t f, long int cnt);