MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling

Hybrid Powell method for SNAE. More...

Go to the source code of this file.

Functions/Subroutines

subroutine, public solve_nonlin::hbrd (fcn, n, x, fvec, epsfcn, tol, info, diag)
 
subroutine, public solve_nonlin::hybrd (fcn, n, x, fvec, xtol, maxfev, ml, mu, epsfcn, diag, mode, factor, nprint, info, nfev)
 
subroutine solve_nonlin::dogleg (n, r, lr, diag, qtb, delta, x, wa1, wa2)
 
subroutine solve_nonlin::qform (m, n, q, ldq, wa)
 

Detailed Description

Hybrid Powell method for SNAE.

Solver for system of nonlinear algebraic equations. Downloaded from http://jblevins.org/mirror/amiller/ Code converted from the Naval Surface Warfare Center Math. Library.

Definition in file hbrd.f90.

Function/Subroutine Documentation

◆ hbrd()

subroutine public solve_nonlin::hbrd (   fcn,
integer, intent(in)  n,
real (dp), dimension(n), intent(inout)  x,
real (dp), dimension(n), intent(inout)  fvec,
real (dp), intent(in)  epsfcn,
real (dp), intent(in)  tol,
integer, intent(out)  info,
real (dp), dimension(n), intent(out)  diag 
)

SUBROUTINE HBRD THE PURPOSE OF HBRD IS TO FIND A ZERO OF A SYSTEM OF N NONLINEAR FUNCTIONS IN N VARIABLES BY A MODIFICATION OF THE POWELL HYBRID METHOD. THIS IS DONE BY USING THE MORE GENERAL NONLINEAR EQUATION SOLVER HYBRD. THE USER MUST PROVIDE A SUBROUTINE WHICH CALCULATES THE FUNCTIONS. THE JACOBIAN IS THEN CALCULATED BY A FORWARD-DIFFERENCE APPROXIMATION. THE SUBROUTINE STATEMENT IS SUBROUTINE HBRD(N, X, FVEC, EPSFCN, TOL, INFO, WA, LWA) WHERE FCN IS THE NAME OF THE USER-SUPPLIED SUBROUTINE WHICH CALCULATES THE FUNCTIONS. FCN MUST BE DECLARED IN AN EXTERNAL STATEMENT IN THE USER CALLING PROGRAM, AND SHOULD BE WRITTEN AS FOLLOWS. SUBROUTINE FCN(N, X, FVEC, IFLAG) INTEGER N,IFLAG

REAL X(N),FVEC(N)

CALCULATE THE FUNCTIONS AT X AND RETURN THIS VECTOR IN FVEC.

RETURN END THE VALUE OF IFLAG NOT BE CHANGED BY FCN UNLESS THE USER WANTS TO TERMINATE THE EXECUTION OF HBRD. IN THIS CASE SET IFLAG TO A NEGATIVE INTEGER. N IS A POSITIVE INTEGER INPUT VARIABLE SET TO THE NUMBER OF FUNCTIONS AND VARIABLES. X IS AN ARRAY OF LENGTH N. ON INPUT X MUST CONTAIN AN INITIAL ESTIMATE OF THE SOLUTION VECTOR. ON OUTPUT X CONTAINS THE FINAL ESTIMATE OF THE SOLUTION VECTOR. FVEC IS AN OUTPUT ARRAY OF LENGTH N WHICH CONTAINS THE FUNCTIONS EVALUATED AT THE OUTPUT X. EPSFCN IS AN INPUT VARIABLE USED IN DETERMINING A SUITABLE STEP LENGTH FOR THE FORWARD-DIFFERENCE APPROXIMATION. THIS APPROXIMATION ASSUMES THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF EPSFCN. IF EPSFCN IS LESS THAN THE MACHINE PRECISION, IT IS ASSUMED THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF THE MACHINE PRECISION. TOL IS A NONNEGATIVE INPUT VARIABLE. TERMINATION OCCURS WHEN THE ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO IS AN INTEGER OUTPUT VARIABLE. IF THE USER HAS TERMINATED EXECUTION, INFO IS SET TO THE (NEGATIVE) VALUE OF IFLAG. SEE DESCRIPTION OF FCN. OTHERWISE, INFO IS SET AS FOLLOWS. INFO = 0 IMPROPER INPUT PARAMETERS. INFO = 1 ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO = 2 NUMBER OF CALLS TO FCN HAS REACHED OR EXCEEDED 200*(N+1). INFO = 3 TOL IS TOO SMALL. NO FURTHER IMPROVEMENT IN THE APPROXIMATE SOLUTION X IS POSSIBLE. INFO = 4 ITERATION IS NOT MAKING GOOD PROGRESS. SUBPROGRAMS CALLED USER-SUPPLIED ...... FCN MINPACK-SUPPLIED ... HYBRD ARGONNE NATIONAL LABORATORY. MINPACK PROJECT. MARCH 1980. BURTON S. GARBOW, KENNETH E. HILLSTROM, JORGE J. MORE Reference: Powell, M.J.D. 'A hybrid method for nonlinear equations' in Numerical Methods for Nonlinear Algebraic Equations', P.Rabinowitz (editor), Gordon and Breach, London 1970.



SUBROUTINE HBRD THE PURPOSE OF HBRD IS TO FIND A ZERO OF A SYSTEM OF N NONLINEAR FUNCTIONS IN N VARIABLES BY A MODIFICATION OF THE POWELL HYBRID METHOD. THIS IS DONE BY USING THE MORE GENERAL NONLINEAR EQUATION SOLVER HYBRD. THE USER MUST PROVIDE A SUBROUTINE WHICH CALCULATES THE FUNCTIONS. THE JACOBIAN IS THEN CALCULATED BY A FORWARD-DIFFERENCE APPROXIMATION. THE SUBROUTINE STATEMENT IS SUBROUTINE HBRD(N, X, FVEC, EPSFCN, TOL, INFO, WA, LWA) WHERE FCN IS THE NAME OF THE USER-SUPPLIED SUBROUTINE WHICH CALCULATES THE FUNCTIONS. FCN MUST BE DECLARED IN AN EXTERNAL STATEMENT IN THE USER CALLING PROGRAM, AND SHOULD BE WRITTEN AS FOLLOWS. SUBROUTINE FCN(N, X, FVEC, IFLAG) INTEGER N,IFLAG

REAL X(N),FVEC(N)

CALCULATE THE FUNCTIONS AT X AND RETURN THIS VECTOR IN FVEC.

RETURN END THE VALUE OF IFLAG NOT BE CHANGED BY FCN UNLESS THE USER WANTS TO TERMINATE THE EXECUTION OF HBRD. IN THIS CASE SET IFLAG TO A NEGATIVE INTEGER. N IS A POSITIVE INTEGER INPUT VARIABLE SET TO THE NUMBER OF FUNCTIONS AND VARIABLES. X IS AN ARRAY OF LENGTH N. ON INPUT X MUST CONTAIN AN INITIAL ESTIMATE OF THE SOLUTION VECTOR. ON OUTPUT X CONTAINS THE FINAL ESTIMATE OF THE SOLUTION VECTOR. FVEC IS AN OUTPUT ARRAY OF LENGTH N WHICH CONTAINS THE FUNCTIONS EVALUATED AT THE OUTPUT X. EPSFCN IS AN INPUT VARIABLE USED IN DETERMINING A SUITABLE STEP LENGTH FOR THE FORWARD-DIFFERENCE APPROXIMATION. THIS APPROXIMATION ASSUMES THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF EPSFCN. IF EPSFCN IS LESS THAN THE MACHINE PRECISION, IT IS ASSUMED THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF THE MACHINE PRECISION. TOL IS A NONNEGATIVE INPUT VARIABLE. TERMINATION OCCURS WHEN THE ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO IS AN INTEGER OUTPUT VARIABLE. IF THE USER HAS TERMINATED EXECUTION, INFO IS SET TO THE (NEGATIVE) VALUE OF IFLAG. SEE DESCRIPTION OF FCN. OTHERWISE, INFO IS SET AS FOLLOWS. INFO = 0 IMPROPER INPUT PARAMETERS. INFO = 1 ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO = 2 NUMBER OF CALLS TO FCN HAS REACHED OR EXCEEDED 200*(N+1). INFO = 3 TOL IS TOO SMALL. NO FURTHER IMPROVEMENT IN THE APPROXIMATE SOLUTION X IS POSSIBLE. INFO = 4 ITERATION IS NOT MAKING GOOD PROGRESS. SUBPROGRAMS CALLED USER-SUPPLIED ...... FCN MINPACK-SUPPLIED ... HYBRD ARGONNE NATIONAL LABORATORY. MINPACK PROJECT. MARCH 1980. BURTON S. GARBOW, KENNETH E. HILLSTROM, JORGE J. MORE Reference: Powell, M.J.D. 'A hybrid method for nonlinear equations' in Numerical Methods for Nonlinear Algebraic Equations', P.Rabinowitz (editor), Gordon and Breach, London 1970.



SUBROUTINE HBRD THE PURPOSE OF HBRD IS TO FIND A ZERO OF A SYSTEM OF N NONLINEAR FUNCTIONS IN N VARIABLES BY A MODIFICATION OF THE POWELL HYBRID METHOD. THIS IS DONE BY USING THE MORE GENERAL NONLINEAR EQUATION SOLVER HYBRD. THE USER MUST PROVIDE A SUBROUTINE WHICH CALCULATES THE FUNCTIONS. THE JACOBIAN IS THEN CALCULATED BY A FORWARD-DIFFERENCE APPROXIMATION. THE SUBROUTINE STATEMENT IS SUBROUTINE HBRD(N, X, FVEC, EPSFCN, TOL, INFO, WA, LWA) WHERE FCN IS THE NAME OF THE USER-SUPPLIED SUBROUTINE WHICH CALCULATES THE FUNCTIONS. FCN MUST BE DECLARED IN AN EXTERNAL STATEMENT IN THE USER CALLING PROGRAM, AND SHOULD BE WRITTEN AS FOLLOWS. SUBROUTINE FCN(N, X, FVEC, IFLAG) INTEGER N,IFLAG

REAL X(N),FVEC(N)

CALCULATE THE FUNCTIONS AT X AND RETURN THIS VECTOR IN FVEC.

RETURN END THE VALUE OF IFLAG NOT BE CHANGED BY FCN UNLESS THE USER WANTS TO TERMINATE THE EXECUTION OF HBRD. IN THIS CASE SET IFLAG TO A NEGATIVE INTEGER. N IS A POSITIVE INTEGER INPUT VARIABLE SET TO THE NUMBER OF FUNCTIONS AND VARIABLES. X IS AN ARRAY OF LENGTH N. ON INPUT X MUST CONTAIN AN INITIAL ESTIMATE OF THE SOLUTION VECTOR. ON OUTPUT X CONTAINS THE FINAL ESTIMATE OF THE SOLUTION VECTOR. FVEC IS AN OUTPUT ARRAY OF LENGTH N WHICH CONTAINS THE FUNCTIONS EVALUATED AT THE OUTPUT X. EPSFCN IS AN INPUT VARIABLE USED IN DETERMINING A SUITABLE STEP LENGTH FOR THE FORWARD-DIFFERENCE APPROXIMATION. THIS APPROXIMATION ASSUMES THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF EPSFCN. IF EPSFCN IS LESS THAN THE MACHINE PRECISION, IT IS ASSUMED THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF THE MACHINE PRECISION. TOL IS A NONNEGATIVE INPUT VARIABLE. TERMINATION OCCURS WHEN THE ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO IS AN INTEGER OUTPUT VARIABLE. IF THE USER HAS TERMINATED EXECUTION, INFO IS SET TO THE (NEGATIVE) VALUE OF IFLAG. SEE DESCRIPTION OF FCN. OTHERWISE, INFO IS SET AS FOLLOWS. INFO = 0 IMPROPER INPUT PARAMETERS. INFO = 1 ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO = 2 NUMBER OF CALLS TO FCN HAS REACHED OR EXCEEDED 200*(N+1). INFO = 3 TOL IS TOO SMALL. NO FURTHER IMPROVEMENT IN THE APPROXIMATE SOLUTION X IS POSSIBLE. INFO = 4 ITERATION IS NOT MAKING GOOD PROGRESS. SUBPROGRAMS CALLED USER-SUPPLIED ...... FCN MINPACK-SUPPLIED ... HYBRD ARGONNE NATIONAL LABORATORY. MINPACK PROJECT. MARCH 1980. BURTON S. GARBOW, KENNETH E. HILLSTROM, JORGE J. MORE Reference: Powell, M.J.D. 'A hybrid method for nonlinear equations' in Numerical Methods for Nonlinear Algebraic Equations', P.Rabinowitz (editor), Gordon and Breach, London 1970.



SUBROUTINE HBRD THE PURPOSE OF HBRD IS TO FIND A ZERO OF A SYSTEM OF N NONLINEAR FUNCTIONS IN N VARIABLES BY A MODIFICATION OF THE POWELL HYBRID METHOD. THIS IS DONE BY USING THE MORE GENERAL NONLINEAR EQUATION SOLVER HYBRD. THE USER MUST PROVIDE A SUBROUTINE WHICH CALCULATES THE FUNCTIONS. THE JACOBIAN IS THEN CALCULATED BY A FORWARD-DIFFERENCE APPROXIMATION. THE SUBROUTINE STATEMENT IS SUBROUTINE HBRD(N, X, FVEC, EPSFCN, TOL, INFO, WA, LWA) WHERE FCN IS THE NAME OF THE USER-SUPPLIED SUBROUTINE WHICH CALCULATES THE FUNCTIONS. FCN MUST BE DECLARED IN AN EXTERNAL STATEMENT IN THE USER CALLING PROGRAM, AND SHOULD BE WRITTEN AS FOLLOWS. SUBROUTINE FCN(N, X, FVEC, IFLAG) INTEGER N,IFLAG

REAL X(N),FVEC(N)

CALCULATE THE FUNCTIONS AT X AND RETURN THIS VECTOR IN FVEC.

RETURN END THE VALUE OF IFLAG NOT BE CHANGED BY FCN UNLESS THE USER WANTS TO TERMINATE THE EXECUTION OF HBRD. IN THIS CASE SET IFLAG TO A NEGATIVE INTEGER. N IS A POSITIVE INTEGER INPUT VARIABLE SET TO THE NUMBER OF FUNCTIONS AND VARIABLES. X IS AN ARRAY OF LENGTH N. ON INPUT X MUST CONTAIN AN INITIAL ESTIMATE OF THE SOLUTION VECTOR. ON OUTPUT X CONTAINS THE FINAL ESTIMATE OF THE SOLUTION VECTOR. FVEC IS AN OUTPUT ARRAY OF LENGTH N WHICH CONTAINS THE FUNCTIONS EVALUATED AT THE OUTPUT X. EPSFCN IS AN INPUT VARIABLE USED IN DETERMINING A SUITABLE STEP LENGTH FOR THE FORWARD-DIFFERENCE APPROXIMATION. THIS APPROXIMATION ASSUMES THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF EPSFCN. IF EPSFCN IS LESS THAN THE MACHINE PRECISION, IT IS ASSUMED THAT THE RELATIVE ERRORS IN THE FUNCTIONS ARE OF THE ORDER OF THE MACHINE PRECISION. TOL IS A NONNEGATIVE INPUT VARIABLE. TERMINATION OCCURS WHEN THE ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO IS AN INTEGER OUTPUT VARIABLE. IF THE USER HAS TERMINATED EXECUTION, INFO IS SET TO THE (NEGATIVE) VALUE OF IFLAG. SEE DESCRIPTION OF FCN. OTHERWISE, INFO IS SET AS FOLLOWS. INFO = 0 IMPROPER INPUT PARAMETERS. INFO = 1 ALGORITHM ESTIMATES THAT THE RELATIVE ERROR BETWEEN X AND THE SOLUTION IS AT MOST TOL. INFO = 2 NUMBER OF CALLS TO FCN HAS REACHED OR EXCEEDED 200*(N+1). INFO = 3 TOL IS TOO SMALL. NO FURTHER IMPROVEMENT IN THE APPROXIMATE SOLUTION X IS POSSIBLE. INFO = 4 ITERATION IS NOT MAKING GOOD PROGRESS. SUBPROGRAMS CALLED USER-SUPPLIED ...... FCN MINPACK-SUPPLIED ... HYBRD ARGONNE NATIONAL LABORATORY. MINPACK PROJECT. MARCH 1980. BURTON S. GARBOW, KENNETH E. HILLSTROM, JORGE J. MORE Reference: Powell, M.J.D. 'A hybrid method for nonlinear equations' in Numerical Methods for Nonlinear Algebraic Equations', P.Rabinowitz (editor), Gordon and Breach, London 1970.


Definition at line 20 of file hbrd.f90.