Skip to content

Commit a685ba8

Browse files
committed
Cleanup and make axpby a function
1 parent 3e0c4d0 commit a685ba8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/broadcast.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,12 @@ end
395395
# C .= β .* C .+ α .* A .* B
396396
#
397397

398-
struct axpby{Alpha,Beta}
398+
struct axpby{Alpha,Beta} <: Function
399399
alpha::Alpha
400400
beta::Beta
401401
end
402402

403-
(xy::axpby)(x, y) = x * xy.alpha + y * xy.beta
403+
(f::axpby)(y, x) = x * f.alpha + y * f.beta
404404

405405
## TODO this code doesn't actually get called
406406
function Base.copyto!(
@@ -424,8 +424,7 @@ function Base.copyto!(
424424

425425
# map!((r, t) -> β * r + α * t, T, T, A)
426426

427-
ab = axpby{promote_type(typeof(α), typeof(β))}(α, β)
428-
map!((r, t) -> ab(t, r), T, T, A)
427+
map!(axpby(α, β), T, T, A)
429428
else
430429
bc_bc_α = find_type(Broadcasted, bc_α.args)
431430
if isnothing(α)

0 commit comments

Comments
 (0)