MethodError: no method matching adjoint(::typeof(f))

Welcome to Julia Discourse, and thanks for providing your code and stacktrace!

This means you tried to call adjoint on the function f (whose type is typeof(f)), but that method isn’t defined. Even though you didn’t explicitly write adjoint(f) anywhere, you do have

Specifically, f' is parsed as adjoint(f), so an equivalent statement to the above is

x_seq[i] = x_seq[i-1] + eta * adjoint(f)(x_seq[i-1])

It looks like you meant to take the derivative of f, so you should instead write

x_seq[i] = x_seq[i-1] + eta * Dxf(x_seq[i-1])
1 Like