From 7da18edd54f2d45972f4625623b5bde93e94ab90 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Mon, 1 Aug 2016 21:51:43 +0200 Subject: [PATCH] fix fallback for scaling blas number with array --- base/linalg/dense.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/base/linalg/dense.jl b/base/linalg/dense.jl index b0fbe81de720a..a4324e80a506d 100644 --- a/base/linalg/dense.jl +++ b/base/linalg/dense.jl @@ -10,6 +10,8 @@ const ASUM_CUTOFF = 32 const NRM2_CUTOFF = 32 function scale!{T<:BlasFloat}(X::Array{T}, s::T) + s == 0 && return fill!(X, zero(T)) + s == 1 && return X if length(X) < SCAL_CUTOFF generic_scale!(X, s) else @@ -18,6 +20,8 @@ function scale!{T<:BlasFloat}(X::Array{T}, s::T) X end +scale!{T<:BlasFloat}(s::T, X::Array{T}) = scale!(X, s) + scale!{T<:BlasFloat}(X::Array{T}, s::Number) = scale!(X, convert(T, s)) function scale!{T<:BlasComplex}(X::Array{T}, s::Real) R = typeof(real(zero(T)))