From 01f37f5a70891532f62925fab41b82fe9a194789 Mon Sep 17 00:00:00 2001 From: Julian Weigt Date: Mon, 22 Dec 2025 14:44:12 +0000 Subject: charf.c: - Define function to compute maximal function. - Define type of function values as c macro. - Use same type also for initiating f. --- charf.c | 181 ++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 96 insertions(+), 85 deletions(-) diff --git a/charf.c b/charf.c index a99508e..5ce7321 100644 --- a/charf.c +++ b/charf.c @@ -2,10 +2,18 @@ #include #include +#define EXACT false +#define VALUETYPE double +#define EXPTYPE double -/*given function f on domain [0,D-1], compute derivatives f^{(0)} until f^{(K)} and store them in df*/ -void differentiate(double* f, double** df, int D, int K){ - df[0] = f; +#if EXACT +#define VALUETYPE ratio +#define EXPTYPE int +#endif + + +/*given function df[0] on domain [0,D-1], compute derivatives f' until f^{(K)} and store them in df[1] to df[K]*/ +void differentiate(VALUETYPE** df, int D, int K){ int i; for(int k=1; k<=K; k++){ /*compute kth derivative of f from (k-1)th*/ @@ -17,82 +25,85 @@ void differentiate(double* f, double** df, int D, int K){ } /*given function f on domain [0,D-1] compute pth root of integral of |f|^p*/ -double integrate(double* f, double p, int D){ - double sum = 0.0; +VALUETYPE integrate(VALUETYPE* f, EXPTYPE p, int D){ + VALUETYPE sum = 0.0; for(int i=0;i Mf[i]) Mf[i] = Af[i][j]; + + for(int n=1;n Mf[i]) Mf[i] = Af[i][j]; + } + } + + /*Print computed functions and averages*/ + //printf("Mf "); + //for(int i=0;i> i) & 1; + f[2*N+i+K/2] = (VALUETYPE) ((t >> i) & 1); //if(i%3==0) f[2*N+i+K/2] = 1; } /*Compute ||Mf^{(k)}||_p/||f^{(k)}||_p.*/ @@ -158,7 +169,7 @@ for(int t=1; t<=(1 << N)-1; t++){ /*Print f and ||Mf^{(k)}||_p/||f^{(k)}||_p if the latter is close to 1/2.*/ if(r>.4997){ printf("f: "); - for(int i=0;i