More strongly hint @inline

Tue, 19 Nov 2019 10:15:38 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 19 Nov 2019 10:15:38 -0500
changeset 8
c5aabb2c41d9
parent 7
ab7d59b47140
child 9
1cffd3d07fe2

More strongly hint @inline

src/Gradient.jl file | annotate | diff | comparison | revisions
--- a/src/Gradient.jl	Tue Nov 19 10:12:04 2019 -0500
+++ b/src/Gradient.jl	Tue Nov 19 10:15:38 2019 -0500
@@ -74,22 +74,22 @@
 end
 
 @inline function ∇₂fold!(f!::Function, u, state)
-    g! = (state, pt) -> begin
+    @inline function g!(state, pt)
         (i, j) = pt
         g = @inbounds [u[i+1, j]-u[i, j], u[i, j+1]-u[i, j]]
         return f!(g, state, pt)
     end
-    gr! = (state, pt) -> begin
+    @inline function gr!(state, pt)
         (i, j) = pt
         g = @inbounds [u[i+1, j]-u[i, j], 0.0]
         return f!(g, state, pt)
     end
-    gb! = (state, pt) -> begin
+    @inline function gb!(state, pt)
         (i, j) = pt
         g = @inbounds [0.0, u[i, j+1]-u[i, j]]
         return f!(g, state, pt)
     end
-    g0! = (state, pt) -> begin
+    @inline function g0!(state, pt)
         return f!([0.0, 0.0], state, pt)
     end
     return imfold₂′!(g!, g!, gr!,
@@ -133,12 +133,12 @@
 
 @inline function ∇₂cfold!(f!::Function, u, state)
     n, m = size(u)
-    g! = (state, pt) -> begin
+    @inline function g!(state, pt)
         (i, j) = pt
         g = @inbounds [(u[i+1, j]-u[i-1, j])/2, (u[i, j+1]-u[i, j-1])/2]
         return f!(g, state, pt)
     end
-    gb! = (state, pt) -> begin
+    @inline function gb!(state, pt)
         (i, j) = pt
         g = @inbounds [(u[min(i+1,n), j]-u[max(i-1,1), j])/2,
                        (u[i, min(j+1,m)]-u[i, max(j-1,1)])/2]

mercurial