Repository navigation
Fix all method ambiguities; enable Aqua's ambiguity check - #168
Merged
Merged
Conversation
Test.detect_ambiguities went from 212 to 0: - Type the semiring argument of 3-arg * so it can't clash with A * B * C. - Drop the untyped scalar * methods; the Number ones remain. This also stops A * sparsevector / A * view(...) from being treated as a scalar apply. - Type the @eval'd inferbinarytype/indexunaryop methods on ::Type. - Typed vector getindex methods instead of a catch-all; scalar getindex now covers all AbstractGBVectors (shallow vectors included). - Restrict iterator indexing to GraphBLAS and dense matrices. - Narrow eunion's convenience forms, _assign's scalar, shallow resize!. - Tie-breakers for convert, _promotefill, apply!, hcat, typedmonoid, build!, reshape and u' * x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v11 #168 +/- ##
==========================================
+ Coverage 67.38% 68.38% +0.99%
==========================================
Files 54 54
Lines 4485 4494 +9
==========================================
+ Hits 3022 3073 +51
+ Misses 1463 1421 -42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Dense matrix (or its transpose) times a GraphBLAS vector also matched SparseArrays' triangular/adjoint * sparse vector methods: add tie-breakers. - GB_CHOLMOD's adjoint-FactorComponent \ took VecOrMat too, duplicating SparseArrays' own method; restrict it to AbstractGBArray. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every method added or narrowed for the ambiguity fixes is now exercised. Boolean-vector indexing selects the true positions (it threw before), and the integer-tuple reshape tie converts dims to Int. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test.detect_ambiguities(SuiteSparseGraphBLAS; recursive = true)goes from 212 to 0, and the Aqua CI job now runsAqua.test_all(SuiteSparseGraphBLAS)with no exceptions.Main causes:
*(≈100 pairs vs LinearAlgebra'sA * B * C): the semiring argument was untyped. It is nowop::SemiringSpec = (+, *), whereSemiringSpec = Union{Tuple, TypedSemiring}.*(x, A)/*(A, x)(≈55): removed; thex::Numbermethods next to them remain. These also caught non-scalars, soA * sparsevectorandA * view(x, …)were ambiguity errors and would otherwise have run as an elementwise scalar apply. They now work.inferbinarytype/indexunaryop(52): the@eval'd(::Any, ::Any, ::typeof(op))methods are now(::Type, ::Type, ...). The array forms already forward to the type forms.getindex(≈20): the catch-allgetindex(u::AbstractGBVector, I)is replaced with typed methods forAbstractVector/AbstractUnitRange(plusBoolvariants), all still callingextract. Scalargetindexnow covers everyAbstractGBVector, sopack(v)[i]works (it was aMethodError).A[I::GxBIterator]is restricted to GraphBLAS and dense matrices; it was defined on everyAbstractArray.Smaller fixes:
eunion/eunion!shortcut forms takeα/β::Number. The explicit 5-arg form is unchanged._assigntakesx::$T, like_subassign.resize!takesIntegerarguments.convert(into shallow vectors),_promotefill(MissingvsNothing→missing),apply!(two arrays, transposed first: throws),hcat(now needs ≥1 argument),typedmonoid,build!,reshapeandu' * x(real densex, which returns 1×1 likeu' * v).Behavior check against v11: scalar
*,A*x,A*A,*(A, A, (+, *)),D*A,v[1:2]/v[[2,1]]/v[:],hcat,reshapeandeunionall give the same results. Four cases that errored before now work:v' * x,A * sparse(x),A * view(...), andpack(v)[2].Aqua (all checks, including ambiguities) and the full
Pkg.test()pass locally on nightly. Small tests for the four newly working cases are added to the existingmul.jlandgbarray.jltestsets.🤖 Generated with Claude Code