Add as_ptr and as_mut_ptr methods#480
Conversation
This is useful for moving around a matrix/slice in unsafe code and for converting slices to other types (e.g. `ndarray::ArrayView`).
|
Thanks!
How would this be done? |
This is a bit more difficult for For comparison, consider how There is still a question of whether you'd like to publicly make this guarantee or not. Currently, |
|
By the way, I assumed that the pointer is always aligned for non-empty matrices, but I didn't check that thoroughly. (I assumed the |
|
It always struck me as a little odd that Having it be a method on |
I assume you're thinking about a sparse representation with indices as keys and matrix elements as values? From what I can tell, |
|
Thanks @jturner314! I will merge this now for today's release. |
This is useful for moving across a matrix/slice in unsafe code and for converting slices to other types (e.g.
ndarray::ArrayView).Edit: If you'd like to guarantee that the pointer is aligned and non-null for empty matrices too, that would be great. I just didn't know if you'd like to make that guarantee, so I left it out.