-
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
fix-diag to sparse conversion #21
Conversation
CI is not pass. |
src/conversions.jl
Outdated
@@ -19,6 +19,11 @@ function SparseMatrixCSC(M::PermMatrix) | |||
SparseMatrixCSC(n, n, collect(1:n+1), order, M.vals[order]) | |||
end | |||
|
|||
function SparseMatrixCSC(M::Diagonal) | |||
n = size(M, 1) | |||
SparseMatrixCSC(n, n, collect(1:n+1), collect(1:n), M.diag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems this line is using the wrong args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the correct one?
XRef: JuliaLang/julia#32466 I'll patch it here for now. But this PR should be in the coming release, so should be removed after 1.3 is out this year, or we would contain type piracy. This issue is because the conversion was defined in I don't think it would appear in v1.2, but should be in v1.3 period, not sure if this would get backported, and I think you missed the type conversion of the diagonal part, function sparse(D::Diagonal{T}) where T
m = length(D.diag)
return SparseMatrixCSC(m, m, Vector(1:(m+1)), Vector(1:m), Vector{T}(D.diag))
end |
PS. I think this is one reason you want to get rid of this kind of auto conversion interface like |
Codecov Report
@@ Coverage Diff @@
## master #21 +/- ##
==========================================
+ Coverage 70.86% 70.98% +0.11%
==========================================
Files 12 12
Lines 484 486 +2
==========================================
+ Hits 343 345 +2
Misses 141 141
Continue to review full report at Codecov.
|
No description provided.