@@ -99,21 +99,20 @@ def swt(cdata_t[::1] data, Wavelet wavelet, size_t level, size_t start_level,
99
99
& cD[0 ], output_len, i)
100
100
if retval < 0 :
101
101
raise RuntimeError (" C swt failed." )
102
- IF HAVE_C99_CPLX:
103
- if cdata_t is np.complex128_t:
104
- cD = np.zeros(output_len, dtype = np.complex128)
105
- with nogil:
106
- retval = c_wt.double_complex_swt_d(& data[0 ], data_size, wavelet.w,
107
- & cD[0 ], output_len, i)
108
- if retval < 0 :
109
- raise RuntimeError (" C swt failed." )
110
- elif cdata_t is np.complex64_t:
111
- cD = np.zeros(output_len, dtype = np.complex64)
112
- with nogil:
113
- retval = c_wt.float_complex_swt_d(& data[0 ], data_size, wavelet.w,
114
- & cD[0 ], output_len, i)
115
- if retval < 0 :
116
- raise RuntimeError (" C swt failed." )
102
+ elif cdata_t is np.complex128_t:
103
+ cD = np.zeros(output_len, dtype = np.complex128)
104
+ with nogil:
105
+ retval = c_wt.double_complex_swt_d(& data[0 ], data_size, wavelet.w,
106
+ & cD[0 ], output_len, i)
107
+ if retval < 0 :
108
+ raise RuntimeError (" C swt failed." )
109
+ elif cdata_t is np.complex64_t:
110
+ cD = np.zeros(output_len, dtype = np.complex64)
111
+ with nogil:
112
+ retval = c_wt.float_complex_swt_d(& data[0 ], data_size, wavelet.w,
113
+ & cD[0 ], output_len, i)
114
+ if retval < 0 :
115
+ raise RuntimeError (" C swt failed." )
117
116
118
117
# alloc memory, decompose A
119
118
if cdata_t is np.float64_t:
@@ -130,21 +129,20 @@ def swt(cdata_t[::1] data, Wavelet wavelet, size_t level, size_t start_level,
130
129
& cA[0 ], output_len, i)
131
130
if retval < 0 :
132
131
raise RuntimeError (" C swt failed." )
133
- IF HAVE_C99_CPLX:
134
- if cdata_t is np.complex128_t:
135
- cA = np.zeros(output_len, dtype = np.complex128)
136
- with nogil:
137
- retval = c_wt.double_complex_swt_a(& data[0 ], data_size, wavelet.w,
138
- & cA[0 ], output_len, i)
139
- if retval < 0 :
140
- raise RuntimeError (" C swt failed." )
141
- elif cdata_t is np.complex64_t:
142
- cA = np.zeros(output_len, dtype = np.complex64)
143
- with nogil:
144
- retval = c_wt.float_complex_swt_a(& data[0 ], data_size, wavelet.w,
145
- & cA[0 ], output_len, i)
146
- if retval < 0 :
147
- raise RuntimeError (" C swt failed." )
132
+ elif cdata_t is np.complex128_t:
133
+ cA = np.zeros(output_len, dtype = np.complex128)
134
+ with nogil:
135
+ retval = c_wt.double_complex_swt_a(& data[0 ], data_size, wavelet.w,
136
+ & cA[0 ], output_len, i)
137
+ if retval < 0 :
138
+ raise RuntimeError (" C swt failed." )
139
+ elif cdata_t is np.complex64_t:
140
+ cA = np.zeros(output_len, dtype = np.complex64)
141
+ with nogil:
142
+ retval = c_wt.float_complex_swt_a(& data[0 ], data_size, wavelet.w,
143
+ & cA[0 ], output_len, i)
144
+ if retval < 0 :
145
+ raise RuntimeError (" C swt failed." )
148
146
149
147
data = cA
150
148
if not trim_approx:
@@ -253,58 +251,57 @@ cpdef swt_axis(np.ndarray data, Wavelet wavelet, size_t level,
253
251
if retval:
254
252
raise RuntimeError (
255
253
" C wavelet transform failed with error code %d " % retval)
254
+ elif data.dtype == np.complex128:
255
+ cA = np.zeros(output_shape, dtype = np.complex128)
256
+ with nogil:
257
+ retval = c_wt.double_complex_downcoef_axis(
258
+ < double complex * > data.data, data_info,
259
+ < double complex * > cA.data, output_info,
260
+ wavelet.w, axis,
261
+ common.COEF_APPROX, common.MODE_PERIODIZATION,
262
+ i, common.SWT_TRANSFORM)
263
+ if retval:
264
+ raise RuntimeError (
265
+ " C wavelet transform failed with error code %d " %
266
+ retval)
267
+ cD = np.zeros(output_shape, dtype = np.complex128)
268
+ with nogil:
269
+ retval = c_wt.double_complex_downcoef_axis(
270
+ < double complex * > data.data, data_info,
271
+ < double complex * > cD.data, output_info,
272
+ wavelet.w, axis,
273
+ common.COEF_DETAIL, common.MODE_PERIODIZATION,
274
+ i, common.SWT_TRANSFORM)
275
+ if retval:
276
+ raise RuntimeError (
277
+ " C wavelet transform failed with error code %d " %
278
+ retval)
279
+ elif data.dtype == np.complex64:
280
+ cA = np.zeros(output_shape, dtype = np.complex64)
281
+ with nogil:
282
+ retval = c_wt.float_complex_downcoef_axis(
283
+ < float complex * > data.data, data_info,
284
+ < float complex * > cA.data, output_info,
285
+ wavelet.w, axis,
286
+ common.COEF_APPROX, common.MODE_PERIODIZATION,
287
+ i, common.SWT_TRANSFORM)
288
+ if retval:
289
+ raise RuntimeError (
290
+ " C wavelet transform failed with error code %d " %
291
+ retval)
292
+ cD = np.zeros(output_shape, dtype = np.complex64)
293
+ with nogil:
294
+ retval = c_wt.float_complex_downcoef_axis(
295
+ < float complex * > data.data, data_info,
296
+ < float complex * > cD.data, output_info,
297
+ wavelet.w, axis,
298
+ common.COEF_DETAIL, common.MODE_PERIODIZATION,
299
+ i, common.SWT_TRANSFORM)
300
+ if retval:
301
+ raise RuntimeError (
302
+ " C wavelet transform failed with error code %d " %
303
+ retval)
256
304
257
- IF HAVE_C99_CPLX:
258
- if data.dtype == np.complex128:
259
- cA = np.zeros(output_shape, dtype = np.complex128)
260
- with nogil:
261
- retval = c_wt.double_complex_downcoef_axis(
262
- < double complex * > data.data, data_info,
263
- < double complex * > cA.data, output_info,
264
- wavelet.w, axis,
265
- common.COEF_APPROX, common.MODE_PERIODIZATION,
266
- i, common.SWT_TRANSFORM)
267
- if retval:
268
- raise RuntimeError (
269
- " C wavelet transform failed with error code %d " %
270
- retval)
271
- cD = np.zeros(output_shape, dtype = np.complex128)
272
- with nogil:
273
- retval = c_wt.double_complex_downcoef_axis(
274
- < double complex * > data.data, data_info,
275
- < double complex * > cD.data, output_info,
276
- wavelet.w, axis,
277
- common.COEF_DETAIL, common.MODE_PERIODIZATION,
278
- i, common.SWT_TRANSFORM)
279
- if retval:
280
- raise RuntimeError (
281
- " C wavelet transform failed with error code %d " %
282
- retval)
283
- elif data.dtype == np.complex64:
284
- cA = np.zeros(output_shape, dtype = np.complex64)
285
- with nogil:
286
- retval = c_wt.float_complex_downcoef_axis(
287
- < float complex * > data.data, data_info,
288
- < float complex * > cA.data, output_info,
289
- wavelet.w, axis,
290
- common.COEF_APPROX, common.MODE_PERIODIZATION,
291
- i, common.SWT_TRANSFORM)
292
- if retval:
293
- raise RuntimeError (
294
- " C wavelet transform failed with error code %d " %
295
- retval)
296
- cD = np.zeros(output_shape, dtype = np.complex64)
297
- with nogil:
298
- retval = c_wt.float_complex_downcoef_axis(
299
- < float complex * > data.data, data_info,
300
- < float complex * > cD.data, output_info,
301
- wavelet.w, axis,
302
- common.COEF_DETAIL, common.MODE_PERIODIZATION,
303
- i, common.SWT_TRANSFORM)
304
- if retval:
305
- raise RuntimeError (
306
- " C wavelet transform failed with error code %d " %
307
- retval)
308
305
if retval == - 5 :
309
306
raise TypeError (" Array must be floating point, not {}"
310
307
.format(data.dtype))
0 commit comments