Skip to content

Commit 12bab2a

Browse files
authored
Merge pull request #308 from mschauer/fixsolve
Fix bug in 1x1 solve
2 parents 7cc7f9d + a99e4ac commit 12bab2a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/solve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@inline solve(::Size, ::Size, a, b) = inv(a) * b
55

66
@inline function solve(::Size{(1,1)}, ::Size{(1,)}, a::StaticMatrix{<:Any, <:Any, Ta}, b::StaticVector{<:Any, Tb}) where {Ta, Tb}
7-
@inbounds return similar_type(b, typeof(b[1] \ a[1]))(b[1] \ a[1])
7+
@inbounds return similar_type(b, typeof(a[1] \ b[1]))(a[1] \ b[1])
88
end
99

1010
@inline function solve(::Size{(2,2)}, ::Size{(2,)}, a::StaticMatrix{<:Any, <:Any, Ta}, b::StaticVector{<:Any, Tb}) where {Ta, Tb}

test/solve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ using StaticArrays, Base.Test
55
(m, v) in ((SMatrix{n,n}, SVector{n}), (MMatrix{n,n}, MVector{n})),
66
elty in (Float64, Int)
77

8-
A = elty.(rand(-99:2:99,n,n))
9-
b = A*ones(elty,n)
8+
A = elty.(rand(-99:2:99, n, n))
9+
b = A * elty.(rand(2:5, n))
1010
@test m(A)\v(b) A\b
1111
end
1212

0 commit comments

Comments
 (0)