File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -597,18 +597,14 @@ end
597597# Compute L_p norm ‖x‖ₚ = sum(abs(x).^p)^(1/p)
598598# (Not technically a "norm" for p < 1.)
599599function generic_normp (x, p)
600+ (v, s) = iterate (x):: Tuple
600601 if p > 1 || p < - 1 # might need to rescale to avoid overflow
601602 maxabs = p > 1 ? normInf (x) : normMinusInf (x)
602603 (ismissing (maxabs) || iszero (maxabs) || isinf (maxabs)) && return maxabs
603- return _generic_normp (x, p, maxabs)
604+ T = typeof ( maxabs)
604605 else
605- return _generic_normp (x, p )
606+ T = typeof ( float ( norm (v)) )
606607 end
607- end
608-
609- function _generic_normp (x, p, maxabs:: TM = nothing ) where {TM}
610- (v, s) = iterate (x):: Tuple
611- T = isnothing (maxabs) ? typeof (float (norm (v))) : TM
612608 spp:: promote_type (Float64, T) = p
613609 if - 1 <= p <= 1 || (isfinite (length (x)* maxabs^ spp) && ! iszero (maxabs^ spp)) # scaling not necessary
614610 sum:: promote_type (Float64, T) = norm (v)^ spp
You can’t perform that action at this time.
0 commit comments