<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 8, 2014 at 7:41 AM, Sturla Molden <span dir="ltr"><<a href="mailto:sturla.molden@gmail.com" target="_blank">sturla.molden@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Stefan Otte <<a href="mailto:stefan.otte@gmail.com" target="_blank">stefan.otte@gmail.com</a>> wrote:<br>
<br>
>     stack([[a, b], [c, d]])<br>
><br>
> In my case `stack` replaced `hstack` and `vstack` almost completely.<br>
><br>
> If you're interested in including it in numpy I created a pull request<br>
> [1]. I'm looking forward to getting some feedback!<br>
<br>
</span>As far as I can see, it uses hstack and vstack. But that means a and b have<br>
to have the same number of rows, c and d must have the same rumber of rows,<br>
and hstack((a,b)) and hstack((c,d)) must have the same number of columns.<br>
<br>
Thus it requires a regularity like this:<br>
<br>
AAAABB<br>
AAAABB<br>
CCCDDD<br>
CCCDDD<br>
CCCDDD<br>
CCCDDD<br>
<br>
What if we just ignore this constraint, and only require the output to be<br>
rectangular? Now we have a 'tetris game':<br>
<br>
AAAABB<br>
AAAABB<br>
CCCCBB<br>
CCCCBB<br>
CCCCDD<br>
CCCCDD<br>
<br>
or<br>
<br>
AAAABB<br>
AAAABB<br>
CCCCBB<br>
CCCCBB<br>
CCCCBB<br>
CCCCBB<br>
<br>
This should be 'stackable', yes? Or perhaps we need another stacking<br>
function for this, say numpy.tetris?<br>
<br>
And while we're at it, what about higher dimensions? should there be an<br>
ndstack function too?<br></blockquote><div><br></div><div>This is starting to look like the second time in a row Stefan tries to extend numpy with a simple convenience function, and he gets tricked into implementing some sophisticated algorithm...</div><div><br></div><div>For his next PR I expect nothing less than an NP-complete problem. ;-)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><font color="#888888"></font></span></blockquote></div><div class="gmail_extra">Jaime</div><div><br></div>-- <br>(\__/)<br>( O.o)<br>( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial.
</div></div>