[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #62870] reshape gives unexpected OOM/dim too l
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #62870] reshape gives unexpected OOM/dim too large error for improper size vector |
Date: |
Sat, 6 Aug 2022 13:05:20 -0400 (EDT) |
Follow-up Comment #1, bug #62870 (project octave):
Something like the attached change should help. With it, I see:
octave:1> a = rand (100,1);
octave:2> b = randi ([0,10],10);
octave:3> reshape (a, b)
error: reshape: can't reshape 100x1 array to
10x2x6x1x4x8x9x1x7x0x0x0x10x6x7x0x9x3x4x9x10x9x0x10x2x2x7x4x6x1x7x9x2x8x6x9x2x8x9x4x10x1x4x7x10x7x8x0x8x5x10x10x1x0x9x5x7x2x10x10x0x1x8x6x9x10x8x7x6x9x8x6x0x0x2x1x4x2x2x8x4x6x5x10x3x6x0x5x9x10x6x3x0x7x7x5x2x1x5x6
array
octave:4>
Should we handle errors in dim_vector::safe_numel in some other way than
throwing std::bad_alloc?
Should we issue a different message if the number of dimensions is larger than
some limit (say, 50?) since generating and displaying the exact list of
dimensions is probably meaningless at that point.
(file #53536)
_______________________________________________________
Additional Item Attachment:
File name: reshape-diffs.txt Size:0 KB
<https://file.savannah.gnu.org/file/reshape-diffs.txt?file_id=53536>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62870>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/