[Numpy-discussion] Further matrix oddities: no inner product

Sven Schreiber svetosch@gmx....
Thu Mar 29 08:42:48 CDT 2007


Charles R Harris schrieb:

> 
> Nope, vdot doesn't work for row and column vectors. So there is *no*
> builtin inner product that works for matrices. I wonder if we should
> have one, and if so, what it should be called. I think that vdot should
> probably be modified to do the job.  There is also the question of
> whether or not v.T * v should be a scalar when v is a column vector. I
> believe that construction is commonly used in matrix algebra as an alias
> for the inner product, although strictly speaking it uses the mapping
> between a vector space and its dual that the inner product provides.
> 

As a matrix-using user and w/o too much thinking, I would suggest to
treat inner() as a reduce-like method returning a scalar (I believe such
in the context of other functions a similar issue was discussed here
some time ago), and leave '*'-style multiplication alone (no special
casing there -- actually due to numpy's broadcasting capabilities, it
shouldn't be a problem to get a 1,1-matrix in place of a scalar, right?).

Thanks for caring about matrices,
Sven


More information about the Numpy-discussion mailing list