Skip to content

Iteration of Eye seems wrong #65

Closed
@KristofferC

Description

@KristofferC

Note that this requires starting julia with --check-bounds=true since iterate on Eye uses @inbounds.

julia> for v in Eye(6,5)
          println(v)
       end
1.0
0.0
0.0
0.0
0.0
ERROR: BoundsError: attempt to access 6×5 FillArrays.RectDiagonal{Float64,Ones{Float64,1,Tuple{Base.OneTo{Int64}}},Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}} at index [1, 6]
Stacktrace:
 [1] throw_boundserror(::FillArrays.RectDiagonal{Float64,Ones{Float64,1,Tuple{Base.OneTo{Int64}}},Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}, ::Tuple{Int64,Int64}) at ./abstractarray.jl:538
 [2] checkbounds at ./abstractarray.jl:503 [inlined]
 [3] getindex at /Users/kristoffer/FillArrays.jl/src/FillArrays.jl:228 [inlined]
 [4] iterate(::FillArrays.RectDiagonal{Float64,Ones{Float64,1,Tuple{Base.OneTo{Int64}}},Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}, ::Tuple{Int64,Int64}) at /Users/kristoffer/FillArrays.jl/src/FillArrays.jl:264
 [5] top-level scope at ./REPL[17]:2

This causes the following to fail:

julia> SparseMatrixCSC{Float64,Int}(Eye(6,5))
ERROR: BoundsError: attempt to access 6×5 FillArrays.RectDiagonal{Float64,Ones{Float64,1,Tupl
e{Base.OneTo{Int64}}},Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}} at index [1, 6]

which makes the tests fail on 1.2 after JuliaLang/julia#30617.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions