summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--charf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/charf.c b/charf.c
index eaf1c07..a99508e 100644
--- a/charf.c
+++ b/charf.c
@@ -103,7 +103,7 @@ int N=16;
/*length of the domain*/
int D=5*N;
-/*order of the derivative to consider*/
+/*order of the derivative to consider. Should not be larger than (D-N)/2 because then the support of f^{(K)} reaches outside of our domain.*/
int K=3;
/*exponent p of the L^p norm to consider*/
@@ -135,8 +135,8 @@ for(int k=0;k<=K;k++){
dMf[0] = Mf;
/*Allocate memory for integrals*/
-double* intdf = malloc(sizeof(double)*K);
-double* intdMf = malloc(sizeof(double)*K);
+double* intdf = malloc(K*sizeof(double));
+double* intdMf = malloc(K*sizeof(double));
/*Allocate memory for ||Mf^{(k)}||_p/||f^{(k)}||_p.*/
double r = 0.0;
@@ -148,7 +148,7 @@ for(int t=1; t<=(1 << N)-1; t++){
//for(int i=0;i<N;i++) f[N+i] = rand() %2;
/*In the middle of the domain set f to the values encoded in bit string t*/
for(int i=0;i<N;i++){
- /*Since we care about the Kth derivative, which in i depends on f on [i,i+K], shift f to the right by k/2 so that the most interesting part of f^{(K)} and Mf^{(K)} will be around the center of the domain*/
+ /*Since we care about the Kth derivative, which in i depends on f on [i,i+K], shift f to the right by K/2 so that the most interesting part of f^{(K)} and Mf^{(K)} will be around the center of the domain*/
f[2*N+i+K/2] = (t >> i) & 1;
//if(i%3==0) f[2*N+i+K/2] = 1;
}