File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -764,6 +764,7 @@ See also [`center`](@ref OffsetArrays.center).
764
764
"""
765
765
centered (A:: AbstractArray , cp:: Dims = center (A)) = OffsetArray (A, .- cp)
766
766
767
+ centered (A:: AbstractArray , i:: CartesianIndex ) = centered (A, Tuple (i))
767
768
768
769
# ###
769
770
# work around for segfault in searchsorted*
Original file line number Diff line number Diff line change @@ -2537,6 +2537,13 @@ end
2537
2537
@test parent (Aoo) === A # there will be only one OffsetArray wrapper
2538
2538
@test Aoo. offsets == (- 2 , - 2 )
2539
2539
@test Aoo[0 , 0 ] == 5
2540
+
2541
+ A = reshape (collect (1 : 9 ), 3 , 3 )
2542
+ Aoo = OffsetArrays. centered (A, CartesianIndex (2 ,2 ))
2543
+ c = (0 ,0 )
2544
+ i = CartesianIndex (c... )
2545
+ @test Aoo[i] == Aoo[c... ]
2546
+
2540
2547
end
2541
2548
end
2542
2549
You can’t perform that action at this time.
0 commit comments