Mercurial > octave
diff src/octave-config.in.cc @ 33543:8f73f8534d42 default tip @
Return early if sort dimension exceeds array dimension (bug #65712)
It turn out that calling `sort (A, dim)` where dim is greater than `ndims (A)`
was creating a larger temp array to accommodate dim, so `sort (A, 1e9)` was
transiently using 8GB, while `sort (A, inf)` was causing either OOM or
a segfault, depending on the compiler and its settings.
This patch changes the internal code for array sorting so that when the sort
dimension exceeds the array's dimensions, the array is returned unchanged.
This is analogous to `all (true(3,3), 100)` and similar expressions.
* Array-base.cc (in function `Array<T, Alloc>::sort (int, sortmode)`):
Copy array and return early if sort dimension exceeds array dimension.
* data.cc (in Fsort): Add BISTs.
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Wed, 08 May 2024 08:07:49 -0400 |
parents | 2e484f9f1f18 |
children |