Skip to content

Commit

Permalink
as Base.Broadcast prefix to throwdm
Browse files Browse the repository at this point in the history
  • Loading branch information
apkille committed Aug 5, 2024
1 parent a3dec8e commit 145ddab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/operators_dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ Base.iterate(a::DataOperator, idx) = iterate(a.data, idx)

# In-place broadcasting
@inline function Base.copyto!(dest::DataOperator{BL,BR}, bc::Broadcast.Broadcasted{Style,Axes,F,Args}) where {BL,BR,Style<:DataOperatorStyle{BL,BR},Axes,F,Args}
axes(dest) == axes(bc) || Base.Broadcast.throwdm(axes(dest), axes(bc))
bc′ = Base.Broadcast.preprocess(dest, bc)
dest′ = dest.data
@inbounds @simd for I in eachindex(bc′)
Expand Down
4 changes: 2 additions & 2 deletions src/states.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ Base.@propagate_inbounds Base.Broadcast._broadcast_getindex(x::T, i) where {T<:U

# In-place broadcasting for Kets
@inline function Base.copyto!(dest::Ket{B}, bc::Broadcast.Broadcasted{Style,Axes,F,Args}) where {B,Style<:KetStyle{B},Axes,F,Args}
axes(dest) == axes(bc) || throwdm(axes(dest), axes(bc))
axes(dest) == axes(bc) || Base.Broadcast.throwdm(axes(dest), axes(bc))
bc′ = Base.Broadcast.preprocess(dest, bc)
dest′ = dest.data
@inbounds @simd for I in eachindex(bc′)
Expand All @@ -232,7 +232,7 @@ end

# In-place broadcasting for Bras
@inline function Base.copyto!(dest::Bra{B}, bc::Broadcast.Broadcasted{Style,Axes,F,Args}) where {B,Style<:BraStyle{B},Axes,F,Args}
axes(dest) == axes(bc) || throwdm(axes(dest), axes(bc))
axes(dest) == axes(bc) || Base.Broadcast.throwdm(axes(dest), axes(bc))
bc′ = Base.Broadcast.preprocess(dest, bc)
dest′ = dest.data
@inbounds @simd for I in eachindex(bc′)
Expand Down
2 changes: 1 addition & 1 deletion test/test_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using LinearAlgebra, LRUCache, Strided, StridedViews, Dates, SparseArrays, Rando
AnyFrameModule(RandomMatrices))
)
@show rep
@test length(JET.get_reports(rep)) <= 24
@test length(JET.get_reports(rep)) <= 28
@test_broken length(JET.get_reports(rep)) == 0
end
end # testset

0 comments on commit 145ddab

Please sign in to comment.