06-19-2013 02:07 PM
@_Y_ wrote:
Florian.Ludwig, I wonder how Reshape Array works with memory alocation? If it uses the same phisical memory, your solution is better than my. However, if I understand the manual literally ("... reads the array data in memory from left to right, row by row ... adjusts the array data in memory ... "), the memory is realocated.
I'm pretty sure the reshape uses the same memory. All it has to do is change a few flags that tell how many elements are in a row and number of colums. Otherwise the memory containing the array is unchanged.
06-20-2013 07:28 AM
Reshape array will use the same memory, provided the reshape uses the same amount of memory, such as this case.
A relatively fast way to remove multiple elements from a 1D array can be found here, fourth example (along with more discussion on memory management and speed).