willow-ahrens / Finch.jl

Sparse tensors in Julia and more! Datastructure-driven array programing language.
http://willowahrens.io/Finch.jl/
MIT License
152 stars 13 forks source link

Issue with Colon indexing in 1D arrays #527

Closed mtsokol closed 2 months ago

mtsokol commented 2 months ago

Hi @willow-ahrens,

I started working on supporting None, and : fully in indexing. Here's one issue that I found:

using Finch

tns_1 = swizzle(Tensor(ones(10, 10)), 1, 2)
tns_1[:, :]  # works

tns_2 = swizzle(Tensor(ones(10)), 1)
tns_2[:]  # fails
willow-ahrens commented 2 months ago

I think the best approach to fixing this issue is to move dimension expansion to a separate function. That said, I'll push a fix to this too.