Specific routines for the fixpnf solver.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | fixpnf_success | = | hompack_success | |
| integer, | public, | parameter | :: | fixpnf_tol_increased | = | 2 | |
| integer, | public, | parameter | :: | fixpnf_iter_limit | = | 3 | |
| integer, | public, | parameter | :: | fixpnf_rank_loss | = | 4 | |
| integer, | public, | parameter | :: | fixpnf_lost_curve | = | 5 | |
| integer, | public, | parameter | :: | fixpnf_newton_failed | = | 6 | |
| integer, | public, | parameter | :: | fixpnf_input_error | = | 7 | |
| integer, | public, | parameter | :: | fixpnf_memory_error | = | 8 |
Linear-algebra workspace for fixpnf.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=dp), | public, | allocatable | :: | alpha(:) |
Array used during interpolation and Newton-step calculations. |
||
| real(kind=dp), | public, | allocatable | :: | qr(:,:) |
Matrix for QR factorizations used in Newton-step calculations. |
||
| real(kind=dp), | public, | allocatable | :: | tz(:) |
Array used in QR-factorization and Newton-step computations. |
||
| real(kind=dp), | public, | allocatable | :: | w(:) |
Array used during interpolation and Newton-step calculations. |
||
| real(kind=dp), | public, | allocatable | :: | wp(:) |
Array used during interpolation and Newton-step calculations. |
||
| real(kind=dp), | public, | allocatable | :: | z0(:) |
Array used for estimating the optimal next step size. |
||
| real(kind=dp), | public, | allocatable | :: | z1(:) |
Array used for estimating the optimal next step size. |
||
| integer, | public, | allocatable | :: | pivot(:) |
Pivot indices used by the QR factorization. |
| procedure, public :: alloc => alloc_workspace |
State variables for fixpnf.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=dp), | public | :: | abserr | = | zero |
Absolute error tolerance. |
|
| real(kind=dp), | public | :: | relerr | = | zero |
Relative error tolerance. |
|
| real(kind=dp), | public | :: | curtol | = | zero |
Curvature-based error tolerance. |
|
| real(kind=dp), | public | :: | h | = | zero |
Optimal step size for the next step to be attempted by stepnf. |
|
| real(kind=dp), | public | :: | hold | = | zero |
||yp - ypold|| at the previous step. |
|
| real(kind=dp), | public | :: | s | = | zero |
Total arc length of the solution path followed by the algorithm. |
|
| integer, | public | :: | iflag | = | -100 |
Problem type and status flag. |
|
| integer, | public | :: | limit | = | -100 |
Limit on the number of steps allowed in the main loop of fixpnf. |
|
| integer, | public | :: | n | = | 0 |
Problem dimension. |
|
| integer, | public | :: | nfe | = | 0 |
Number of homotopy/Jacobian evaluations performed.
This counter is incremented once for each call to |
|
| logical, | public | :: | start | = | .true. |
Flag to indicate the first call to stepnf. |
|
| logical, | public | :: | crash | = | .false. |
Flag to indicate that the return state of stepnf is a crash. |
|
| real(kind=dp), | public, | allocatable | :: | a(:) |
Parameter vector for curve-tracking problems, or initial point for the fixed-point and zero-finding problems. |
||
| real(kind=dp), | public, | allocatable | :: | y(:) |
Current point on the zero curve. |
||
| real(kind=dp), | public, | allocatable | :: | yold(:) |
Previous point found on the zero curve. |
||
| real(kind=dp), | public, | allocatable | :: | yp(:) |
Unit tangent vector to the zero curve at |
||
| real(kind=dp), | public, | allocatable | :: | ypold(:) |
Unit tangent vector to the zero curve at |
||
| type(nf_workspace), | public | :: | workspace |
Linear-algebra workspace. |
| procedure, public :: alloc => alloc_state |
Container to hold the configuration for a call to fixpnf.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=dp), | public | :: | arcre | = | zero |
Relative error tolerance for the normal-flow iteration used while tracking the
zero curve. If nonpositive, the default value |
|
| real(kind=dp), | public | :: | arcae | = | zero |
Absolute error tolerance for the normal-flow iteration used while tracking the
zero curve. If nonpositive, the default value |
|
| real(kind=dp), | public | :: | ansre | = | 1e-10_dp |
Relative error tolerance required of the final solution at |
|
| real(kind=dp), | public | :: | ansae | = | 1e-10_dp |
Absolute error tolerance required of the final solution at |
|
| real(kind=dp), | public | :: | cursw | = | 10.0_dp |
Curvature switch. If the curvature of any component of |
|
| real(kind=dp), | public, | dimension(8) | :: | sspar | = | zero |
Step-size control parameters:
|
| integer, | public | :: | max_steps | = | 1000 |
Maximum number of steps allowed in the main loop. |
|
| integer, | public | :: | lunit | = | 0 |
Logical I/O unit for intermediate output.
* |
|
| logical, | public | :: | polsys | = | .false. |
Optional flag used only by the polynomial-system driver POLSYS1H. |
Container to hold the state variables and user-supplied callbacks for fixpnf.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | problem_type | = | -100 | ||
| logical, | public | :: | initialized | = | .false. | ||
| type(nf_state), | public | :: | state | ||||
| type(nf_config), | public | :: | config | ||||
| type(hompack_f_callbacks), | public | :: | callbacks |
| procedure, public :: initialize => nf_solver_initialize | |
| procedure, public :: solve => nf_solver_solve | |
| procedure, public :: restart => nf_solver_restart |
Container to hold the results of a call to fixpnf.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=dp), | public | :: | arc_length | = | zero |
Arc length of the zero curve until the solution was found. |
|
| real(kind=dp), | public | :: | lambda | = | zero |
Final value of the homotopy parameter at the solution. |
|
| real(kind=dp), | public, | allocatable | :: | x(:) |
Final value of the independent variable at the solution. |
||
| integer, | public | :: | nfe | = | 0 |
Number of homotopy/Jacobian evaluations. |
|
| type(hompack_status), | public | :: | status |
Status. |
This function initializes a nf_solver object for a specified problem type, user-supplied callbacks, and configuration parameters. It validates the inputs, allocates necessary state variables (deallocation included), and binds the callbacks to the solver object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(nf_solver), | intent(inout) | :: | self |
Solver object. |
||
| integer, | intent(in) | :: | problem_type |
Problem type. Must be one of the following:
* |
||
| type(hompack_f_callbacks), | intent(in) | :: | callbacks |
User-supplied function and Jacobian evaluation subroutines. Required callbacks
depend on |
||
| integer, | intent(in) | :: | n |
Problem dimension, i.e., the dimension of the independent variable . |
||
| integer, | intent(in), | optional | :: | dima |
Dimension of the parameter vector for curve-tracking problems. Required if
|
|
| type(nf_config), | intent(in), | optional | :: | config |
Configuration parameters. If not provided, default values are used. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(nf_solver), | intent(inout) | :: | self |
Solver object. |
||
| real(kind=dp), | intent(in) | :: | x0(:) |
Initial point for the solver. For fixed-point and zero-finding problems, this is the initial guess . For curve-tracking problems, this is the initial solution at . |
||
| real(kind=dp), | intent(in), | optional | :: | a(:) |
Parameter vector for curve-tracking problems. Required if the solver was
initialized with |
This subroutine finds a fixed point or zero of the N-dimensional vector function , or tracks a zero curve of a general homotopy map .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(nf_state), | intent(inout) | :: | state |
Preallocated state for fixpnf. Set to start conditions on the first call, and
updated on subsequent calls when |
||
| type(hompack_f_callbacks), | intent(in) | :: | callbacks |
User-supplied function and Jacobian evaluation subroutines. |
||
| integer, | intent(in) | :: | n |
Problem dimension. |
||
| real(kind=dp), | intent(in) | :: | x0(:) |
Initial point for the solver. For fixed-point and zero-finding problems, this is identical to the initial guess . For curve-tracking problems, this is the initial solution at . |
||
| integer, | intent(inout) | :: | iflag |
Problem type and status flag. |
||
| type(nf_config), | intent(inout) | :: | config |
Configuration parameters for the solver. Optional settings will be set to default
values. Tolerances may be updated (increased) on output if |
||
| real(kind=dp), | intent(in), | optional | :: | a(:) |
Parameter vector |
This subroutine finds the point ybar = (1, xbar) on the zero curve of the homotopy
map. It starts with two points yold = (lambdaold, xold) and y = (lambda, x) such
that lambdaold < 1 <= lambda , and alternates between secant estimates of ybar
and Newton iteration until convergence.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(nf_state), | intent(inout) | :: | state |
State variables for fixpnf. |
||
| type(hompack_f_callbacks) | :: | callbacks |
User-supplied function and Jacobian evaluation subroutines. |
|||
| real(kind=dp), | intent(in) | :: | relerr |
Relative convergence tolerance.
Iteration is considered converged when |
||
| real(kind=dp), | intent(in) | :: | abserr |
Absolute convergence tolerance.
Used together with |
This subroutine takes one step along the zero curve of the homotopy map using a
predictor-corrector algorithm. The predictor uses a Hermite cubic interpolant, and
the corrector returns to the zero curve along the flow normal to the Davidenko flow.
stepnf also estimates a step size h for the next step along the zero curve.
Normally, stepnf is used indirectly through fixpnf, and should be called
directly only if it is necessary to modify the stepping algorithm's parameters.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(nf_state), | intent(inout) | :: | state |
State variables for fixpnf. |
||
| type(hompack_f_callbacks), | intent(in) | :: | callbacks |
User-supplied function and Jacobian evaluation subroutines. |
||
| real(kind=dp), | intent(in) | :: | sspar(:) |
Step-size control parameters:
|
This subroutine builds the Jacobian matrix of the homotopy map, computes a QR decomposition of that matrix, and then calculates the (unit) tangent vector and the Newton step.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(hompack_f_callbacks) | :: | callbacks |
User-supplied function and Jacobian evaluation subroutines. |
|||
| real(kind=dp), | intent(inout) | :: | rholen |
Controls computation of the homotopy residual norm. |
||
| integer, | intent(in) | :: | n |
Problem dimension. |
||
| real(kind=dp), | intent(in) | :: | y(:) |
Current point on the homotopy zero curve. |
||
| real(kind=dp), | intent(out) | :: | yp(:) |
Unit tangent vector to the zero curve at |
||
| real(kind=dp), | intent(in) | :: | ypold(:) |
Unit tangent vector at the previous point on the zero curve. |
||
| real(kind=dp), | intent(in) | :: | a(:) |
Parameter vector used in the homotopy map. |
||
| integer, | intent(inout) | :: | nfe |
Number of homotopy/Jacobian evaluations performed. Incremented by one on every successful call. |
||
| integer, | intent(inout) | :: | iflag |
Problem type and return status flag. |
||
| real(kind=dp), | intent(inout) | :: | qr(:,:) |
Workspace containing the Jacobian matrix and its QR factorization.
|
||
| real(kind=dp), | intent(inout) | :: | alpha(:) |
Workspace array used during QR factorization and related linear algebra
operations. |
||
| real(kind=dp), | intent(out) | :: | tz(:) |
Newton correction vector. |
||
| integer, | intent(inout) | :: | pivot(:) |
Pivot indices produced by the QR factorization. |
Initializes nf_workspace, i.e., (re)allocates all allocatable arrays and sets them to zero.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(nf_workspace), | intent(inout) | :: | self |
Workspace object. |
||
| integer, | intent(in) | :: | n |
Problem dimension. |
||
| integer, | intent(out), | optional | :: | stat |
Error status of the allocation. |
Initializes nf_state, i.e., (re)allocates all allocatable arrays and sets them to zero.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(nf_state), | intent(inout) | :: | self |
State object. |
||
| integer, | intent(in) | :: | n |
Problem dimension. |
||
| integer, | intent(in) | :: | dima |
Dimension of the parameter vector |
||
| integer, | intent(out), | optional | :: | stat |
Error status of the allocation. |