Skip to content

Commit 09ff46f

Browse files
authored
Improve inference in axpy for non-inferred operator (#522)
* Improve inference in axpy for non-inferred operator * Bump version to v0.9.2
1 parent 54afbcb commit 09ff46f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.9.1"
3+
version = "0.9.2"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Operators/Operator.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,11 @@ const WrapperOperator = Union{SpaceOperator,MultiplicationWrapper,DerivativeWrap
830830
## BLAS and matrix routines
831831
# We assume that copy may be overriden
832832

833-
axpy!(a, X::Operator, Y::AbstractMatrix) = (Y .= a .* AbstractMatrix(X) .+ Y)
833+
function axpy!(a, X::Operator, Y::AbstractMatrix)
834+
Y .+= a .* AbstractMatrix(X)
835+
# the explicit return statement improves type inference
836+
return Y
837+
end
834838
copyto!(dest::AbstractMatrix, src::Operator) = copyto!(dest, AbstractMatrix(src))
835839

836840
# this is for operators that implement copy via axpy!

0 commit comments

Comments
 (0)