FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Return a tuple when broadcasting over ProductSpace (#431) · QuantumKitHub/TensorKit.jl@88fe4ef · GitHub

Commit 88fe4ef

Browse files
Return a tuple when broadcasting over ProductSpace (#431)
1 parent fd0b8a3 commit 88fe4ef

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/spaces/productspace.jl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ end
341341
Base.length(P::ProductSpace) = length(P.spaces)
342342
Base.getindex(P::ProductSpace, n::Integer) = P.spaces[n]
343343

344+
Base.Broadcast.broadcastable(P::ProductSpace) = P.spaces
345+
344346
Base.iterate(P::ProductSpace, args...) = Base.iterate(P.spaces, args...)
345347
Base.indexed_iterate(P::ProductSpace, args...) = Base.indexed_iterate(P.spaces, args...)
346348

‎test/symmetries/spaces.jl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ end
295295
@test @constinferred(hash(P)) == hash(deepcopy(P)) != hash(P')
296296
@test P == deepcopy(P)
297297
@test P == typeof(P)(P...)
298+
@test map(identity, P) == identity.(P)
298299
@constinferred (x -> tuple(x...))(P)
299300
@test @constinferred(dual(P)) == P'
300301
@test @constinferred(field(P)) == ℂ

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL