File Coverage

lib/PDL/FFT-pp-ifft.c
Criterion Covered Total %
statement 28 33 84.8
branch 39 100 39.0
condition n/a
subroutine n/a
pod n/a
total 67 133 50.3


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/FFT.pd! Do not modify!
5             */
6              
7             #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8             if (destroy) { \
9             comp_free_code \
10             } \
11             if ((trans)->dims_redone) { \
12             ntpriv_free_code \
13             }
14              
15             #include "EXTERN.h"
16             #include "perl.h"
17             #include "XSUB.h"
18             #include "pdl.h"
19             #include "pdlcore.h"
20             #define PDL PDL_FFT
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/FFT-pp-ifft.c"
23             #include "fftn.h"
24              
25              
26              
27             #line 1857 "lib/PDL/PP.pm"
28             pdl_error pdl_ifft_readdata(pdl_trans *__privtrans) {
29             pdl_error PDL_err = {0, NULL, 0};
30             #line 31 "lib/PDL/FFT-pp-ifft.c"
31 23 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in ifft:" "broadcast.incs NULL");
32             /* broadcastloop declarations */
33             int __brcloopval;
34             register PDL_Indx __tind0,__tind1; /* counters along dim */
35 23           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
36             /* dims here are how many steps along those dims */
37 23           register PDL_Indx __tinc0_real = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
38 23           register PDL_Indx __tinc0_imag = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
39 23           register PDL_Indx __tinc1_real = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
40 23           register PDL_Indx __tinc1_imag = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
41             #define PDL_BROADCASTLOOP_START_ifft_readdata PDL_BROADCASTLOOP_START( \
42             readdata, \
43             __privtrans->broadcast, \
44             __privtrans->vtable, \
45             real_datap += __offsp[0]; \
46             imag_datap += __offsp[1]; \
47             , \
48             ( ,real_datap += __tinc1_real - __tinc0_real * __tdims0 \
49             ,imag_datap += __tinc1_imag - __tinc0_imag * __tdims0 \
50             ), \
51             ( ,real_datap += __tinc0_real \
52             ,imag_datap += __tinc0_imag \
53             ) \
54             )
55             #define PDL_BROADCASTLOOP_END_ifft_readdata PDL_BROADCASTLOOP_END( \
56             __privtrans->broadcast, \
57             real_datap -= __tinc1_real * __tdims1 + __offsp[0]; \
58             imag_datap -= __tinc1_imag * __tdims1 + __offsp[1]; \
59             )
60 23           register PDL_Indx __inc_imag_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_imag_n;
61 23           register PDL_Indx __inc_real_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_real_n;
62             #ifndef PDL_DECLARE_PARAMS_ifft_1
63             #define PDL_DECLARE_PARAMS_ifft_1(PDL_TYPE_OP,PDL_PPSYM_OP) \
64             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, real, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
65             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, imag, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP)
66             #endif
67             #define PDL_IF_BAD(t,f) f
68 23           switch (__privtrans->__datatype) { /* Start generic switch */
69 5           case PDL_F: {
70 5 50         PDL_DECLARE_PARAMS_ifft_1(PDL_Float,F)
    50          
    50          
    50          
    50          
    50          
71 1169 50         PDL_BROADCASTLOOP_START_ifft_readdata {fftnf(__privtrans->ind_sizes[0], NULL, real_datap, imag_datap, 1, -1.);}PDL_BROADCASTLOOP_END_ifft_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
72 5           } break;
73 18           case PDL_D: {
74 18 50         PDL_DECLARE_PARAMS_ifft_1(PDL_Double,D)
    50          
    50          
    50          
    50          
    50          
75 3280 50         PDL_BROADCASTLOOP_START_ifft_readdata {fftn(__privtrans->ind_sizes[0], NULL, real_datap, imag_datap, 1, -1.);}PDL_BROADCASTLOOP_END_ifft_readdata
    50          
    50          
    50          
    50          
    100          
    100          
    50          
    50          
76 18           } break;
77 0           case PDL_LD: {
78 0 0         PDL_DECLARE_PARAMS_ifft_1(PDL_LDouble,E)
    0          
    0          
    0          
    0          
    0          
79 0 0         PDL_BROADCASTLOOP_START_ifft_readdata {fftnl(__privtrans->ind_sizes[0], NULL, real_datap, imag_datap, 1, -1.);}PDL_BROADCASTLOOP_END_ifft_readdata
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
80 0           } break;
81 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in ifft: unhandled datatype(%d), only handles (FDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
82             }
83             #undef PDL_IF_BAD
84 23           return PDL_err;
85             }
86              
87             static pdl_datatypes pdl_ifft_vtable_gentypes[] = { PDL_F, PDL_D, PDL_LD, -1 };
88             static PDL_Indx pdl_ifft_vtable_realdims[] = { 1, 1 };
89             static char *pdl_ifft_vtable_parnames[] = { "real","imag" };
90             static short pdl_ifft_vtable_parflags[] = {
91             PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE,
92             PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE
93             };
94             static pdl_datatypes pdl_ifft_vtable_partypes[] = { -1, -1 };
95             static PDL_Indx pdl_ifft_vtable_realdims_starts[] = { 0, 1 };
96             static PDL_Indx pdl_ifft_vtable_realdims_ind_ids[] = { 0, 0 };
97             static char *pdl_ifft_vtable_indnames[] = { "n" };
98             pdl_transvtable pdl_ifft_vtable = {
99             PDL_TRANS_DO_BROADCAST, 0, pdl_ifft_vtable_gentypes, 0, 2, NULL /*CORE21*/,
100             pdl_ifft_vtable_realdims, pdl_ifft_vtable_parnames,
101             pdl_ifft_vtable_parflags, pdl_ifft_vtable_partypes,
102             pdl_ifft_vtable_realdims_starts, pdl_ifft_vtable_realdims_ind_ids, 2,
103             1, pdl_ifft_vtable_indnames,
104             NULL, pdl_ifft_readdata, NULL,
105             NULL,
106             0,"PDL::FFT::ifft"
107             };
108              
109              
110 23           pdl_error pdl_run_ifft(pdl *real,pdl *imag) {
111 23           pdl_error PDL_err = {0, NULL, 0};
112 23 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
113 23           pdl_trans *__privtrans = PDL->create_trans(&pdl_ifft_vtable);
114 23 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
115 23           __privtrans->pdls[0] = real;
116 23           __privtrans->pdls[1] = imag;
117 23 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
118 23 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
119 23           return PDL_err;
120             }