StrideArraysCore.jl icon indicating copy to clipboard operation
StrideArraysCore.jl copied to clipboard

Support `reshape`

Open MasonProtter opened this issue 4 years ago • 4 comments

Currently, reshape(::StrideArray) gives a ReshapedArray. It'd be nice if we could do something similar to how view was handled.

MasonProtter avatar Nov 15 '21 21:11 MasonProtter

It should probably only return another StrideArray if the original array was dense and column major.

chriselrod avatar Nov 15 '21 21:11 chriselrod

My usecase is that I want to make a large statically sized vector, then take a small dynamic view of that vector then reshape it to a matrix.

MasonProtter avatar Nov 15 '21 21:11 MasonProtter

You're welcome to make a PR! But for that particular use case, you could also use ManualMemory.MemoryBuffer directly.

Another PR idea is to support that case directly, e.g. add support for providing a promise that the array is smaller than a given size, and then constructing a MemoryBuffer of the provided size.

chriselrod avatar Nov 15 '21 21:11 chriselrod

Nice, sounds good

MasonProtter avatar Nov 16 '21 20:11 MasonProtter