Skip to content

Commit b9543ef

Browse files
oxinaboxKristofferC
authored andcommitted
Revert "Remove number / vector (#44358)" (#49915)
(cherry picked from commit 503d5b4)
1 parent 1d2dd91 commit b9543ef

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
@@ -1146,6 +1146,9 @@ function (/)(A::AbstractVecOrMat, B::AbstractVecOrMat)
11461146
size(A,2) != size(B,2) && throw(DimensionMismatch("Both inputs should have the same number of columns"))
11471147
return copy(adjoint(adjoint(B) \ adjoint(A)))
11481148
end
1149+
# \(A::StridedMatrix,x::Number) = inv(A)*x Should be added at some point when the old elementwise version has been deprecated long enough
1150+
# /(x::Number,A::StridedMatrix) = x*inv(A)
1151+
/(x::Number, v::AbstractVector) = x*pinv(v)
11491152

11501153
cond(x::Number) = iszero(x) ? Inf : 1.0
11511154
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)