From 30f57f8a87bc46a64527987d97bc37706076ba40 Mon Sep 17 00:00:00 2001 From: Julian Weigt Date: Wed, 7 Jan 2026 22:25:38 +0000 Subject: Print if and only if it beats previous record. --- charf.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 25 deletions(-) (limited to 'charf.c') diff --git a/charf.c b/charf.c index c6a32c3..d6da18b 100644 --- a/charf.c +++ b/charf.c @@ -31,16 +31,19 @@ /*maximum length of the support of f*/ static const int N=24; +/*maximal order of derivative*/ +static const int K=24; + /*given function df[0] on domain [0,M-1], compute derivatives f' until f^{(K)} and store f^{(K)} in df*/ -void differentiate(VALUETYPE* f, VALUETYPE* df, int D, int K){ +void differentiate(VALUETYPE* f, VALUETYPE* df, int D, int k){ VALUETYPE df0[D]; /*Set zeroth derivative to be f.*/ for(int i=0; i.9) - //|| - //(k==2 && t>=.5) - //|| + ( + (k==1 && t>=1) + || + (k==2 && t>=.5) + || (k==3 && t>.53) - //|| - //(k==4 && t>=.5) + || + (k==4 && t>=.5) || (k==5 && t>=.58) || @@ -191,13 +196,36 @@ void compute(EXPTYPE p, int D, VALUETYPE* f){ (k==15 && t>=.9817) || (k==16 && t>=.9817) + || + (k==17 && t>=.987) + || + (k==18 && t>=.991) + || + (k==19 && t>=.994) + || + (k==20 && t>=1.001) + || + (k==21 && t>=1.009) + || + (k==22 && t>=1.009) + || + (k==23 && t>=1.003) + || + (k==24 && t>=1.174) + ) + && + (is_greater(r,records[k])) ){ - printf("f: "); - for(int i=0; i num_thread; + VALUETYPE* records = args -> records; + int* domain_current = args -> domain_current; + /*exponent p of the L^p norm to consider*/ EXPTYPE p = int_to_exptype(1); VALUETYPE f[N]; int d = generate_function(f,i); while(d >= 0){ - compute(p,d,f); + if(d>*domain_current){ + *domain_current=d; + printf("Start considering length: %d\n",d); + } + compute(p,d,f,records); i += NUM_THREADS; d = generate_function(f,i); } } int main() { - /*exponent p of the L^p norm to consider*/ - EXPTYPE p = int_to_exptype(1); - pthread_t threads[NUM_THREADS]; - int args[NUM_THREADS]; + Args args[NUM_THREADS]; + VALUETYPE records[K+1]; + int domain_current = 0; + for(int k=0; k<=K; k++) records[k] = int_to_valuetype(0); int result_code; for (int i = 0; i < NUM_THREADS; i++) { printf("In main: Creating thread %d.\n", i); - args[i] = i; + args[i].records = records; + args[i].num_thread = i; + args[i].domain_current = &domain_current; result_code = pthread_create(&threads[i], NULL, compute_chunk, args+i); } -- cgit v1.2.3