Open
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.
Metadata
Metadata
Assignees
Labels
No labels