| 18:0253c5881812 | 19:63849571a046 |
|---|---|
| 10 # Our exports | 10 # Our exports |
| 11 ############## | 11 ############## |
| 12 | 12 |
| 13 export map_first_slice!, | 13 export map_first_slice!, |
| 14 reduce_first_slice, | 14 reduce_first_slice, |
| 15 norm₁, | |
| 15 norm₂, | 16 norm₂, |
| 16 γnorm₂, | 17 γnorm₂, |
| 17 norm₂w, | 18 norm₂w, |
| 18 norm₂², | 19 norm₂², |
| 19 norm₂w², | 20 norm₂w², |
| 133 | 134 |
| 134 @inline function norm₂(y) | 135 @inline function norm₂(y) |
| 135 return √(norm₂²(y)) | 136 return √(norm₂²(y)) |
| 136 end | 137 end |
| 137 | 138 |
| 139 @inline function norm₁(y) | |
| 140 accum=0 | |
| 141 for i=1:length(y) | |
| 142 @inbounds accum=accum+abs(y[i]) | |
| 143 end | |
| 144 return accum | |
| 145 end | |
| 146 | |
| 138 @inline function γnorm₂(y, γ) | 147 @inline function γnorm₂(y, γ) |
| 139 hubersq = xsq -> begin | 148 hubersq = xsq -> begin |
| 140 x=√xsq | 149 x=√xsq |
| 141 return if x > γ | 150 return if x > γ |
| 142 x-γ/2 | 151 x-γ/2 |