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).
764764"""
765765centered (A:: AbstractArray , cp:: Dims = center (A)) = OffsetArray (A, .- cp)
766766
767+ centered (A:: AbstractArray , i:: CartesianIndex ) = centered (A, Tuple (i))
767768
768769# ###
769770# work around for segfault in searchsorted*
Original file line number Diff line number Diff line change @@ -2537,6 +2537,13 @@ end
25372537 @test parent (Aoo) === A # there will be only one OffsetArray wrapper
25382538 @test Aoo. offsets == (- 2 , - 2 )
25392539 @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+
25402547 end
25412548end
25422549
You can’t perform that action at this time.
0 commit comments