-
Notifications
You must be signed in to change notification settings - Fork 47
Investigate possible issues with partial views #244
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
Comments
What are the requirements of |
Minor optimisation: |
In most algorithms, the only requirement is that for all I see two possible lines of action:
I'm lean towards the first approach, as I don't like the performance penalty of the second one.
Yes that looks like a good idea. |
A drawback of the zero-copy approach is that equality between two sparse matrices is no longer trivial, because the non-indexed elements are arbitrary. Pretty sure the current implementation exposes this bug. |
There is a way to have a zero copy approach without having unused/invalid elements. The idea is to use another type for the That would technically be a breaking change, but not one that would affect much code in practice I guess. |
Equality as defined is given as structural equality, so don't think this is a big problem. The approx trait could be used for semantic equality |
Scipy ensures indptr always starts at 0, what does suitesparse do? |
Looks like SuiteSparse enforces the indptr to start at 0, for instance in ldl_valid_matrix. |
I've started prototyping a trait around that idea, any feedback is appreciated! |
How about this approach: https://gist.github.com/mulimoen/c476ee6a2daf5ba9e341d87dfbc46e14? |
That's a nice insight, no need for a trait with your approach! |
Another alternative: |
As suggested by @mulimoen (#244 (comment)), it's doable to have a concrete type abstracting the classic indptr case with the first element at 0, and the sliced matrix case, by simply performing the subtraction everywhere.
As suggested by @mulimoen (#244 (comment)), it's doable to have a concrete type abstracting the classic indptr case with the first element at 0, and the sliced matrix case, by simply performing the subtraction everywhere.
I really like the concrete type approach with |
Looking great! I have a couple of ideas below
|
Yes this looks like a good idea.
I'll change that for coherence. But it's fallible here, so maybe
I'll see if it can be done.
That's interesting indeed, maybe it should be what's returned by
I don't think we will always have a first and last element, for instance I don't think we should disallow creating a view around 0 rows. I know in dense linear algebra this kind of edge case can be very useful. |
A size one |
That was exactly what I had in mind, we can now use this in |
Hello, just an update to inform that my work on this is going to be a bit slow, my second son is born this week and I'm having much less free time. I still hope to be able to keep working on this though. |
My current state is shown is #245, it's not without issues but I think most of the work is there now. |
As evidenced by #242 and #243,
middle_outer_views
is not tested enough, and edge cases may happen in numerous algorithms. It's necessary to write tests for many functions involving these partial views, to reveal the presence of possible bugs.The text was updated successfully, but these errors were encountered: