File: Use-fftw-instead-of-fftwl-on-archs-that-don-t-provide-it.patch

package info (click to toggle)
cubature 1.0.4%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 272 kB
  • sloc: ansic: 1,513; makefile: 80; sh: 34
file content (54 lines) | stat: -rw-r--r-- 1,636 bytes parent folder | download | duplicates (2)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From: Ole Streicher <olebole@debian.org>
Date: Fri, 18 Oct 2019 17:11:10 +0200
Subject: Use fftw instead of fftwl on archs that don't provide it

fftwl is not provided on platforms where sizeof(double) == sizeof(long
double), probably due to redundancy reasons.

See also #942359 for a wishlist bug to provide fftwl on all platforms
---
 clencurt_gen.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/clencurt_gen.c b/clencurt_gen.c
index 7a1066e..3d12cb4 100644
--- a/clencurt_gen.c
+++ b/clencurt_gen.c
@@ -106,6 +106,7 @@ static int P(int m, int j)
 
 void clencurt_weights(int n, long double *w)
 {
+#ifndef NO_LONG_DOUBLE_FFTW
      fftwl_plan p;
      int j;
      long double scale = 1.0 / n;
@@ -115,6 +116,17 @@ void clencurt_weights(int n, long double *w)
      fftwl_execute(p);
      w[0] *= 0.5;
      fftwl_destroy_plan(p);
+#else
+     fftw_plan p;
+     int j;
+     long double scale = 1.0 / n;
+     
+     p = fftw_plan_r2r_1d(n+1, (double *)w, (double *)w, FFTW_REDFT00, FFTW_ESTIMATE);
+     for (j = 0; j <= n; ++j) w[j] = scale / (1 - 4*j*j);
+     fftw_execute(p);
+     w[0] *= 0.5;
+     fftw_destroy_plan(p);
+#endif
 }
 /***************************************************************************/
 
@@ -132,7 +144,11 @@ int main(int argc, char **argv)
 	  return EXIT_FAILURE;
      }
 
+#ifndef NO_LONG_DOUBLE_FFTW
      w = (long double *) fftwl_malloc(sizeof(long double) * ((1<<(M+2)) - 2));
+#else
+     w = (long double *) fftw_malloc(sizeof(long double) * ((1<<(M+2)) - 2));
+#endif
      if (!w) {
 	  fprintf(stderr, "clencurt_gen: out of memory\n");
 	  return EXIT_FAILURE;