> Could you please offer some code or math notation to help communicate this?
> I am forced to guess at the need.
>
> The words "matrix" and "vector" are ambiguous.
> After all, matrices (of given shape) are a type of vector (i.e., can be added 
> and scaled.)
> So if by "matrix" you mean "2d array" and by "stack of vectors" you 
> effectively mean "2d array",
> this sounds like a use for np.dot (possibly after a transpose).
> However I am going to guess that here by "vector" you actually mean a matrix
> (i.e., a 2d array) with only one row or only one column, so a "stack" of them
> is actually 3d. Perhaps the needless dimension is then the real problem
> and can either not be produced or can be squeezed away..

Stack of matrices in this context is a an ndarray in which the last two
dimensions are interpreted as columns and rows of matrices (in that
order), stack of vectors as an ndarray in which the last dimension is
interpreted as column vectors.  (Well, axes in all these functions can
be chosen arbitrarily, but those are the defaults.)

So a simple example for matvec would be a rotation matrix that I'd like
to apply to a large number of vectors (say to points in space); this is
currently not easy.  Complex vectors might be Fourier components.  (Note
that I was rather sloppy in calling it multiplication rather than using
the term vector-matrix product, etc.; it is definitely not element-wise!).

The vector-matrix product comes up a bit less, but as mentioned by
Evgeni in physics there is, e.g., the bra-ket stuff with Hamiltonians
(<\psi | \hat H | \psi>), and in linear least squares one often gets
terms which for real data are written as Xᵀ Z, but for complex would be
Xᴴ Z [1]

Hope this clarifies things!

-- Marten

[1] https://en.wikipedia.org/wiki/Linear_least_squares
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to