@@ -31,7 +31,15 @@ mul!(C::AbstractArray, X::AbstractArray, s::Number) = generic_mul!(C, s, X)
31
31
"""
32
32
rmul!(A::AbstractArray, b::Number)
33
33
34
- Scale an array `A` by a scalar `b` overwriting `A` in-place.
34
+ Scale an array `A` by a scalar `b` overwriting `A` in-place. Use
35
+ [`lmul!`](@ref) to multiply scalar from left. The scaling operation
36
+ respects the semantics of the multiplication [`*`](@ref) between an
37
+ element of `A` and `b`. In particular, this also applies to
38
+ multiplication involving non-finite numbers such as `NaN` and `±Inf`.
39
+
40
+ !!! compat "Julia 1.1"
41
+ Prior to Julia 1.1, `NaN` and `±Inf` entries in `A` were treated
42
+ inconsistently.
35
43
36
44
# Examples
37
45
```jldoctest
@@ -44,6 +52,10 @@ julia> rmul!(A, 2)
44
52
2×2 Array{Int64,2}:
45
53
2 4
46
54
6 8
55
+
56
+ julia> rmul!([NaN], 0.0)
57
+ 1-element Array{Float64,1}:
58
+ NaN
47
59
```
48
60
"""
49
61
function rmul! (X:: AbstractArray , s:: Number )
57
69
"""
58
70
lmul!(a::Number, B::AbstractArray)
59
71
60
- Scale an array `B` by a scalar `a` overwriting `B` in-place.
72
+ Scale an array `B` by a scalar `a` overwriting `B` in-place. Use
73
+ [`rmul!`](@ref) to multiply scalar from right. The scaling operation
74
+ respects the semantics of the multiplication [`*`](@ref) between `a`
75
+ and an element of `B`. In particular, this also applies to
76
+ multiplication involving non-finite numbers such as `NaN` and `±Inf`.
77
+
78
+ !!! compat "Julia 1.1"
79
+ Prior to Julia 1.1, `NaN` and `±Inf` entries in `B` were treated
80
+ inconsistently.
61
81
62
82
# Examples
63
83
```jldoctest
@@ -70,6 +90,10 @@ julia> lmul!(2, B)
70
90
2×2 Array{Int64,2}:
71
91
2 4
72
92
6 8
93
+
94
+ julia> lmul!(0.0, [Inf])
95
+ 1-element Array{Float64,1}:
96
+ NaN
73
97
```
74
98
"""
75
99
function lmul! (s:: Number , X:: AbstractArray )
0 commit comments