我在读PETSc.jl里DMSTAG_Stokes_2D.jl这个例子时,遇到这样一段代码:
function ComputeSparsityPatternJacobian_automatic(x_l, user_ctx)
# This computes the sparsity pattern and coloring of the jacobian automatically
# This will works for any equation but is slow @ high resolutions
f_Residual = (x -> ForwardDiff_res(x, user_ctx)); # pass additional arguments into the routine
J_julia = ForwardDiff.jacobian(f_Residual,x_l*0 .+ 1);# Compute a "blank" jacobian
# employ sparse structure to compute jacobian - to be moved inside routines
jac = sparse(J_julia);
colors = matrix_colors(jac) # the number of nonzeros per row
return jac, colors
end
想问里面的x → ForwardDiff_res(x, user_ctx)是什么意思?或者在manual哪里可以找到相关内容。第一次遇到这种写法,不是很理解,manual里也没找到相关内容。