On Saturday, 9 January 2016 at 04:15:08 UTC, Timothee Cour wrote:
ok good, 'reshape' behaves as it should; but what's the
rationale for not
throwing on 'iota(5).sliced(2,2) ' ?
in light of what i wrote above, it's surprising behavior and
will cause bugs. What are the advantages of allowing it to not
throw?
On Fri, Jan 8, 2016 at 6:09 PM, Ilya via Digitalmars-d <
[email protected]> wrote:
On Saturday, 9 January 2016 at 00:15:10 UTC, Timothee Cour
wrote:
I'm not sure I understand your argument.
My problem is that iota(5) has 5 elements which is more than
2*2, so I
would expect
iota(5).sliced(2,2)
or
iota(7).sliced(2,3).sliced(1,2)
to throw, as in pretty much any other tensor library:
[...]
auto a = iota(5).sliced(5);
auto b = a.reshape(2, 2); // throws ReshapeException
--ilya
Agreed. I will add optional exception (by default sliced will
trow).
--Ilya