[SciPy-dev] Re: [SciPy-user] Low-level code integrationdiscussionat scipy'03?

Chuck Harris Chuck.Harris at sdl.usu.edu
Wed Sep 3 13:56:54 CDT 2003

>> >>
>> >
>> > Are you just talking about C macros to do the indexing
>> (including strides?
>> Well, anything which allows me to say in C/C++:
>> A(i,j,k,l,m,n) = some_function_of(i,j,k,l,m,n);
>> square brackets would also work, though
>> A[i][j][k][l][m][n]
>> starts to feel ugly real quick.
>Well, since C is not blessed with convenient handling of multidimensional
>array indexing, it would have to be a macro or a function to do this.
>A function probably brings in about a factor of 3 penalty for data
>access (at least it did a couple years ago when we benchmarked that
>approach--hmmm, makes me wonder if blitz resorts to that for large numbers
>of dimensions). Mind you, for numarray instances where byteswapped or
>nonaligned data are involved, I think a function for indexing is a

In a temporary moment of madness, I started to write my own version of
Numeric. Indexing was a small loop implementing a mixed radix counter
that was passed a structure containing the slice info and some function
pointers that were called in certain parts of the loop. The overhead I
measured was of the order of 10% over a straight loop with embedded
function calls on my machine (PIII). So I think it is possible to
build pretty efficient functions for this sort of thing. I was most
surprised at how low the function call overhead was.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3358 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20030903/730545b7/attachment.bin 

More information about the Scipy-dev mailing list