Open RoyiAvital opened 1 year ago
I've started looking into this and they key difference between the SMatrix
and the standard array happens on line 998 of border.jl
expand(ind::AbstractUnitRange, pad::AbstractUnitRange) = typeof(ind)(first(ind)+first(pad):last(ind)+last(pad))
With a standard array, we have
typeof(ind) == OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}
whereas with the static array we have
typeof(ind) == OffsetArrays.IdOffsetRange{Int64, SOneTo{3}}
We also have:
first(ind)+first(pad):last(ind)+last(pad) == -1:1
and it turns out that
OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}(-1:1)
is valid whereas
OffsetArrays.IdOffsetRange{Int64, SOneTo{3}}(-1:1)
results in DimensionMismatch: -1:1 is inconsistent with SOneTo{3}
.
I'm not familiar with the internals of OffsetArrays
so would have to study that to understand what OffsetArrays.IdOffsetRange
is supposed to do. I think @johnnychen94 contributed to that package, so he might have some insight.
I think I've found a solution. Will try to make a pull-request soon once I confirm it works correctly.
This code works:
Yet with this change:
It will fail.
Environment information: