<div><br><div class="gmail_quote"><div dir="auto">On Mon, Jul 10, 2017 at 8:46 AM Yarko Tymciurak <<a href="mailto:yarkot1@gmail.com">yarkot1@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="gmail_quote"><div dir="auto">On Mon, Jul 10, 2017 at 8:37 AM <<a href="mailto:paul.carrico@free.fr" target="_blank">paul.carrico@free.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Thanks</p>
<p><br></p>
<p>Nevertheless it does not work for me and I suspect the python/numpy releases :-(</p>
<p>The server on which I'm working on is under Contos 7 that uses python 2.7 et numpy 1.7 from memory ; I tried to upgrade both of them (plus spyder) but it fails.</p></div></blockquote><div dir="auto"></div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">Question:</div><div dir="auto"><br></div><div dir="auto">Did you try to control the python & numpy versions by creating a virtualenv, or a conda env?</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="gmail_quote"><div dir="auto"></div></div></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif"><p></p>
<p>I didn't want to impact the other solvers installed on, so I stopped</p>
<p>Paul</p>
<p>a = np.arange(40).reshape(5, 8); print(a)<br>print("b =")<br>b = np.lib.stride_tricks.as_strided(a, (2, 5, 4), (16, 32, 4)); print(b)</p>
<p>[[ 0 1 2 3 4 5 6 7]<br> [ 8 9 10 11 12 13 14 15]<br> [16 17 18 19 20 21 22 23]<br> [24 25 26 27 28 29 30 31]<br> [32 33 34 35 36 37 38 39]]<br>b =<br>[[[ 0 4294967296 1 8589934592]<br> [ 4 21474836480 5 25769803776]<br> [ 8 38654705664 9 42949672960]<br> [ 12 55834574848 13 60129542144]<br> [ 16 73014444032 17 77309411328]]</p>
<p>[[ 2 12884901888 3 17179869184]<br> [ 6 30064771072 7 34359738368]<br> [ 10 47244640256 11 51539607552]<br> [ 14 64424509440 15 68719476736]<br> [ 18 81604378624 19 85899345920]]]</p></div><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p><br></p>
<p><br></p>
<p><br></p>
<p>Le 2017-07-10 15:16, eat a écrit :</p>
<blockquote type="cite" style="padding:0 0.4em;border-left:#1010ff 2px solid;margin:0">
<div>Hi,
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jul 10, 2017 at 3:20 PM, <span><<a href="mailto:paul.carrico@free.fr" target="_blank">paul.carrico@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex">
<div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Dear All</p>
<p>I'm looking in a way to reshape a 2D matrix into a 3D one ; in my example I want to<span> </span><span><strong>move the columns from the 4th to the 8th in the 2nd plane</strong>  </span>(3rd dimension i guess)</p>
<p>a =  np.random.rand(5,8); print(a)</p>
<p>I tried</p>
<p>a = p.reshape(d, (2,5,4), ) but it is not what I'm expecting</p>
<p><br></p>
<p>Nota : it looks like the following task (while I want to split it in 2 levels and not in 4), but I've not understood at all</p>
<p><a href="https://stackoverflow.com/questions/31686989/numpy-reshape-and-partition-2d-array-to-3d" target="_blank">https://stackoverflow.com/questions/31686989/numpy-reshape-and-partition-2d-array-to-3d</a></p>
</div>
</blockquote>
<div>Is this what you are looking for: </div>
<div>
<div><span style="font-family:monospace,monospace">import numpy as np</span></div>
<div><span style="font-family:monospace,monospace"> </span></div>
<div><span style="font-family:monospace,monospace">a= np.arange(40).reshape(5, 8)</span></div>
<div><span style="font-family:monospace,monospace"> </span></div>
<div><span style="font-family:monospace,monospace">a</span></div>
<div><span style="font-family:monospace,monospace">Out[]: </span></div>
<div><span style="font-family:monospace,monospace">array([[ 0,  1,  2,  3,  4,  5,  6,  7],</span></div>
<div><span style="font-family:monospace,monospace">       [ 8,  9, 10, 11, 12, 13, 14, 15],</span></div>
<div><span style="font-family:monospace,monospace">       [16, 17, 18, 19, 20, 21, 22, 23],</span></div>
<div><span style="font-family:monospace,monospace">       [24, 25, 26, 27, 28, 29, 30, 31],</span></div>
<div><span style="font-family:monospace,monospace">       [32, 33, 34, 35, 36, 37, 38, 39]])</span></div>
<div><span style="font-family:monospace,monospace"> </span></div>
<div><span style="font-family:monospace,monospace">np.lib.stride_tricks.as_strided(a, (2, 5, 4), (16, 32, 4))</span></div>
<div><span style="font-family:monospace,monospace">Out[]: </span></div>
<div><span style="font-family:monospace,monospace">array([[[ 0,  1,  2,  3],</span></div>
<div><span style="font-family:monospace,monospace">        [ 8,  9, 10, 11],</span></div>
<div><span style="font-family:monospace,monospace">        [16, 17, 18, 19],</span></div>
<div><span style="font-family:monospace,monospace">        [24, 25, 26, 27],</span></div>
<div><span style="font-family:monospace,monospace">        [32, 33, 34, 35]],</span></div>
<div><span style="font-family:monospace,monospace"> </span></div>
<div><span style="font-family:monospace,monospace">       [[ 4,  5,  6,  7],</span></div>
<div><span style="font-family:monospace,monospace">        [12, 13, 14, 15],</span></div>
<div><span style="font-family:monospace,monospace">        [20, 21, 22, 23],</span></div>
<div><span style="font-family:monospace,monospace">        [28, 29, 30, 31],</span></div>
<div><span style="font-family:monospace,monospace">        [36, 37, 38, 39]]])</span></div>
</div>
<div> </div>
<div>Regards,</div>
<div>-eat</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex">
<div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p><br></p>
<p>Thanks for your support</p>
<p><br></p>
<p>Paul</p>
</div>
<br>_______________________________________________<br> NumPy-Discussion mailing list<br> <a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br> <a href="https://mail.python.org/mailman/listinfo/numpy-discussion" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br> </blockquote>
</div>
</div>
</div>
<br>
<div class="m_-2545642699481955565m_173068462206446660pre" style="margin:0;padding:0;font-family:monospace">_______________________________________________<br> NumPy-Discussion mailing list<br> <a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br> <a href="https://mail.python.org/mailman/listinfo/numpy-discussion" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a></div>
</blockquote>
<p><br></p>

</div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div></div></blockquote></div></div>