-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
missing sparse matrix transpose methods (performance regression in 0.7.0beta2 vs 0.6) #545
Comments
However, we might also need to consider the scope of defining methods that simply materialize the lazy transpose. In some cases, it might be more reasonable to ask the user to explicitly materialize the lazy transpose. |
I think that materializing is a reasonable option, but wouldn't it make sense for materializing to be the default (i.e., the output of the apostrophe operator) and lazy to be some more specialized operator? The performance hit for needless materialization is not nearly as big as the performance hit the other way around (not materializing, and then falling back to a dense matrix implementation). |
I have a suggestion on how to fix these and similar problems. Right now, there is a base type
In this manner, the fallback for unimplemented sparse methods will be |
if that was the path we wanted, we wouldn't require fallbacks, we could just manually convert by iterating over nz. |
Sorry, I didn't follow the previous comment. Could you explain in more detail? The fallbacks are not "required"; they are happening by accident because of unimplemented methods. |
my point is that to get this behavior sister matrices don't need to be able to convert to csc. f(sparse, vector) can do this transformation itself. |
Sorry, I'm still not getting it. Are you saying that every subtype of |
Yes. Part of the reason for implementing this way is that |
OK, I'm glad we're in agreement. Is there already a name for the protocol for iterating over nonzero entries of an abstract sparse matrix? Something analogous to |
yes. |
The function that seems to iterate over nonzero entries is Another thing to note: the transpose of a sparse matrix is not an abstract sparse matrix in 0.7.0-beta2:
So the types have to be adjusted somehow to get this to be true in order for your scheme to work. Perhaps this requires multiple inheritance. If I recall correctly, there is a way to simulate multiple inheritance in Julia called "Holy traits", but I don't remember right now how they work. |
I looked up Holy traits, which are described here: JuliaLang/julia#2345 (comment) and indeed, they can solve the above problems, albeit with a substantial refactoring of Base and stdlib. Consider, for example, how to define
I am willing to contribute some code to make this happen, but I don't have sufficient knowledge of Julia or clout in the community to start a PR that requires this much rewriting of Base and stdlib. |
I note that performance is significantly improved in all the reported cases. Let's file new issues for cases that still need work. |
The following statements are all slow in 0.7.0beta2 and are regressions from 0.6. They are slow because of missing sparse-matrix-transpose methods, so with this issue I'm requesting that someone write the missing methods (and even better, develop a tool or technique to automatically identify missing methods).
The text was updated successfully, but these errors were encountered: