Skip to content

fix for issue #894 #895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "StaticArrays"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.1.0"
version = "1.1.1"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
7 changes: 1 addition & 6 deletions src/matrix_multiply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,7 @@ end
@generated function _mul(::Size{sa}, ::Size{sb}, a::StaticVector{<: Any, Ta},
b::Union{Transpose{Tb, <:StaticVector}, Adjoint{Tb, <:StaticVector}}) where {sa, sb, Ta, Tb}
newsize = (sa[1], sb[2])
conjugate_b = b <: Adjoint
if conjugate_b
exprs = [:(a[$i] * adjoint(b[$j])) for i = 1:sa[1], j = 1:sb[2]]
else
exprs = [:(a[$i] * transpose(b[$j])) for i = 1:sa[1], j = 1:sb[2]]
end
exprs = [:(a[$i]*b[$j]) for i = 1:sa[1], j = 1:sb[2]]

return quote
@_inline_meta
Expand Down
21 changes: 21 additions & 0 deletions test/matrix_multiply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,27 @@ mul_wrappers = [
@test_throws DimensionMismatch cv_bad*rv
end

@testset "vector-column vector" begin
for T1 in [Float64, ComplexF64, SMatrix{2,2,Float64,4}, SMatrix{2,2,ComplexF64,4}],
T2 in [Float64, ComplexF64, SMatrix{2,2,Float64,4}, SMatrix{2,2,ComplexF64,4}]

v1 = @SVector randn(T1, 4)
v2 = @SVector randn(T2, 4)
if T1 <: Number
v1a = Array(v1)
else
v1a = Array(Array.(v1))
end
if T2 <: Number
v2a = Array(v2)
else
v2a = Array(Array.(v2))
end
@test all(isapprox.(v1 * adjoint(v2), v1a * adjoint(v2a)))
@test all(isapprox.(v1 * transpose(v2), v1a * transpose(v2a)))
end
end

@testset "Matrix-matrix" begin
m = @SMatrix [1 2; 3 4]
n = @SMatrix [2 3; 4 5]
Expand Down