[SciPy-User] scalars vs array of length 1
Keith Goodman
kwgoodman@gmail....
Thu Jul 8 14:32:51 CDT 2010
On Thu, Jul 8, 2010 at 12:27 PM, Victor Eijkhout
<eijkhout@tacc.utexas.edu> wrote:
>
> On 2010/07/08, at 2:09 PM, Sebastian Haase wrote:
>
>> why are you mixing numpy.array and numpy.matrix !?
>> Are you sure you need both matrix and array ?
>> Matrixs are like arrays except for the the *-operator,
>
> I need true matrix-matrix (or rather matrix-vector) multiplication.
>
>> and the shape
>> is always made to 2d (at least 2d maybe !!?? I don't know ....)
>
> That's what it looks like to me. I'm not sure that I like the fact that a vector is a 2d matrix. You should be able to subscript a vector with one index, not two.
>
> Also, limiting to 2 means you can not extend to tensors, which is what I'll be doing shortly.
Sounds like you want arrays. Instead of
mat1 * mat2
the dot product for arrays is
np.dot(arr1, arr2)
and a vector is 1d.
More information about the SciPy-User
mailing list