diff --git a/Project.toml b/Project.toml index 43835100..cbb0c6dc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "FillArrays" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" -version = "0.10" +version = "0.10.1" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/FillArrays.jl b/src/FillArrays.jl index 138bfd1d..e12314e3 100644 --- a/src/FillArrays.jl +++ b/src/FillArrays.jl @@ -605,4 +605,11 @@ end Base.show(io::IO, ::MIME"text/plain", x::Union{Eye,AbstractFill}) = show(io, x) +## +# interface +## + +getindex_value(a::LinearAlgebra.AdjOrTrans) = getindex_value(parent(a)) +getindex_value(a::SubArray) = getindex_value(parent(a)) + end # module diff --git a/test/runtests.jl b/test/runtests.jl index bc3c6cf4..74f01d69 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1138,3 +1138,20 @@ end @test_throws BoundsError setindex!(ones(3), zeros(3), Trues(2)) @test_throws DimensionMismatch setindex!(ones(2), zeros(3), Trues(2)) end + +@testset "FillArray interface" begin + @testset "views" begin + a = Fill(2.0,5) + v = view(a,1:2) + @test FillArrays.getindex_value(v) == FillArrays.unique_value(v) == 2.0 + @test convert(Fill, v) ≡ Fill(2.0,2) + end + + @testset "adjtrans" begin + a = Fill(2.0,5) + @test FillArrays.getindex_value(a') == FillArrays.unique_value(a') == 2.0 + @test convert(Fill, a') ≡ Fill(2.0,1,5) + @test FillArrays.getindex_value(transpose(a)) == FillArrays.unique_value(transpose(a)) == 2.0 + @test convert(Fill, transpose(a)) ≡ Fill(2.0,1,5) + end +end \ No newline at end of file