[psoc-2008] week 5 report - Math::GSL
Thierry Moisan
thierry.moisan at gmail.com
Sun Jun 29 21:07:32 UTC 2008
Hi,
Here is a copy of my message to swig-user mailing list, it haven't been
archived since it has been sent on june 24th and the list archive latest
message are from june 18th.
«
Hi,
I have a set of functions I'd like to wrap in perl 5. They are all in
this kind of form :
int gsl_fft_complex_radix2_forward (gsl_complex_packed_array data,
const size_t stride, const size_t n);
where gsl_complex_packed_array is declared this way :
typedef double * gsl_complex_packed_array ;
I am new to swig and I wonder how to write a typemap for getting the
data variable in input in a way that I could use this function in this
way:
$x = gsl_fft_complex_radix2_forward (@data, $stride, $n);
I tried
%apply double [ANY] *INPUT { gsl_complex_packed_array data } but it
doesn't work.
I have a similar problem with this function :
int gsl_qrng_get (const gsl_qrng * q, double x[])
where x[] is modified in-place for receiving some values. Here again I
don't know how to write a typemap to retrieve these values. The best
I've found so far is this :
%apply double *OUTPUT { double x[] };
but this will only output the first value of the array.
Thanks
»
I tought about argout typemap but I find the swig documentation confusing
and I don't understand how to use this typemap. I've also read that the
carray.i or carrays.i could be usefull but I find kind of stupid to have a
special function wich would create/edit/destroy an array while perl can
pretty much do the same thing. This kind of functions would be quite
confusing for a user.
Thierry Moisan
2008/6/29 Eric Wilhelm <scratchcomputing at gmail.com>:
> # from Thierry Moisan
> # on Sunday 29 June 2008 12:19:
>
> >but they all contain
> >functions which need to input or output arrays, thing we aren't able
> > to do at the moment with swig. I wrote a message to the swig-user
> > mailing list for help/tips but I haven't received a response yet.
>
> Could you please send a link to that in the archives? I'm only able to
> find this one from Jonathan, or sourceforge's mail search doesn't work.
>
> http://tinyurl.com/52cfus
>
> If this is the hang-up, I think the answer there is to use an argout
> typemap. The "out" typemap only deals with C return values, not with
> answers which got stuffed into argument pointers.
>
> --Eric
> --
> "It is a mistake to allow any mechanical object to realize that you are
> in a hurry."
> --Ralph's Observation
> ---------------------------------------------------
> http://scratchcomputing.com
> ---------------------------------------------------
> _______________________________________________
> psoc-2008 mailing list
> psoc-2008 at hexten.net
> http://hexten.net/mailman/listinfo/psoc-2008
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://hexten.net/pipermail/psoc-2008/attachments/20080629/50fa4238/attachment.htm
More information about the psoc-2008
mailing list