|
From: Paulo J. S. S. <pjs...@im...> - 2006-01-13 11:48:41
|
Hello, I was playing with the matrix type in numpy and I felt the "need" to have the "dot" function returning a 1x1 matrix as a scalar. This would allow for expressions like: x = matrix(arange(10.)) versorX = x / sqrt(x.T*x) Right now, I have to write: versorX = x / sqrt(x.T*x).item() Actually, a.T*b can not always be used as the inner product with the current behavior. Note that dot already returns scalars when we multiply rank-1 arrays, but matrices are always rank-2. Best, Paulo |