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
|
%module "Math::GSL::FFT"
%include "typemaps.i"
%include "gsl_typemaps.i"
%include "renames.i"
// These must come before our %include's
%typemap(argout) (double data[], const size_t stride, const size_t n) {
int i=0;
AV* tempav = newAV();
while( i < $3 ) {
av_push(tempav, newSVnv((double) $1[i]));
i++;
}
$result = sv_2mortal( newRV_noinc( (SV*) tempav) );
argvi++;
}
%typemap(argout) (gsl_complex_packed_array data, const size_t stride, const size_t n) {
int i=0;
AV* tempav = newAV();
while( i < $3 ) {
av_push(tempav, newSVnv((double) $1[i]));
i++;
}
$result = sv_2mortal( newRV_noinc( (SV*) tempav) );
argvi++;
}
// TODO: this is not working. something close to this is needed for
// gsl_fft_real_unpack
%typemap(argout) (const double real_coefficient[],
double complex_coefficient[],
const size_t stride, const size_t n)
{
printf("FFT ARGOUT unpack\n");
int i=0;
AV* tempav = newAV();
while( i < $4 ) {
av_push(tempav, newSVnv((double) $1[i]));
i++;
}
$result = sv_2mortal( newRV_noinc( (SV*) tempav) );
argvi++;
}
// gsl_fft_halfcomplex_unpack and gsl_fft_halfcomplex_radix2_unpack
%typemap(argout) (const double halfcomplex_coefficient[],
double complex_coefficient[],
const size_t stride, const size_t n) {
printf("FFT ARGOUT halfcomplex unpack\n");
int i=0;
AV* tempav = newAV();
while( i < $4 ) {
av_push(tempav, newSVnv((double) $1[i]));
i++;
}
$result = sv_2mortal( newRV_noinc( (SV*) tempav) );
argvi++;
}
%include "gsl/gsl_inline.h"
%include "gsl/gsl_math.h"
%include "gsl/gsl_sys.h"
%include "gsl/gsl_pow_int.h"
%include "gsl/gsl_nan.h"
%include "gsl/gsl_machine.h"
%include "gsl/gsl_complex.h"
%include "gsl/gsl_fft.h"
%include "gsl/gsl_fft_complex.h"
%include "gsl/gsl_fft_halfcomplex.h"
%include "gsl/gsl_fft_real.h"
%include "../pod/FFT.pod"
%{
#include "gsl/gsl_inline.h"
#include "gsl/gsl_complex.h"
#include "gsl/gsl_sys.h"
#include "gsl/gsl_pow_int.h"
#include "gsl/gsl_nan.h"
#include "gsl/gsl_machine.h"
#include "gsl/gsl_math.h"
#include "gsl/gsl_fft.h"
#include "gsl/gsl_fft_complex.h"
#include "gsl/gsl_fft_halfcomplex.h"
#include "gsl/gsl_fft_real.h"
%}
|