Skip to content

Commit 503d5b4

Browse files
authored
Revert "Remove number / vector (#44358)" (#49915)
1 parent 62605cc commit 503d5b4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

stdlib/LinearAlgebra/src/generic.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,9 @@ function (/)(A::AbstractVecOrMat, B::AbstractVecOrMat)
11551155
size(A,2) != size(B,2) && throw(DimensionMismatch("Both inputs should have the same number of columns"))
11561156
return copy(adjoint(adjoint(B) \ adjoint(A)))
11571157
end
1158+
# \(A::StridedMatrix,x::Number) = inv(A)*x Should be added at some point when the old elementwise version has been deprecated long enough
1159+
# /(x::Number,A::StridedMatrix) = x*inv(A)
1160+
/(x::Number, v::AbstractVector) = x*pinv(v)
11581161

11591162
cond(x::Number) = iszero(x) ? Inf : 1.0
11601163
cond(x::Number, p) = cond(x)

stdlib/LinearAlgebra/test/dense.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,12 +1129,12 @@ end
11291129
end
11301130

11311131
function test_rdiv_pinv_consistency(a, b)
1132-
@test a*(b/b) (a*b)*pinv(b) a*(b*pinv(b))
1133-
@test typeof(a*(b/b)) == typeof((a*b)*pinv(b)) == typeof(a*(b*pinv(b)))
1132+
@test (a*b)/b a*(b/b) (a*b)*pinv(b) a*(b*pinv(b))
1133+
@test typeof((a*b)/b) == typeof(a*(b/b)) == typeof((a*b)*pinv(b)) == typeof(a*(b*pinv(b)))
11341134
end
11351135
function test_ldiv_pinv_consistency(a, b)
1136-
@test (a\a)*b (pinv(a)*a)*b pinv(a)*(a*b)
1137-
@test typeof((a\a)*b) == typeof((pinv(a)*a)*b) == typeof(pinv(a)*(a*b))
1136+
@test a\(a*b) (a\a)*b (pinv(a)*a)*b pinv(a)*(a*b)
1137+
@test typeof(a\(a*b)) == typeof((a\a)*b) == typeof((pinv(a)*a)*b) == typeof(pinv(a)*(a*b))
11381138
end
11391139
function test_div_pinv_consistency(a, b)
11401140
test_rdiv_pinv_consistency(a, b)

0 commit comments

Comments
 (0)