[Numpy-discussion] Unnecessarily bad performance of elementwise operators with Fortran-arrays

Hans Meine meine@informatik.uni-hamburg...
Fri Nov 9 06:43:05 CST 2007


Am Freitag, 09. November 2007 13:04:24 schrieb Sebastian Haase:
> Since all my code, if not n Python, is written in C or C++ and not
> Fortran, I decided early on that I had to get used to "invese
> indexing", as in
> image[y,x] or image[z,y,x]

We cannot do that here, since
a) we use the opposite order in our C++ VIGRA, using operator():
  img(x, y) is similar to img[y][x] in other libraries, and
b) we have had Python bindings for quite some time (only not published), where
  we used img[x, y] already.
Of course, we want to have the same order in both languages in order to 
facilitate porting algorithms after rapid prototyping.

> "Inverse" only refers to the common (alphabetecally oriented)
> intuition to say "at point x,y,z" rather than "z,y,x".

Yes, this is the typical notation for coordinates and vectors.  Nobody would 
write (z, y, x) vectors. ;-)

> I also argueed that mathematical matrices (mostly / often) use an
> index order as "row , column" which essentially is "y, x" (if the
> matrix is seen as an image)

That's right, it's different between matrices and images.  In fact, we use "C" 
order for matrices in VIGRA:
http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/doc/vigra/classvigra_1_1linalg_1_1Matrix.html

-- 
Ciao, /  /
     /--/
    /  / ANS


More information about the Numpy-discussion mailing list