Skip to content

Commit 12c5ffe

Browse files
committed
A second attempt to get tests passing on Julia v0.6
1 parent 516c73d commit 12c5ffe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/linalg.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ end
353353
end
354354
end
355355

356+
_norm_p0(x) = x == 0 ? zero(x) : one(x)
357+
356358
@generated function vecnorm(a::StaticArray, p::Real)
357359
if length(a) == 0
358360
return zero(real(eltype(a)))
@@ -377,7 +379,7 @@ end
377379
elseif p == 2
378380
return vecnorm(a)
379381
elseif p == 0
380-
return mapreduce(x -> (x== 0 ? $(zero(real(eltype(a)))) : $(one(real(eltype(a))))), +, $(zero(real(eltype(a)))), a)
382+
return mapreduce(_norm_p0, +, $(zero(real(eltype(a)))), a)
381383
else
382384
@inbounds return ($expr)^(inv(p))
383385
end

0 commit comments

Comments
 (0)