Skip to content

Commit 24d5268

Browse files
Remove number / vector (JuliaLang#44358)
* Remove number / vector * Fix test
1 parent e6c1525 commit 24d5268

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ Standard library changes
4646

4747
#### LinearAlgebra
4848

49+
* The methods `a / b` and `b \ a` with `a` a scalar and `b` a vector,
50+
which were equivalent to `a * pinv(b)`, have been removed due to the
51+
risk of confusion with elementwise division ([#44358]).
4952
* We are now wholly reliant on libblastrampoline (LBT) for calling
5053
BLAS and LAPACK. OpenBLAS is shipped by default, but building the
5154
system image with other BLAS/LAPACK libraries is not

stdlib/LinearAlgebra/src/generic.jl

-3
Original file line numberDiff line numberDiff line change
@@ -1142,9 +1142,6 @@ function (/)(A::AbstractVecOrMat, B::AbstractVecOrMat)
11421142
size(A,2) != size(B,2) && throw(DimensionMismatch("Both inputs should have the same number of columns"))
11431143
return copy(adjoint(adjoint(B) \ adjoint(A)))
11441144
end
1145-
# \(A::StridedMatrix,x::Number) = inv(A)*x Should be added at some point when the old elementwise version has been deprecated long enough
1146-
# /(x::Number,A::StridedMatrix) = x*inv(A)
1147-
/(x::Number, v::AbstractVector) = x*pinv(v)
11481145

11491146
cond(x::Number) = iszero(x) ? Inf : 1.0
11501147
cond(x::Number, p) = cond(x)

stdlib/LinearAlgebra/test/dense.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1108,12 +1108,12 @@ end
11081108
end
11091109

11101110
function test_rdiv_pinv_consistency(a, b)
1111-
@test (a*b)/b a*(b/b) (a*b)*pinv(b) a*(b*pinv(b))
1112-
@test typeof((a*b)/b) == typeof(a*(b/b)) == typeof((a*b)*pinv(b)) == typeof(a*(b*pinv(b)))
1111+
@test a*(b/b) (a*b)*pinv(b) a*(b*pinv(b))
1112+
@test typeof(a*(b/b)) == typeof((a*b)*pinv(b)) == typeof(a*(b*pinv(b)))
11131113
end
11141114
function test_ldiv_pinv_consistency(a, b)
1115-
@test a\(a*b) (a\a)*b (pinv(a)*a)*b pinv(a)*(a*b)
1116-
@test typeof(a\(a*b)) == typeof((a\a)*b) == typeof((pinv(a)*a)*b) == typeof(pinv(a)*(a*b))
1115+
@test (a\a)*b (pinv(a)*a)*b pinv(a)*(a*b)
1116+
@test typeof((a\a)*b) == typeof((pinv(a)*a)*b) == typeof(pinv(a)*(a*b))
11171117
end
11181118
function test_div_pinv_consistency(a, b)
11191119
test_rdiv_pinv_consistency(a, b)

0 commit comments

Comments
 (0)