[Numpy-discussion] design issues - octave 'incompatibilities'

Soeren Sonnenburg python-ml at nn7.de
Sat Jul 23 09:04:16 EDT 2005

Dear all,

I am new to numarray and as I am trying to use it day-by-day
I am now wondering about certain numeric/numarray design issues. Please
forgive me / correct me as I probably misunderstood certain issues.

-- Why did you choose row-major instead of column major format as
practiced by R/octave/matlab... Doesn't that mean performance problems
as fortran/blas is optimized if you work with the transposed version ?

-- why do vectors have no 'orientation', i.e. there are only row but no
column vectors (or why do you treat matrices/vectors differently, i.e.
have vectors at all as a separate type)

>>> a[0,:]
array([1, 2, 3])
>>> a[:,0]
array([1, 4, 7])

vs. octave:

>> a(1,:)
ans =
        1        2        3
>> a(:,1)
ans =

-- How can one obtain submatrices from full matrices:

numarray gives only elements (which is very, very rarely needed and
should IMHO rather be some extra function):

>>> i=[0,1]
>>> j=[0,2]
>>> a[i,j]
array([1, 6])

vs octave:
>> i=[1,2];
>> j=[1,3];
>> a(i,j)
ans =
        1        3
        4        6

all one can do in numarray currently is as awkward as this:

>>> a.take(i,0).take(j,1)
array([[1, 3],
       [4, 6]])

also mixing slice and variable does not work a[:,i] - hmmhh seems that
is a major issue for me...

-- why don't you allow iterating over the whole matrix via a single
index ?


Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IndexError: Index out of range

vs octave
>> a(4)
ans = 2

Are there more elegant ways to do this ? Which issues are likely to be
fixed in the future ?

Best regards,

More information about the NumPy-Discussion mailing list