mcabbott / mcabbott/AxisKeys.jl
isequal violates transitive property
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 154
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Bit of technicality but according to the docs for isequal
isequal is an equivalence relation - it is reflexive (=== implies isequal), symmetric (isequal(a, b) implies isequal(b, a))
and transitive (isequal(a, b) and isequal(b, c) implies isequal(a, c)).
but one can easily violate this last property in AxisKeys
julia> A = ones(3);
julia> KA1 = wrapdims(ones(3), 'a':'c');
julia> KA2 = wrapdims(ones(3), 'd':'f');
julia> isequal(A, KA1)
true
julia> isequal(A, KA2)
true
julia> isequal(KA1, KA2)
false
I guess isequal is overloaded to account for floats and missings when comparing the underlying arrays but it means we violate this property of the function when comparing between keyed arrays. I'm wondering if this is indeed intended behaviour or an oversight when overloading the function?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Julia example using wrapdims, isequal, A, KA1, and KA2. Then locate AxisKeys' isequal overload and trace how keyed arrays are compared. Done means the intended equality semantics are decided and the behavior is covered by a regression test or clarified in the documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100