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 <martin.raspaud@smhi.se>
-----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.], [ 0., 0.], [ 0., 0.]],
[[ 0., 0.], [ 1., 2.], [ 0., 0.]],
[[ 0., 0.], [ 0., 0.], [ 1., 2.]]]))
I'm looking for the operation needed to get the two (stacked) vectors array([[0, 1, 2], [6, 8, 10]])) or its transpose.
I tried various combinations of tensor products, but I always get a result in 3 dimensions, while I just want two.
Any suggestions ?
Thanks, Martin -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJOk9jWAAoJEBdvyODiyJI4y30IAJu6YIHK+ED8pN5M2TFrEKj8 k/K22MjitlQ8wTFDxwc5xBRI+yoniqgAfpzWjdU3pc5MxzXRgbZrRZagYWjepZyI CtN/CHy+BfM8EPJulFeVcInAgo1pgfAhH4xwEakbu88XhKSgat1Y9xlNRcrohTUQ oBVd+DNmBYpEUAa0pDjkMYXM8vaJqzePZZGaviZxY0AY2MBDrbZN/z6t4u2Unajn 8X1vjCg/XfDbm9v7FK/52MUorAJinZRdHiWBTE9rOmAqjJxTBoFKkN+0FMTUk6Sj acJNjr5KFjl6o3JPxqU4jRfw1zFRO9BEouzosKfYcs/kLozNjTBmfZztg0np/dg= =Ykij -----END PGP SIGNATURE-----
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion