[Numpy-discussion] What is an empty matrix ?

dmitrey openopt@ukr....
Wed Jul 4 07:21:00 CDT 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@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
>
>   



More information about the Numpy-discussion mailing list