[Numpy-discussion] SWIG, typemaps, 2D argout arrays
Tue Oct 14 14:58:49 CDT 2008
On Tue, Oct 14, 2008 at 7:51 PM, T J <email@example.com> wrote:
> On Tue, Oct 14, 2008 at 1:02 AM, Sebastian Haase <firstname.lastname@example.org> wrote:
>> b) I don't want to use Python / numpy API code in the C functions I'm
>> wrapping - so I limit myself to "input" arrays! Since array memory
>> does not distinguish between input or output (assuming there is no
>> copying needed because of alignment or contiguity issues) the only
>> implication of this is that I have to allocate the array outside the C
> To clarify, are you saying that you don't make any use of numpy.i?
I have my own (older) version -- I think Bill Spotz has improved
numpy.i by now to do what mine does (supposedly using cleaner code).
> The functions I'm writing are not making any explicit use of the
> Python/numpy API, but I'm sure it shows up in the *_wrap.c file that
> SWIG creates.
If you are using INPLACE arrays (this is I think the word numpy.i
uses) than there is no additional mem allocation. This is/was the most
important feature of all this numpy/SWIG idea.
>> input<->conversion transparently for my --- do you need to handle
>> non-contiguous arrays ?
> Probably not.
So you are fine;
do you know the output array shape beforehand ?
More information about the Numpy-discussion