Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
timlautk authored Feb 6, 2018
1 parent c444d26 commit aa75b98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Tools/relu_prox.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function val = relu_prox(a,b,gamma,d,N)
val = zeros(d,N);
x = (a+gamma*b)/(1+gamma);
y = min(b,0);
val((a+gamma*b >= 0 & b >=0) | (a*(gamma-sqrt(gamma*(gamma+1))) <= gamma*b & b < 0)) = x((a+gamma*b >= 0 & b >=0) | (a*(gamma-sqrt(gamma*(gamma+1))) <= gamma*b & b < 0));
val(-a <= gamma*b & gamma*b <= a*(gamma-sqrt(gamma*(gamma+1)))) = b(-a <= gamma*b & gamma*b <= a*(gamma-sqrt(gamma*(gamma+1))));
val(a+gamma*b < 0) = y(a+gamma*b < 0);
end

0 comments on commit aa75b98

Please sign in to comment.