Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Gauss–Newton algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Julia === The following implementation in [[Julia (programming language)|Julia]] provides one method which uses a provided Jacobian and another computing with [[automatic differentiation]].<syntaxhighlight lang="julia"> """ gaussnewton(r,J,β₀,maxiter,tol) Perform Gauss-Newton optimization to minimize the residual function `r` with Jacobian `J` starting from `β₀`. The algorithm terminates when the norm of the step is less than `tol` or after `maxiter` iterations. """ function gaussnewton(r,J,β₀,maxiter,tol) β = copy(β₀) for _ in 1:maxiter Jβ = J(β); Δ = -(Jβ'*Jβ) \ (Jβ'*r(β)) β += Δ if sqrt(sum(abs2,Δ)) < tol break end end return β end import AbstractDifferentiation as AD, Zygote backend = AD.ZygoteBackend() # other backends are available """ gaussnewton(r,β₀,maxiter,tol) Perform Gauss-Newton optimization to minimize the residual function `r` starting from `β₀`. The relevant Jacobian is calculated using automatic differentiation. The algorithm terminates when the norm of the step is less than `tol` or after `maxiter` iterations. """ function gaussnewton(r,β₀,maxiter,tol) β = copy(β₀) for _ in 1:maxiter rβ, Jβ = AD.value_and_jacobian(backend,r,β) Δ = -(Jβ[1]'*Jβ[1]) \ (Jβ[1]'*rβ) β += Δ if sqrt(sum(abs2,Δ)) < tol break end end return β end </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)