-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 sparse type parameter (fixes #22110) #22111
Conversation
@@ -1418,7 +1423,7 @@ if not specified. | |||
`sparse(α*I, m, n)` can be used to efficiently create a sparse |
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.
Is this supposed to work?
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.
yes, on 0.6
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.
Was it needed to put in so many places just to fix spzeros
and speye
? Or are the other ones fixing other things?
It fixes |
It seems to have passed the sparse tests and all those functions are being tested, so I think it's okay. |
base/sparse/sparsematrix.jl
Outdated
@@ -292,7 +292,10 @@ function copy!(A::SparseMatrixCSC, B::SparseMatrixCSC) | |||
return A | |||
end | |||
|
|||
similar(S::SparseMatrixCSC, Tv::Type = eltype(S)) = SparseMatrixCSC(S.m, S.n, copy(S.colptr), copy(S.rowval), Vector{Tv}(length(S.nzval))) | |||
function similar(S::SparseMatrixCSC, ::Type{Tv} = eltype(S)) where {Tv} |
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.
No need for the braces around {Tv}
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.
same for speye_scaled
and _mapreducezeros
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.
Unfortunately I don't know how to fix this without opening an other pull request :( I just edited the file in Github... I hope that's not a huge issue.
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.
On the same git branch make these changes then commit then and push them. They will show up here
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.
Editing in github is not going to be convenient for contributing to Julia. Git can be a bit difficult at first, but you can pretty easily get into the groove. Basically, once you have a branch set up to be a PR, you can keep committing to the same branch. When we merge your PR, we will combine into one big commit.
Opening a new PR every time creates a lot of noise otherwise, and splits the discussion and reviews into too many places.
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.
Maybe better keep the short function syntax for one-liners like this?
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.
it's a pretty long line
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.
Of course you would split it into two lines (as in other places in the file).
Congrats on your first Julia PR, @jebej! Welcome to julia, and thanks for taking a whack at this 🐛 . |
@@ -1428,7 +1433,7 @@ end | |||
|
|||
speye_scaled(diag, m::Integer, n::Integer) = speye_scaled(typeof(diag), diag, m, n) | |||
|
|||
function speye_scaled(T, diag, m::Integer, n::Integer) | |||
function speye_scaled(::Type{T}, diag, m::Integer, n::Integer) where T |
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.
this is technically more restrictive than the existing signature, but looks like no one is calling this in registered packages and all the call sites in base pass a type
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.
Given T is passed as a type argument to Vector it needs to be a type, no?
Is there anything else to do here? |
Let's run the benchmarks just to check and then we can merge @nanosoldier |
Your benchmark job has completed - no performance regressions were detected. A full report can be found here. cc @jrevels |
Thanks! |
No description provided.