diff options
author | Guillaume Horel | 2021-03-07 21:49:03 -0500 |
---|---|---|
committer | Guillaume Horel | 2021-03-07 21:49:03 -0500 |
commit | c2b2963471a540790acd308796e238a5996d2310 (patch) | |
tree | bd23e1013d541c6f0633aa4898f45dde5934b94f | |
parent | f5f6709a8aedae01ea8027202a437b6b11992f0f (diff) | |
download | aur-c2b2963471a540790acd308796e238a5996d2310.tar.gz |
bugfix for nfft 3.5.2
some utility functions, only used in the test were not used anymore.
Rewrote them using numpy.
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 7 | ||||
-rw-r--r-- | rewrite_hidden_symbols.patch | 96 |
3 files changed, 103 insertions, 2 deletions
@@ -10,8 +10,10 @@ pkgbase = python-pynfft depends = nfft source = https://pypi.org/packages/source/p/pyNFFT/pyNFFT-1.3.2.tar.gz source = new-api.patch + source = rewrite_hidden_symbols.patch sha256sums = ae41e720e569d0d99e3a44c82c36b35a49cfc9ecc23a1cd039fe9e2895aada2c sha256sums = d44f3144cd2ace01f021f67b724cd4036c37c9b1fbcf85521788875216666f0b + sha256sums = 65a1407fddbc1cab3c6415e6341f79f8d14aa816fd9438a521f38390879cf7fb pkgname = python-pynfft @@ -12,13 +12,16 @@ checkdepends=('python-nose') depends=('nfft') makedepends=('cython') source=("https://pypi.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz" - "new-api.patch") + "new-api.patch" + "rewrite_hidden_symbols.patch") sha256sums=('ae41e720e569d0d99e3a44c82c36b35a49cfc9ecc23a1cd039fe9e2895aada2c' - 'd44f3144cd2ace01f021f67b724cd4036c37c9b1fbcf85521788875216666f0b') + 'd44f3144cd2ace01f021f67b724cd4036c37c9b1fbcf85521788875216666f0b' + '65a1407fddbc1cab3c6415e6341f79f8d14aa816fd9438a521f38390879cf7fb') prepare() { cd "${srcdir}/${_pkgname}-${pkgver}" patch -p1 < ../new-api.patch + patch -p1 < ../rewrite_hidden_symbols.patch } build(){ diff --git a/rewrite_hidden_symbols.patch b/rewrite_hidden_symbols.patch new file mode 100644 index 000000000000..d97740dff13c --- /dev/null +++ b/rewrite_hidden_symbols.patch @@ -0,0 +1,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 |