JuliaArrays / JuliaArrays/FillArrays.jl
what to do about one and zero ?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 187
- Forks
- 41
- Avg merge
- 17h 29m
- Merged PRs (30d)
- 1
Description
Currently, we have this:
julia> one(Diagonal(fill(1.0, 2))) # 1
2×2 Array{Float64,2}:
1.0 0.0
0.0 1.0
julia> zero(Diagonal(fill(1.0, 2))) # 2
2×2 Diagonal{Float64,Array{Float64,1}}:
0.0 ⋅
⋅ 0.0
julia> one(Diagonal(Fill(1.0, 2))) # 3
2×2 Array{Float64,2}:
1.0 0.0
0.0 1.0
julia> zero(Diagonal(Fill(1.0, 2))) # 4
2×2 Diagonal{Float64,Array{Float64,1}}:
0.0 ⋅
⋅ 0.0
one and zero behave differently, but they probably should behave analogously.
The documentation for one says
If possible, one(x) returns a value of the same type as x,
And for zero
additive identity element for the type of x
This says to me that, of the above examples, only number 2 is correct.
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
No source file, test, or entry point is named. Start with the four Julia REPL examples and the documented contracts for one and zero; done requires an agreed behavior and corresponding implementation and tests, but the issue does not specify which outcome to choose.
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