Skip to content

Commit 9918c4c

Browse files
committed
Merge pull request #14372 from JuliaLang/teh/scale
Loosen signature on scale
2 parents 91af963 + 2c53437 commit 9918c4c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

base/linalg/matmul.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ function scale!(C::AbstractMatrix, b::AbstractVector, A::AbstractMatrix)
3838
end
3939
C
4040
end
41-
scale(A::Matrix, b::Vector) = scale!(similar(A, promote_op(MulFun(),eltype(A),eltype(b))), A, b)
42-
scale(b::Vector, A::Matrix) = scale!(similar(b, promote_op(MulFun(),eltype(b),eltype(A)), size(A)), b, A)
41+
scale(A::AbstractMatrix, b::AbstractVector) = scale!(similar(A, promote_op(MulFun(),eltype(A),eltype(b))), A, b)
42+
scale(b::AbstractVector, A::AbstractMatrix) = scale!(similar(b, promote_op(MulFun(),eltype(b),eltype(A)), size(A)), b, A)
4343

4444
# Dot products
4545

test/linalg/generic.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ a = reshape([1.:6;], (2,3))
7979
@test scale(a, [1; 2; 3]) == a.*[1 2 3]
8080
@test scale([1; 2], a) == a.*[1; 2]
8181
@test scale(eye(Int, 2), 0.5) == 0.5*eye(2)
82+
@test scale([1; 2], sub(a, :, :)) == a.*[1; 2]
83+
@test scale(sub([1; 2], :), a) == a.*[1; 2]
8284
@test_throws DimensionMismatch scale(a, ones(2))
8385
@test_throws DimensionMismatch scale(ones(3), a)
8486

0 commit comments

Comments
 (0)