-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the preferred way to evoke similar
on MArrays?
#1160
Comments
Okay it looks like I am able to get away with:
is this the right way to do it? |
Yes, using axes is the preferred way to get a similar array of a different shape. |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am 99% sure someone has posted about this before but I couldn't find it. Please link if you know.
I wrote generic code for
AbstractArray
s in my library, and usesimilar
to construct arrays of the same container and eltype. All of the arrays I deal with are mutable.However, it seems that there is weird behavior for
MArray
:We can use
similar
just fine if we want the same array shape:however, if I want a similar array to a slice of
X
, it gives me a regularVector
:If I try to use
@view
instead:rather than an
MArray
. (Creating a copy withX[1, :]
is too slow)Why is this?
Thanks,
Miles
The text was updated successfully, but these errors were encountered: