Skip to content
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 #178 #343

Merged
merged 4 commits into from
Aug 29, 2024
Merged

fix #178 #343

merged 4 commits into from
Aug 29, 2024

Conversation

putianyi889
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.91%. Comparing base (90ef3ce) to head (f608d1b).
Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #343   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files           8        8           
  Lines        1141     1143    +2     
=======================================
+ Hits         1140     1142    +2     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@putianyi889
Copy link
Contributor Author

apparently Julia 1.6 doesn't have package extensions

@jishnub
Copy link
Member

jishnub commented Jan 30, 2024

This should be included directly on Julia 1.6

@putianyi889
Copy link
Contributor Author

is it possible to have dependency that depends on julia version?

@jishnub
Copy link
Member

jishnub commented Jan 30, 2024

This should work already, see

if !isdefined(Base, :get_extension)
include("../ext/FillArraysPDMatsExt.jl")
include("../ext/FillArraysSparseArraysExt.jl")
include("../ext/FillArraysStatisticsExt.jl")
end

The test failure on v1.6 appears to be because SparseArrays on that version limits dot to arrays of numbers, which leads to an ambiguity.

@longemen3000
Copy link

@jishnub do we test for Ambiguities in FillArrays ? maybe we could check if PRs of this style don't add new ambiguities. other than that, the fix seems good to add.

if VERSION >= v"1.8"
dot(x::AbstractFillVector, y::SparseVectorUnion) = _fill_dot(x, y)
else
dot(x::AbstractFillVector{<:Number}, y::SparseVectorUnion{<:Number}) = _fill_dot(x, y)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,10 +1,11 @@
module FillArraysSparseArraysExt

using SparseArrays
using SparseArrays: SparseVectorUnion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an internal type, so I wonder if it'll be better to hard-code the exact types that we want to disambiguate against? Perhaps we may just copy the definition over from SparseArrays.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from one of the ambiguity source https://github.com/JuliaSparse/SparseArrays.jl/blob/a5e95ec23649bd8cb75d2923861c74061016d1dd/src/sparsevector.jl#L1760
so if it changes someday, the ambiguity should also change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should define specific methods for the individual elements from the Union, which would not change even if this method signature is altered by SparseArrays, or if the type is removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it's supposed to be external
https://github.com/JuliaSparse/SparseArrays.jl/blob/a5e95ec23649bd8cb75d2923861c74061016d1dd/src/sparsevector.jl#L92
# the following aliases are unused internally, but widespread in packages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://juliahub.com/ui/Search?q=SparseVectorUnion&type=code

SparseVectorUnion to be used in only two packages

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I copy the alias definitions over?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a good idea, and let's define specific methods for each type instead of for the union (perhaps by calling an internal function _dot within each method). This is the safest.

@dlfivefifty dlfivefifty merged commit 6f61dc3 into JuliaArrays:master Aug 29, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants