[Numpy-discussion] What is an empty matrix ?

dmitrey openopt at ukr.net
Wed Jul 4 08:21:00 EDT 2007

As for me, I used empty matrices in MATLAB as well as python rather often.
Simple example:

from numpy import array, hstack
m = A.shape[1]
a = array(()).reshape(0,m)
for i in some_ind:
  a = hstack((a, A[i]))
for i in some_ind2:
  a = hstack((a, Aeq[i]))
return a

other example:
from numpy import append
def myfunc(arr, arr2 = numpy.array(()))
  assert(arr.ndim==1 and arr2.ndim==1)
  return append(arr, arr2, 1)
HTH, Dmitrey

David Cournapeau wrote:
> Hi,
>     I was wondering what an empty matrix is, and what it is useful for 
> (by empty matrix, I mean something created by numpy.matrix([])) ? Using 
> those crash some functions (see for example scipy ticket #381), and I am 
> not sure how to fix this bug.
>     David
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list