summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--charf.c12
-rw-r--r--double-error.c6
-rw-r--r--double-error.h4
-rw-r--r--double.c4
-rw-r--r--double.h4
-rw-r--r--ratio.c4
-rw-r--r--ratio.h4
7 files changed, 19 insertions, 19 deletions
diff --git a/charf.c b/charf.c
index 6c8943b..3dd9d5e 100644
--- a/charf.c
+++ b/charf.c
@@ -28,7 +28,7 @@
#define EXPTYPE double
#endif
-/*length of the support of f*/
+/*maximum length of the support of f*/
static const int N=16;
/*given function df[0] on domain [0,M-1], compute derivatives f' until f^{(K)} and store f^{(K)} in df*/
@@ -54,7 +54,7 @@ void differentiate(VALUETYPE* f, VALUETYPE* df, int D, int K){
/*given function f on domain [0,D-1] compute pth root of integral of |f|^p*/
VALUETYPE integratep(VALUETYPE* f, EXPTYPE p, int D){
- VALUETYPE integralp = convert_int(0);
+ VALUETYPE integralp = int_to_valuetype(0);
for(int i=0;i<D;i++){
VALUETYPE padd = power(absolute(f[i]),p);
integralp = sum(integralp,padd);
@@ -84,7 +84,7 @@ void compute_maximalfunction(VALUETYPE* f, VALUETYPE* Mf, int D){
/*Recursively compute all integrals and averages over intervals of increasing length*/
for(int i=0; i<D; i++){
Sf[i][(i+n)%D] = sum(Sf[i][(i+n-1)%D], f[(i+n)%D]);
- Af[i][(i+n)%D] = ratio(Sf[i][(i+n)%D],convert_int(n+1));
+ Af[i][(i+n)%D] = ratio(Sf[i][(i+n)%D],int_to_valuetype(n+1));
}
}
@@ -177,7 +177,7 @@ int generate_function(VALUETYPE* f, int i){
else {
int t = i-s+1;
/*Set f to the values encoded in bit string t which is a value between 1 and powd = (1<<d)-2.*/
- for(int n=0; n<d; n++) f[n] = convert_int((t >> n) & 1);
+ for(int n=0; n<d; n++) f[n] = int_to_valuetype((t >> n) & 1);
return d;
}
}
@@ -189,7 +189,7 @@ int generate_function(VALUETYPE* f, int i){
void* compute_chunk(void* arguments){
int i = *((int*)arguments);
int K = 3;
- EXPTYPE p = to_exptype(1);
+ EXPTYPE p = int_to_exptype(1);
VALUETYPE f[N];
int d = generate_function(f,i);
@@ -202,7 +202,7 @@ void* compute_chunk(void* arguments){
int main() {
/*exponent p of the L^p norm to consider*/
- EXPTYPE p = to_exptype(1);
+ EXPTYPE p = int_to_exptype(1);
pthread_t threads[NUM_THREADS];
int args[NUM_THREADS];
diff --git a/double-error.c b/double-error.c
index d5bac3d..7d11a92 100644
--- a/double-error.c
+++ b/double-error.c
@@ -7,14 +7,14 @@
typedef struct {double v; double e;} double_error;
-double_error convert_int(int i){
+double_error int_to_valuetype(int i){
double_error de;
de.v = (double) i;
de.e = EPS*abs(i);
return de;
}
-double_error to_exptype(double d){
+double_error int_to_exptype(double d){
double_error de;
de.v = d;
de.e = EPS*fabs(d) + DBL_MIN;
@@ -110,7 +110,7 @@ double_error power(double_error de, double_error p) {
double to_double(double_error de){ return de.v; }
bool root_to_string(char* s, double_error de, double_error p){
- double_error de1p = power(de,ratio(convert_int(1),p));
+ double_error de1p = power(de,ratio(int_to_valuetype(1),p));
to_string(s,de1p);
return true;
}
diff --git a/double-error.h b/double-error.h
index 23b78d9..bacc8e7 100644
--- a/double-error.h
+++ b/double-error.h
@@ -1,8 +1,8 @@
typedef struct {double v; double e;} double_error;
-double_error convert_int(int);
+double_error int_to_valuetype(int);
-double_error to_exptype(double);
+double_error int_to_exptype(double);
bool is_greater(double_error,double_error);
diff --git a/double.c b/double.c
index f86a586..1572759 100644
--- a/double.c
+++ b/double.c
@@ -2,9 +2,9 @@
#include <math.h>
#include <stdio.h>
-double convert_int(int i){ return (double) i; }
+double int_to_valuetype(int i){ return (double) i; }
-double to_exptype(double d){ return d; }
+double int_to_exptype(double d){ return d; }
double sum(double d1, double d2){ return d1+d2; }
diff --git a/double.h b/double.h
index 98949b1..9a26970 100644
--- a/double.h
+++ b/double.h
@@ -1,6 +1,6 @@
-double convert_int(int);
+double int_to_valuetype(int);
-double to_exptype(double);
+double int_to_exptype(double);
bool is_greater(double,double);
diff --git a/ratio.c b/ratio.c
index 3b38ea7..ad2b0ea 100644
--- a/ratio.c
+++ b/ratio.c
@@ -28,7 +28,7 @@ num safe_product(num n1, num n2){
}
}
-rational convert_int(int i){
+rational int_to_valuetype(int i){
rational r;
r.d = 1;
r.n = abs(i);
@@ -36,7 +36,7 @@ rational convert_int(int i){
return r;
}
-unsigned int to_exptype(unsigned int i){ return i; }
+unsigned int int_to_exptype(unsigned int i){ return i; }
num gcd(num a, num b){
num c;
diff --git a/ratio.h b/ratio.h
index cd50c8e..1f54781 100644
--- a/ratio.h
+++ b/ratio.h
@@ -4,9 +4,9 @@
typedef struct {bool s; unsigned long long n; unsigned long long d;} rational;
-rational convert_int(int);
+rational int_to_valuetype(int);
-unsigned int to_exptype(unsigned int);
+unsigned int int_to_exptype(unsigned int);
bool is_greater(rational,rational);