Skip to content
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

combining z5 headers with xtensor-r #126

Open
gdkrmr opened this issue Feb 6, 2020 · 3 comments
Open

combining z5 headers with xtensor-r #126

gdkrmr opened this issue Feb 6, 2020 · 3 comments

Comments

@gdkrmr
Copy link

gdkrmr commented Feb 6, 2020

I am writing a package to read zarr arrays (https://zarr.readthedocs.io/en/stable/) in R. For this I am using the z5 headers (https://github.com/constantinpape/z5/tree/master/include/z5) and xtensor-r. z5 includes facilities to read data into xarrays (https://github.com/constantinpape/z5/blob/master/include/z5/multiarray/xtensor_access.hxx).

I have tried reading data directly into rarrays (https://github.com/gdkrmr/zarr-R/blob/31c4176bcba8b841080d56abed231d2c8f773cd3/src/xtensor-write.cpp#L156) but this failed when reading in entire chunks. Reading into an xarray and then copying into an rarray works fine.

My question is if this is a bug or if I tried to use rarrays in a way I was not supposed to.

CC: @constantinpape

The related issue can be found here: gdkrmr/zarr-R#12

@wolfv
Copy link
Member

wolfv commented Feb 10, 2020

hmmm ... do you know how memory allocation is performed when reading these arrays? could be that there lies the problem with xtensor-r.

@wolfv
Copy link
Member

wolfv commented Feb 10, 2020

hmm. the other potential problem could be that R uses col-major and xtensor by default uses row-major? Not sure about zarr.

@gdkrmr
Copy link
Author

gdkrmr commented Feb 10, 2020

I think zarr can be both, but z5 currently only supports row major. If this is a problem, why does

transform(xarray.begin(), xarray.end(), rarray.begin(), [](auto x){ return x; });

work fine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants