Skip to content

Commit 4ad1e49

Browse files
committed
Add broadcasting for dampened type
1 parent 4bbc0d2 commit 4ad1e49

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/lsmr.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ end
1515
eltype(a::DampenedVector) = promote_type(eltype(a.y), eltype(a.x))
1616
norm(a::DampenedVector) = sqrt(norm(a.y)^2 + norm(a.x)^2)
1717

18+
function Base.Broadcast.broadcast!(f::Tf, to::DampenedVector, from::DampenedVector, args...) where {Tf}
19+
to.x .= f.(from.x, args...)
20+
to.y .= f.(from.y, args...)
21+
to
22+
end
23+
1824
function copy!(a::DampenedVector{Ty, Tx}, b::DampenedVector{Ty, Tx}) where {Ty, Tx}
1925
copy!(a.y, b.y)
2026
copy!(a.x, b.x)

0 commit comments

Comments
 (0)