Skip to content

Commit

Permalink
Fix \ for AbstractVector LHS
Browse files Browse the repository at this point in the history
Let \(::AbstractVector, ::AbstractMatrix) return a RowVector and
\(::AbstractVector, ::AbstractVector) return a scalar.
  • Loading branch information
martinholters committed Aug 2, 2017
1 parent c4f8337 commit 4a46304
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/linalg/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ function (\)(A::AbstractMatrix, B::AbstractVecOrMat)
return qrfact(A,Val(true)) \ B
end

(\)(a::AbstractVector, b::AbstractArray) = reshape(a, length(a), 1) \ b
(\)(a::AbstractVector, b::AbstractArray) = pinv(a) * b
(/)(A::AbstractVecOrMat, B::AbstractVecOrMat) = (B' \ A')'
# \(A::StridedMatrix,x::Number) = inv(A)*x Should be added at some point when the old elementwise version has been deprecated long enough
# /(x::Number,A::StridedMatrix) = x*inv(A)
Expand Down
2 changes: 1 addition & 1 deletion test/linalg/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bimg = randn(n,2)/2
@test_throws DimensionMismatch b'\b
@test_throws DimensionMismatch b\b'
@test norm(a*x - b, 1)/norm(b) < ε*κ*n*2 # Ad hoc, revisit!
@test zeros(eltya,n)\ones(eltya,n) zeros(eltya,n,1)\ones(eltya,n,1)
@test zeros(eltya,n)\ones(eltya,n) (zeros(eltya,n,1)\ones(eltya,n,1))[1,1]
end

@testset "Test nullspace" begin
Expand Down

0 comments on commit 4a46304

Please sign in to comment.