-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
diag specializations for structured matrices yield dense vectors #478
Comments
I don't think we should return x, y, z = sparse(rand(5)), sparse(rand(4)), sparse(rand(4))
D = Diagonal(x)
B = Bidiagonal(x, y, :U)
T = Tridiagonal(y, x, z)
S = SymTridiagonal(x, y)
TT = typeof(x)
# Diagonal
typeof(diag(D)) == TT # true
typeof(diag(D, 1)) == TT # false
# Bidiagonal
typeof(diag(B)) == TT # true
typeof(diag(B, 1)) == TT # true
typeof(diag(B, 2)) == TT # false
# Tridiagonal
typeof(diag(T)) == TT # true
typeof(diag(T, 1)) == TT # true
typeof(diag(T, 2)) == TT # false
# SymTridiagonal
typeof(diag(S)) == TT # true
typeof(diag(S, 1)) == TT # true
typeof(diag(S, 2)) == TT # false I think all of these should be
|
That suggestion sounds great! Two questions: (1) (2) How would you handle the wrapped type being a Best! |
(1) Yes, that is true, and could be solved by always returning a (2) |
👍 A tangential question comes to mind. What is |
|
To make certain I follow, you propose that |
Yes, basically I think |
Sounds good on this end! :) |
In #411 and related triage, discussion settled on returning
SparseVector
fromdiag(A::SparseMatrixCSC)
anddiag(A::SparseMatrixCSC, k::Integer)
. JuliaLang/julia#23261 implemented that behavior. In contrast, thediag
specializations for structured matrices still returnVector
. Should this discrepancy be remedied, or shoulddiag
continue to returnVector
for structured matrices?r Best!The text was updated successfully, but these errors were encountered: