Indexing SparseMatrixCSC using CartesianIndices

I’m having trouble indexing into SparseArrays using CartesianIndices (plural). The following Julia-1.4 code

using SparseArrays
A = sparse(randn(4,4))
A[CartesianIndices((1:2,1:2))]

gives ERROR: MethodError: no method matching isless(::CartesianIndex{2}, ::Int64)

As far as I can tell, this was fixed for a single CartesianIndex in this PR and this PR, but doesn’t extend to CartesianIndices. Was this on purpose?

Also, etiquette-wise, should I be asking these questions on the PR threads instead of Discourse?

1 Like

This is a bug, you should report it (if it hasn’t been reported yet).

1 Like

Thanks! Will do