reshape() should return a new copy instead of modifying
TorokLev opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
reshape modifies the input but numpy doesn't. It would desirable to behave similar.
Describe the solution you'd like
A clear and concise description of what you want to happen.
It should not break:
const nc::NdArray array = {1,2,3};
std::cout << array.reshape(-1,1).shape();
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
I disagree, the goal of this library is to be NumPy
like, but not necessarily identical. It is more efficient for the default behavior to be an in place reshape and to let the user call the copy()
method if they need a copy. I've updated the documentation to be more clear and to reflect this.