From 5253f48464f7bb32a449a561260952d070784a9f Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 19 Aug 2024 16:52:01 +0530 Subject: [PATCH 1/5] Disambiguate FillMatrix * LayoutVector --- Project.toml | 2 +- src/mul.jl | 3 +++ 2 files changed, 4 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..c5fd26e 100644 --- a/src/mul.jl +++ b/src/mul.jl @@ -347,6 +347,9 @@ 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 *(A::AbstractFill{<:Any,2}, B::AbstractVector) + ## 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) From ee8d2698df338032279f8930b5b7954c612899c8 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 19 Aug 2024 16:59:23 +0530 Subject: [PATCH 2/5] Restore behavior --- src/mul.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mul.jl b/src/mul.jl index c5fd26e..d03b223 100644 --- a/src/mul.jl +++ b/src/mul.jl @@ -348,7 +348,7 @@ end *(A::Transpose{<:Any,<:LayoutVector}, B::Transpose{<:Any,<:LayoutMatrix}) = mul(A,B) # Disambiguation with FillArrays -*(A::AbstractFill{<:Any,2}, B::LayoutVector) = @invoke *(A::AbstractFill{<:Any,2}, B::AbstractVector) +*(A::AbstractFill{<:Any,2}, B::LayoutVector) = mul(A, B) ## special routines introduced in v0.9. We need to avoid these to support ∞-arrays From 39719a138a64112454a4a7286d0d071e45c03249 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 19 Aug 2024 17:04:35 +0530 Subject: [PATCH 3/5] Return FillArray --- src/mul.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mul.jl b/src/mul.jl index d03b223..c5fd26e 100644 --- a/src/mul.jl +++ b/src/mul.jl @@ -348,7 +348,7 @@ end *(A::Transpose{<:Any,<:LayoutVector}, B::Transpose{<:Any,<:LayoutMatrix}) = mul(A,B) # Disambiguation with FillArrays -*(A::AbstractFill{<:Any,2}, B::LayoutVector) = mul(A, B) +*(A::AbstractFill{<:Any,2}, B::LayoutVector) = @invoke *(A::AbstractFill{<:Any,2}, B::AbstractVector) ## special routines introduced in v0.9. We need to avoid these to support ∞-arrays From 009cb6652fcabbf58339a2d61e3cc2694225aae0 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 19 Aug 2024 18:39:59 +0530 Subject: [PATCH 4/5] Use invoke function instead of macro --- src/mul.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mul.jl b/src/mul.jl index c5fd26e..0f6bb29 100644 --- a/src/mul.jl +++ b/src/mul.jl @@ -348,7 +348,7 @@ end *(A::Transpose{<:Any,<:LayoutVector}, B::Transpose{<:Any,<:LayoutMatrix}) = mul(A,B) # Disambiguation with FillArrays -*(A::AbstractFill{<:Any,2}, B::LayoutVector) = @invoke *(A::AbstractFill{<:Any,2}, B::AbstractVector) +*(A::AbstractFill{<:Any,2}, B::LayoutVector) = invoke(*, Tuple{AbstractFill{<:Any,2}, AbstractVector}, A, B) ## special routines introduced in v0.9. We need to avoid these to support ∞-arrays From a3f1d51fac1abf0e11f9061bc684318eab5f1cfc Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 19 Aug 2024 19:06:01 +0530 Subject: [PATCH 5/5] transpose and adjoint vector --- src/mul.jl | 2 ++ test/test_layoutarray.jl | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/mul.jl b/src/mul.jl index 0f6bb29..377c397 100644 --- a/src/mul.jl +++ b/src/mul.jl @@ -349,6 +349,8 @@ end # 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 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