Skip to content

Commit

Permalink
adjoint/transpose multiplication (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzgubic authored Jul 8, 2022
1 parent 368944f commit f803d70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NamedDims"
uuid = "356022a1-0364-5f58-8944-0da4b18d706f"
authors = ["Invenia Technical Computing Corporation"]
version = "0.2.48"
version = "0.2.49"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
4 changes: 3 additions & 1 deletion src/functions_math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ end
# Using `CoVector` results in Method ambiguities; have to define more specific methods.
for A in (
Adjoint{<:Number,<:AbstractVector},
Adjoint{<:Any,<:AbstractVector}, # https://github.com/invenia/NamedDims.jl/issues/198
Transpose{<:Any,<:AbstractVector}, # https://github.com/invenia/NamedDims.jl/issues/198
Transpose{<:Real,<:AbstractVector{<:Real}},
Transpose{<:Any, <:AbstractMatrix{T}} where T, # resolves ambiguity error in AxisKeys
Transpose{<:Any,<:AbstractMatrix{T}} where {T}, # resolves ambiguity error in AxisKeys
)
@eval function Base.:*(a::$A, b::NamedDimsArray{L,T,1,<:AbstractVector{T}}) where {L,T}
return *(a, parent(b))
Expand Down
2 changes: 2 additions & 0 deletions test/functions_math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ end
@test ndv' * ndv == adjoint(v) * ndv == transpose(v) * ndv
@test ndv * v' == ndv * adjoint(v) == ndv * transpose(v)
@test ndv * ndv' == [1 2 3; 2 4 6; 3 6 9]
VERSION >= v"1.5" && @test adjoint([missing, missing, missing]) * ndv isa Missing # https://github.com/invenia/NamedDims.jl/issues/198
@test transpose([missing, missing, missing]) * ndv isa Missing # https://github.com/invenia/NamedDims.jl/issues/198

ndv2 = NamedDimsArray{(:b,)}([3, 2, 1])
@test_throws DimensionMismatch ndv' * ndv2
Expand Down

2 comments on commit f803d70

@mzgubic
Copy link
Collaborator Author

@mzgubic mzgubic commented on f803d70 Jul 8, 2022

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/63861

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 v0.2.49 -m "<description of version>" f803d708b56ee55b34bd74b565a4bd4c6c68d8ed
git push origin v0.2.49

Please sign in to comment.