Hi all, I just discovered that the diff function returns a numpy-array even for matrix inputs. Since I'm a card-carrying matrix fanatic, I hope that behavior qualifies as a bug. Then I went through some (most?) other functions/methods for which IMO it's best to return matrices if the input is also a matrix-type. I found that the following functions share the problem of diff (see below for illustrations): vstack and hstack (although I always use r_ and c_ and they work fine with matrices) outer msort Should I open new tickets? (Or has this already been fixed since 0.9.8, which I used because this time building the svn version failed for me?) Cheers, Sven
n.__version__ '0.9.8' a matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) b matrix([[0, 0, 0], [0, 0, 0]]) n.diff(a) array([[-1, 0], [ 1, -1], [ 0, 1]]) n.outer(a,b) array([[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) n.msort(a) array([[0, 0, 0], [0, 0, 0], [1, 1, 1]]) n.vstack([a,b]) array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 0], [0, 0, 0]]) n.hstack([a,b.T]) array([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0]])
Well as I got no replies it seems my earlier title wasn't drastic enough ;-) And mere mortals like me can't seem to file new tickets anymore, so I'm re-posting a summary here: affected functions: diff vstack hstack outer msort symptom: given numpy-matrices as inputs, these functions still return numpy-arrays (as opposed to the applicable rest of numpy's functions) Cheers, Sven Sven Schreiber schrieb:
Hi all,
I just discovered that the diff function returns a numpy-array even for matrix inputs. Since I'm a card-carrying matrix fanatic, I hope that behavior qualifies as a bug.
Then I went through some (most?) other functions/methods for which IMO it's best to return matrices if the input is also a matrix-type. I found that the following functions share the problem of diff (see below for illustrations):
vstack and hstack (although I always use r_ and c_ and they work fine with matrices)
outer
msort
Should I open new tickets? (Or has this already been fixed since 0.9.8, which I used because this time building the svn version failed for me?)
Cheers, Sven
n.__version__ '0.9.8' a matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) b matrix([[0, 0, 0], [0, 0, 0]]) n.diff(a) array([[-1, 0], [ 1, -1], [ 0, 1]]) n.outer(a,b) array([[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) n.msort(a) array([[0, 0, 0], [0, 0, 0], [1, 1, 1]]) n.vstack([a,b]) array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 0], [0, 0, 0]]) n.hstack([a,b.T]) array([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0]])
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Sven Schreiber wrote:
Well as I got no replies it seems my earlier title wasn't drastic enough ;-) And mere mortals like me can't seem to file new tickets anymore, so I'm re-posting a summary here:
Of course you can file new tickets. You just have to register an account. Click on the "Register" link in the upper right-hand corner of the Trac page. We had to disallow unauthenticated ticket creation and wiki editing because we were getting hit daily by spammers. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (2)
-
Robert Kern -
Sven Schreiber