summarylogtreecommitdiffstats
path: root/rewrite_hidden_symbols.patch
blob: d97740dff13c2b2fb1e4ac8e6a3a4200a8a88fed (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
diff -urN src/pyNFFT-1.3.2/pynfft/cnfft3util.pxd pyNFFT-1.3.2/pynfft/cnfft3util.pxd
--- src/pyNFFT-1.3.2/pynfft/cnfft3util.pxd	2021-03-07 21:37:44.884868477 -0500
+++ pyNFFT-1.3.2/pynfft/cnfft3util.pxd	1969-12-31 19:00:00.000000000 -0500
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2013  Ghislain Vaillant
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-from cnfft3 cimport fftw_complex
-
-cdef extern from "nfft3.h":
-
-    void nfft_vrand_unit_complex (fftw_complex *x, int n)
- 	    # Inits a vector of random complex numbers in \
-        # $[0,1]\times[0,1]{\rm i}$ .
-
-    void nfft_vrand_shifted_unit_double (double *x, int n)
-        # Inits a vector of random double numbers in $[-1/2,1/2]$ .
-
-    void nfft_voronoi_weights_1d (double *w, double *x, int M)
- 	    # Computes non periodic voronoi weights, \
-        # assumes ordered nodes $x_j$.
diff -urN src/pyNFFT-1.3.2/pynfft/util.pyx pyNFFT-1.3.2/pynfft/util.pyx
--- src/pyNFFT-1.3.2/pynfft/util.pyx	2021-03-07 21:37:44.884868477 -0500
+++ pyNFFT-1.3.2/pynfft/util.pyx	2021-03-07 21:37:37.101495075 -0500
@@ -17,29 +17,30 @@
 
 import numpy as np
 cimport numpy as np
-from cnfft3util cimport *
 
 
 # Numpy must be initialized. When using numpy from C or Cython you must
 # _always_ do that, or you will have segfaults
 np.import_array()
 
+_rng = np.random.default_rng()
+
 def vrand_unit_complex (object[np.complex128_t, mode='c'] x not None):
     '''
     Utilitary function for initializing a vector of knots to random
-    values within the range [-0.5, 0.5).
+    complex values within the range [0, 1).
 
     Used for testing :attr:`pynfft.NFFT.x`.
 
     :param x: pre-allocated array
     :type x: ndarray <complex128>
     '''
-    nfft_vrand_unit_complex(<fftw_complex *>&x[0], x.size)
+    _rng.random(out=x.view(dtype=np.float64))
 
 def vrand_shifted_unit_double (object[np.float64_t, mode='c'] x not None):
     '''
     Utilitary function for initializing a vector of data to random
-    complex values within the range [0, 1).
+    values within the range [-0.5, 0.5).
 
     Used for testing :attr:`pynfft.NFFT.f` and
     :attr:`pynfft.NFFT.f_hat`.
@@ -47,20 +49,5 @@
     :param x: pre-allocated array
     :type x: ndarray <float64>
     '''
-    nfft_vrand_shifted_unit_double(<double *>&x[0], x.size)
-
-def voronoi_weights_1d (object[np.float64_t, mode='c'] w not None,
-                        object[np.float64_t, mode='c'] x not None):
-    '''
-    Utilitary function for computing density compensation weights from 1D knots.
-
-    :param w: pre-allocated array
-    :type w: ndarray <float64>
-    :param x: ordered 1D knots
-    :type x: ndarray <float64>
-    '''
-    if x.size != w.size:
-        raise ValueError('Incompatible size between weights and nodes \
-                         (%d, %d)'%(w.size, x.size))
-    nfft_voronoi_weights_1d(<double *>&w[0], <double *>&x[0], w.size)
-
+    _rng.random(out=x)
+    x -= 0.5