Re: [Numpy-discussion] kind of a matrix multiplication

2011-10-11 Thread Olivier Delalleau
I don't really understand the operation you have in mind that should lead to your desired result, so here's a way to get it that discards most of mat's content: (which does not seem needed to compute what you want): (stack.T * mat[0, 0]).T -=- Olivier 2011/10/11 Martin Raspaud > -BEGIN PGP

Re: [Numpy-discussion] kind of a matrix multiplication

2011-10-11 Thread Martin Raspaud
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/10/11 07:49, Martin Raspaud wrote: > Hi all, [...] > I'm looking for the operation needed to get the two (stacked) vectors > array([[0, 1, 2], >[6, 8, 10]])) > or its transpose. Hi again, Here is a solution I just found: np.einsum("ik,

[Numpy-discussion] kind of a matrix multiplication

2011-10-10 Thread Martin Raspaud
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I have a stack of vectors: v1 = np.arange(3) v2 = np.arange(3) + 3 stack = np.vstack(v1, v2) (now stack is : array([[0, 1, 2], [3, 4, 5]])) and a 3d matrix: mat = np.dstack((np.eye(3), np.eye(3) * 2)) (mat is now array([[[ 1., 2.],