Skip to content

Commit 2e75e83

Browse files
committed
Apply suggestion
1 parent 880e610 commit 2e75e83

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/tensors/tensoroperations.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ end
1919
# seems necessary for GPU-backed BlockTensorMaps but
2020
# maybe not the most efficient approach?
2121
function TO.tensorscalar(t::AbstractBlockTensorMap{T, S, 0, 0}) where {T, S}
22-
Bs = TK.blocks(t)
23-
B_ends = collect.(map(b -> collect.(getfield(b, :blocks)), map(last, Bs)))
24-
inds = findall(!iszero last, B_ends)
25-
isempty(inds) && return zero(TKscalartype(t))
26-
return only(last(B_ends[only(inds)]))
22+
return prod(TO.tensorscalar, nonzero_values(t))
2723
end
2824

2925
# tensoralloc_contract

0 commit comments

Comments
 (0)