<div dir="ltr">I'm not sure I understand your argument.<div>My problem is that iota(5) has 5 elements which is more than 2*2, so I would expect </div><div>iota(5).sliced(2,2) </div><div>or</div><div>iota(7).sliced(2,3).sliced(1,2)</div><div>to throw, as in pretty much any other tensor library:</div><div><br></div><div><b>matlab:</b></div><div>reshape(0:4, 2,2)</div><div><div>Error using reshape</div><div>To RESHAPE the number of elements must not change.</div><div><br></div><div>python with numpy:</div><div>import numpy as np<br></div><div>np.arange(5).reshape((2, 2))<br></div></div><div>ValueError: total size of new array must be unchanged<br></div><div><br></div><div>eigen:</div><div><a href="http://eigen.tuxfamily.org/dox-devel/unsupported/TensorMorphing_8h_source.html">http://eigen.tuxfamily.org/dox-devel/unsupported/TensorMorphing_8h_source.html</a><span style="background-color:rgb(255,255,255)"><br></span><div style="text-indent:0px"><span style="color:rgb(0,0,0);font-family:monospace,fixed;font-size:13px;line-height:13px;white-space:pre-wrap;background-color:rgb(253,251,251)">eigen_assert(internal::array_prod(m_impl.dimensions()) == internal::array_prod(op.dimensions()));</span></div></div><div><br></div><div>This behavior will 100% cause hard to find bugs.</div><div>Why not instead allow this behavior only when a template argument is given: ReshapeAllowsDownsize.yes</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 10:39 PM, Ilya Yaroshenko via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thursday, 7 January 2016 at 04:47:16 UTC, Timothee Cour wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
what's the rationale for:<br>
Range length must be greater than or equal to the sum of shift and the<br>
product of lengths<br>
instead of:<br>
Range length must be equal to the sum of shift and the product of lengths<br>
?<br>
<br>
It seems more lax and bug-prone.<br>
</blockquote>
<br></div></div>
std.ndslice will contain a module or few for allocations, script like code, and concatenations. User defined range may not have slicing, but must be able to be used with `sliced` multiple times with different lengths.<span class="HOEnZb"><font color="#888888"><br>
-- Ilya<br>
</font></span></blockquote></div><br></div>