From 40dc4f305afca68c9b3f813d8196141512d9e1e2 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Tue, 20 Aug 2024 13:37:04 +0530 Subject: [PATCH] Disambiguate FillMatrix * LayoutVector (#245) * Disambiguate FillMatrix * LayoutVector * Restore behavior * Return FillArray * Use invoke function instead of macro * transpose and adjoint vector --- Project.toml | 2 +- src/mul.jl | 5 +++++ test/test_layoutarray.jl | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 1801653..c4bf92f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ArrayLayouts" uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" authors = ["Sheehan Olver "] -version = "1.10.2" +version = "1.10.3" [deps] FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" diff --git a/src/mul.jl b/src/mul.jl index 7703e3a..377c397 100644 --- a/src/mul.jl +++ b/src/mul.jl @@ -347,6 +347,11 @@ end *(A::Transpose{<:Any,<:LayoutVector}, B::Adjoint{<:Any,<:LayoutMatrix}) = mul(A,B) *(A::Transpose{<:Any,<:LayoutVector}, B::Transpose{<:Any,<:LayoutMatrix}) = mul(A,B) +# Disambiguation with FillArrays +*(A::AbstractFill{<:Any,2}, B::LayoutVector) = invoke(*, Tuple{AbstractFill{<:Any,2}, AbstractVector}, A, B) +*(A::Adjoint{<:Any, <:LayoutVector}, B::AbstractFill{<:Any,2}) = invoke(*, Tuple{Adjoint{<:Any, <:AbstractVector}, AbstractFill{<:Any,2}}, A, B) +*(A::Transpose{<:Any, <:LayoutVector}, B::AbstractFill{<:Any,2}) = invoke(*, Tuple{Transpose{<:Any, <:AbstractVector}, AbstractFill{<:Any,2}}, A, B) + ## special routines introduced in v0.9. We need to avoid these to support ∞-arrays *(x::Adjoint{<:Any,<:LayoutVector}, D::Diagonal{<:Any,<:LayoutVector}) = mul(x, D) diff --git a/test/test_layoutarray.jl b/test/test_layoutarray.jl index b0942f8..19c96e7 100644 --- a/test/test_layoutarray.jl +++ b/test/test_layoutarray.jl @@ -638,4 +638,13 @@ using .InfiniteArrays end end +@testset "disambiguation with FillArrays" begin + v = [1,2,3] + lv = MyVector(v) + F = Fill(2, 3, 3) + @test F * lv == F * v + @test lv' * F == v' * F + @test transpose(lv) * F == transpose(v) * F +end + end