-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
"Triangular matrix must be square" error for square triangular matrices #258
Comments
I'm not sure it makes much sense to calculate the correlation matrix from a triangular matrix. Do you have a real usecase for this? |
Regardless of the use case, this is a bug. What happens is that
But going on further, there is wiggle room:
It seems that One solution is to go with the default documentation, and drop back to Array. But it would help to know whether BTW, same issue should affect Diagonal and perhaps others. |
Yes, in quite a few indexing operations now due to the fallbacks in JuliaLang/julia#10525. What I think one way out here would be finding and tweaking the uses of |
This problem seems fairly compartmentalized to triangular and diagonal matrices, and not much else. The In the earlier discussions, it's clear that Back to the bug. The fix appears to be pretty simple and have few effects on performance. It also seems that triangulars don't completely leverage the advantages they could. I'll see if I can put together a pull request. |
The counterexample to that, as usual, is sparse matrices. Triangular is an immutable wrapper around any type of AbstractMatrix. Promoting to dense is not a safe thing to do on any arbitrary AbstractMatrix, when it could easily be a million by a million sparse matrix with only a few nonzeros per column. You could potentially have The situation is a bit like JuliaLang/julia#11574 (comment) where you really want a different return type for different numbers of dimensions, and for triangular potentially also whether the dimensions match or not. The implications that has on type stability, and where exactly |
I'm coming around on this after sleeping on it. Without a dimensions argument, |
+1 (though I'm not sure we will be able to continue tweaking |
The proposed solution doesn't actually promote to dense, it only avoids enforcing triangular. The result is that Also, I don't quite agree with you about the divergent behaviors for |
|
Okay, I'm tempted to follow your suggestion of the bifurcating |
Yes I think this would be worth a separate discussion given the particular question in JuliaLang/julia#11574 was mostly answered, and this is a more specific detail than JuliaLang/julia#10064. |
Fixed by JuliaLang/julia#15198 |
The text was updated successfully, but these errors were encountered: