Fri, 08 May 2020 14:46:41 -0500
proj_nonneg!
src/Util.jl | file | annotate | diff | comparison | revisions |
--- a/src/Util.jl Mon Apr 20 18:47:09 2020 -0500 +++ b/src/Util.jl Fri May 08 14:46:41 2020 -0500 @@ -22,6 +22,7 @@ dot, mean, proj_norm₂₁ball!, + proj_nonneg!, curry, ⬿, @threadsif, @@ -191,5 +192,14 @@ end end +@inline function proj_nonneg!(y) + @inbounds @simd for i=1:length(y) + if y[i] < 0 + y[i] = 0 + end + end + return y +end + end # Module