Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparse matrix with non-Int64 index type slice assignment failure #30006

Closed
dgenin opened this issue Nov 12, 2018 · 3 comments · Fixed by #30405
Closed

sparse matrix with non-Int64 index type slice assignment failure #30006

dgenin opened this issue Nov 12, 2018 · 3 comments · Fixed by #30405
Labels
arrays [a, r, r, a, y, s] sparse Sparse arrays stdlib Julia's standard library

Comments

@dgenin
Copy link

dgenin commented Nov 12, 2018

julia> using SparseArrays

julia> a=SparseMatrixCSC{Float64, Int32}(spzeros(3,3))
3×3 SparseMatrixCSC{Float64,Int32} with 0 stored entries

julia> a[:,1]=[1,2,3]
ERROR: type Slice has no field stop
Stacktrace:
 [1] getproperty(::Any, ::Symbol) at ./sysimg.jl:18
 [2] getindex at ./range.jl:610 [inlined]
 [3] setindex!(::SparseMatrixCSC{Float64,Int32}, ::Array{Int64,1}, ::Colon, ::Int64) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/SparseArrays/src/sparsematrix.jl:2656
 [4] top-level scope at none:0

The same code with Int64 in place of Int32 succeeds

julia> a=SparseMatrixCSC{Float64, Int64}(spzeros(3,3))
3×3 SparseMatrixCSC{Float64,Int64} with 0 stored entries

julia> a[:,1]=[1,2,3]
3-element Array{Int64,1}:
 1
 2
 3
@dgenin dgenin changed the title sparse matrix with non Int64 index type slice assignment failure sparse matrix with non-Int64 index type slice assignment failure Nov 12, 2018
@JuliaLang JuliaLang deleted a comment from dgenin Nov 12, 2018
@fredrikekre
Copy link
Member

(I moved the issue description from the comment to the top post)

@dgenin
Copy link
Author

dgenin commented Nov 12, 2018

oops, thank you.

@KristofferC
Copy link
Sponsor Member

Smaller example:

julia> Base.Slice(Base.OneTo(3))[1]
1

julia> Base.Slice(Base.OneTo(3))[Int32(1)]
ERROR: type Slice has no field stop
Stacktrace:
 [1] getproperty(::Any, ::Symbol) at ./sysimg.jl:18
 [2] getindex(::Base.Slice{Base.OneTo{Int64}}, ::Int32) at /Users/kristoffer/julia/base/range.jl:626
 [3] top-level scope at none:0

@fredrikekre fredrikekre added arrays [a, r, r, a, y, s] sparse Sparse arrays stdlib Julia's standard library labels Nov 13, 2018
ViralBShah pushed a commit that referenced this issue Dec 17, 2018
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Dec 20, 2018
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006

(cherry picked from commit 64133f6)
@KristofferC KristofferC mentioned this issue Dec 20, 2018
52 tasks
@KristofferC KristofferC mentioned this issue Dec 30, 2018
53 tasks
KristofferC pushed a commit that referenced this issue Dec 30, 2018
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006

(cherry picked from commit 64133f6)
KristofferC pushed a commit that referenced this issue Dec 31, 2018
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006

(cherry picked from commit 64133f6)
@KristofferC KristofferC mentioned this issue Feb 4, 2019
39 tasks
KristofferC pushed a commit that referenced this issue Feb 4, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Feb 4, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Feb 11, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Feb 11, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Feb 11, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Apr 19, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006

(cherry picked from commit 64133f6)
KristofferC pushed a commit that referenced this issue Apr 20, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Apr 20, 2019
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006

(cherry picked from commit 64133f6)
KristofferC pushed a commit that referenced this issue Feb 20, 2020
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006
KristofferC pushed a commit that referenced this issue Feb 20, 2020
* Fix #30006, range getindex accessing fields that might not exist
* Add tests for #30006

(cherry picked from commit 64133f6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] sparse Sparse arrays stdlib Julia's standard library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants