[Numpy-discussion] Matrix opreation

Yu Peng ypeng.bj at gmail.com
Wed May 23 00:30:44 EDT 2018


 Hi, I want to make an opreation like this:

if I hava a matrix:

a=

array([[[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11],
        [12, 13, 14, 15]],

       [[16, 17, 18, 19],
        [20, 21, 22, 23],
        [24, 25, 26, 27],
        [28, 29, 30, 31]],

       [[32, 33, 34, 35],
        [36, 37, 38, 39],
        [40, 41, 42, 43],
        [44, 45, 46, 47]],

       [[48, 49, 50, 51],
        [52, 53, 54, 55],
        [56, 57, 58, 59],
        [60, 61, 62, 63]]])


and  the shape of a is (4,4,4), I want to tranform this tensor or matrix to
(8,8), and the final result is like this:
0 16 1 17 2 18 3 19
32 48 33 49 34 50 35 51
4 20 5 21 6 22 7 23
36 52 37 53 38 54 39 55
8 24 9 25 10 26 11 27
40 56 41 57 42 58 43 59
12 28 13 29 14 30 15 31
44 60 45 61 46 62 47 63
If you know how to deal with this matrix, please give me some suggestions..
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180523/9b926971/attachment-0001.html>


More information about the NumPy-Discussion mailing list