-
Notifications
You must be signed in to change notification settings - Fork 399
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
Implement element preserving resize
in 1d
#2745
Comments
@tdegeus Yes I have a couple guys on our staff thinking it worked like |
@tdegeus The bottom level storage is just linear memory. Could it be implemented with a |
I think even that mostly the underlying IS |
I think in ND we could implement a greedy concatenate using |
From the implementation I think that the underlying resize is used: xtensor/include/xtensor/xutils.hpp Line 341 in 5f49f64
So I think that for Edit I tried, indeed elements are not conserved. Yet, as indicated, at first glance I don't see where elements are modified. |
@tdegeus I just read the gitter channel and it sounds like it is deferred to the container implementation. How do you propose ensuring that the implementation be element preserving? |
I have no idea yet ;) |
Actually the default container for Anyway, the resize with preserving should be independent from the dimension of the tensor, and should not make any assumption regarding the underlying container. One way to implement it would be to compute the "intersection" shape, and then recursively loop over to copy from the first vector to the other one, and eventually swap the vectors. (I'll try to post some code later) |
@JohanMabille why is |
In general shrinking with resize of
xt::xtensor<double, 1>
does preserve elements. It would be nice to have the option to do so (if the underlying container allows it. E.g.The text was updated successfully, but these errors were encountered: