Skip to content

Commit

Permalink
Disambiguate FillMatrix * LayoutVector (#245)
Browse files Browse the repository at this point in the history
* Disambiguate FillMatrix * LayoutVector

* Restore behavior

* Return FillArray

* Use invoke function instead of macro

* transpose and adjoint vector
  • Loading branch information
jishnub authored Aug 20, 2024
1 parent a77697d commit 40dc4f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ArrayLayouts"
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
authors = ["Sheehan Olver <solver@mac.com>"]
version = "1.10.2"
version = "1.10.3"

[deps]
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Expand Down
5 changes: 5 additions & 0 deletions src/mul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions test/test_layoutarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 comments on commit 40dc4f3

@dlfivefifty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/113485

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.10.3 -m "<description of version>" 40dc4f305afca68c9b3f813d8196141512d9e1e2
git push origin v1.10.3

Please sign in to comment.