norm₁

Fri, 08 May 2020 14:47:33 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 08 May 2020 14:47:33 -0500
changeset 19
63849571a046
parent 18
0253c5881812
child 20
8b80aa64adec

norm₁

src/Util.jl file | annotate | diff | comparison | revisions
--- a/src/Util.jl	Fri May 08 14:46:41 2020 -0500
+++ b/src/Util.jl	Fri May 08 14:47:33 2020 -0500
@@ -12,6 +12,7 @@
 
 export map_first_slice!,
        reduce_first_slice,
+       norm₁,
        norm₂,
        γnorm₂,
        norm₂w,
@@ -135,6 +136,14 @@
     return √(norm₂²(y))
 end
 
+@inline function norm₁(y)
+    accum=0
+    for i=1:length(y)
+        @inbounds accum=accum+abs(y[i])
+    end
+    return accum
+end
+
 @inline function γnorm₂(y, γ)
     hubersq = xsq -> begin
         x=√xsq

mercurial