https://github.com/avik-pal/batchednonlinearsolve.jl
Test bed for batched non linear solve algorithms (mostly for machine learning applications)
https://github.com/avik-pal/batchednonlinearsolve.jl
Last synced: about 1 month ago
JSON representation
Test bed for batched non linear solve algorithms (mostly for machine learning applications)
- Host: GitHub
- URL: https://github.com/avik-pal/batchednonlinearsolve.jl
- Owner: avik-pal
- License: mit
- Created: 2023-06-09T14:32:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T20:34:39.000Z (almost 2 years ago)
- Last Synced: 2025-01-21T04:41:56.583Z (3 months ago)
- Language: Julia
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BatchedNonlinearSolve.jl
Batched Nonlinear Solvers for Machine Learning Applications
> **Note**: This package is mostly a testbed for comparing batched nonlinear solvers.
> It is not intended for general use. Users should instead use `NonlinearSolve.jl` directly.## Available Algorithms
* `BatchedNewtonRaphson`: Newton-Raphson method.
* `BatchedDFSane`: Derivative-Free Sane method. Good choice for large-scale problems.
* `BatchedBroyden`: Broyden method.## Quickstart
```julia
using BatchedNonlinearSolve, SciMLBasef(x, p) = reshape(f(reshape(x, :, size(x, ndims(x))), p), size(x))
function f(x::AbstractMatrix, p)
residual = similar(x)
residual[1, :] .= x[1, :] .^ 2 .+ 2 .* x[1, :] .- 1
residual[2, :] .= x[2, :] .^ 2 .- 4 .* x[2, :] .+ 4
return residual
endfunction f(x::AbstractVector, p)
residual = similar(x)
residual[1] = x[1] .^ 2 .+ 2 .* x[1] .- 1
residual[2] = x[2] .^ 2 .- 4 .* x[2] .+ 4
return residual
endprob = NonlinearProblem(f, randn(Float32, 2, 5), nothing)
sol = solve(prob, BatchedNewtonRaphson())
sol.residprob = NonlinearProblem(f, randn(Float32, 2), nothing)
sol = solve(prob, BatchedNewtonRaphson())
sol.residprob = NonlinearProblem(f, randn(Float32, 1, 1, 2, 32), nothing)
sol = solve(prob, BatchedNewtonRaphson())
sol.resid
```