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

32 bit vs. 64 bit indexing #1

Closed
argriffing opened this issue Jan 23, 2015 · 5 comments
Closed

32 bit vs. 64 bit indexing #1

argriffing opened this issue Jan 23, 2015 · 5 comments

Comments

@argriffing
Copy link

Yesterday I was window shopping for new computer languages and I found rust which looks awesome if not yet mainstream. I like array-based approaches to certain problems, so I checked for ndarray support and found this github library. Nice!

Anyway, I noticed that this crate uses u32 for indexing.
http://bluss.github.io/rust-ndarray/doc/ndarray/struct.Array.html
In numpy it is increasingly common for users to have large arrays that cannot be indexed by such small integer types. I personally don't have enough RAM for this, but this could change in the future. Or you might want the same interface for arrays on disk as in RAM, or the same interface for sparse arrays that could more easily hold more entries. But of course using unnecessarily large integer types for indexing slows the code and increases the memory usage...

@bluss
Copy link
Member

bluss commented Jan 23, 2015

Yes. If Array will ever become that powerful it would be fantastic, and this version just a prototype. Each axis is limited to u32 but the number of elements in an Array is limited only by usize – so it's not so bad.

Indeed indices are smaller so that we save space in Array and its iterators. I think the iterators are still too inefficient with 2 or more dimensions for the library to be respectable.

@bluss
Copy link
Member

bluss commented Jan 23, 2015

In my petgraph library I'm experimenting with configurable index size for a container via a defaulted type parameter, but it is a bit cumbersome.

@bluss
Copy link
Member

bluss commented Jan 23, 2015

Array is easier actually -- we are already generic over the dimension/indexing type. But just adding (usize, usize) as a dimension type will mean that (1,2) doesn't infer to one unique dimension type anymore.

@bluss
Copy link
Member

bluss commented Dec 14, 2015

I think I've underestimated how big a deal this is (due to strides, the u32 per dimension idea doesn't really work, strides are multiplied).

@bluss
Copy link
Member

bluss commented Dec 16, 2015

Superseded by #9

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