Nonlinear Equation Solver with Modern Fortran.
A basic Newton-Raphson type nonlinear equation solver for sparse or dense systems with m functions of n input variables.
A work in progress.
- Is object-oriented.
- Works with square, under-determined, or over-determined systems.
- Can use different methods to solve the linear system:
- LAPACK routines (
dgesvordgels) for dense systems: Ifn=m, usesdgesv(LU decomposition). Ifn/=m, usesdgels(ifm>nuses QR factorization, ifm<nuses LQ factorization). - lsqr -- a conjugate-gradient type method for solving sparse linear equations and sparse least-squares problems.
- lusol -- A sparse LU factorization for square and rectangular matrices, with Bartels-Golub-Reid updates for column replacement and other rank-1 modifications.
- lsmr -- a conjugate-gradient type method for solving sparse linear equations and sparse least-squares problems
- The user can also provide a custom linear solver.
- LAPACK routines (
- Has a Broyden update option (sparse and dense versions).
- Has various line search options.
- use a specified constant step size (0,1]
- backtracking linesearch method
- exact linesearch method using fmin minimizer
- evaluate function at specified fixed points
- Has two options for variable bounds (
xlow<=x<=xupp):- Ignore bounds
- Crude method: manually adjust
xvector at each function evaluation so thatx = min(max(x,xlow),xupp).
- A Fortran Package Manager file is also included, so that the library and tests cases can be compiled with FPM. For example:
fpm build --profile release fpm test --profile release By default, the library is built with double precision (real64) real values. Explicitly specifying the real kind can be done using the following preprocessor flags:
| Preprocessor flag | Kind | Number of bytes |
|---|---|---|
REAL32 | real(kind=real32) | 4 |
REAL64 | real(kind=real64) | 8 |
REAL128 | real(kind=real128) | 16 |
For example, to build a single precision version of the library, use:
fpm build --profile release --flag "-DREAL32" To use nlesolver within your fpm project, add the following to your fpm.toml file:
[dependencies] nlesolver-fortran = { git="https://github.com/jacobwilliams/nlesolver-fortran.git" }Or to use a specific version:
[dependencies] nlesolver-fortran = { git="https://github.com/jacobwilliams/nlesolver-fortran.git", tag="1.1.0" }Note that LAPACK is required to build. The fmin, lsqr, lusol, and lsmr libraries are also dependencies (which will be automatically downloaded by fpm).
- The API documentation for the current
masterbranch can be found here. This is generated by processing the source files with FORD.
- The NLESolver-Fortran source code and related files and documentation are distributed under a permissive free software license (BSD-3).
- C. G. Broyden, "A Class of Methods for Solving Nonlinear Simultaneous Equations", Math. Comp. 19 (1965), 577-593
- L. K. Schubert, "Modification of a Quasi-Newton Method for Nonlinear Equations with a Sparse Jacobian", Mathematics of Computation, Vol. 24, No. 109 (Jan., 1970), pp. 27-30.
