Skip to content

Commit 1d5532b

Browse files
committed
replace sum with manual loop because less allocations for some reason
1 parent 8318638 commit 1d5532b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/tensors/linalg.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ function _norm(blockiter, p::Real, init::Real)
269269
return isempty(b) ? init : oftype(init, LinearAlgebra.normInf(b))
270270
end
271271
elseif p > 0 # finite positive p
272-
np = sum(blockiter; init) do (c, b)
273-
return oftype(init, dim(c) * norm(b, p)^p)
272+
np = init
273+
for (c, b) in blockiter
274+
np += dim(c) * norm(b, p)^p
274275
end
275276
return np^(inv(oftype(np, p)))
276277
else

0 commit comments

Comments
 (0)