ZerSol Library  0.0.0
Solver for all zeros of an analytic function that lie within a rectangular region of a complex plane
 All Classes Namespaces Files Functions Typedefs Friends Macros
Functions/Subroutines
zersolf.f File Reference

The Fortran language bindings for the ZerSol C++ library functions. More...

Functions/Subroutines

subroutine template_subroutine (z, f, p)
 The template subroutine for complex analytic function f(z) and its derivative f'(z).
 
subroutine create_solver (solver, f, df, data, xmin, xmax, ymin, ymax)
 Create a data structure needed for the subsequent calls of the solver functions.
 
subroutine find_zeros (solver, N, Z, V, n_zeros, status)
 Run the zeros search procedure.
 
subroutine print_status (solver, file_name, length)
 Print the status of the zeros search.
 
subroutine print_dump (solver, file_name, length)
 Print the dump of the solver data.
 
subroutine free_solver (solver)
 Free the memory allocated by the solver.
 
subroutine set_nd_method (solver, method)
 Set a finite difference method for numerical evaluation of the function derivative.
 
subroutine set_nd_step (solver, h)
 Set a step size (dz) for numerical evaluation of the function derivative.
 
subroutine set_min_rec_lev (solver, min_rec_lev)
 Set the minimum recursion level for the winding number evaluation procedure.
 
subroutine set_max_rec_lev (solver, max_rec_lev)
 Set the maximum recursion level for the winding number evaluation procedure.
 
subroutine set_interp_err (solver, interp_err)
 Set a tolerance of interpolation for the winding number evaluation procedure.
 
subroutine set_jump_err (solver, jump_err)
 Set a tolerance of test for discontinuities for the winding number evaluation procedure.
 
subroutine set_n_target (solver, n_target)
 Set a desired number of the function zeros.
 
subroutine set_start_array (solver, n_start, start)
 Set the array of a user supplied starting values for the Newton's iterations.
 
subroutine set_n_split_x (solver, n_split_x)
 Set the number of automatic starting points along Re{z}.
 
subroutine set_n_split_y (solver, n_split_y)
 Set the number of automatic starting points along Im{z}.
 
subroutine set_max_iter_num (solver, max_iter_num)
 Set the maximum number of the Newton's iterations for each starting point.
 
subroutine set_multiplicity (solver, multiplicity)
 Set the multiplicity of a zero.
 
subroutine set_eps_for_arg (solver, abs_eps_z, rel_eps_z)
 Set the absolute and relative tolerances for the convergence condition on z.
 
subroutine set_eps_for_func (solver, abs_eps_f, rel_eps_f)
 Set the absolute and relative tolerances for the convergence condition on f(z).
 
subroutine set_use_winding (solver, use_winding)
 Set a flag that defines whether the solver will use the winding number evaluation or just Newton iterations.
 
subroutine set_max_part_level (solver, max_part_level)
 Set the maximum allowed level of the rectangle partition.
 
subroutine set_debug_level (solver, debug_level)
 Set the debug level (determines the amount of internal checks).
 
subroutine set_print_level (solver, print_level)
 Set the print level (determines the amount of details printed).
 
subroutine get_nd_method (solver, method)
 Get a finite difference method for numerical evaluation of the function derivative.
 
subroutine get_nd_step (solver, h)
 Get a step size (dz) for numerical evaluation of the function derivative.
 
subroutine get_min_rec_lev (solver, min_rec_lev)
 Get the minimum recursion level for the winding number evaluation procedure.
 
subroutine get_max_rec_lev (solver, max_rec_lev)
 Get the maximum recursion level for the winding number evaluation procedure.
 
subroutine get_interp_err (solver, interp_err)
 Get a tolerance of interpolation for the winding number evaluation procedure.
 
subroutine get_jump_err (solver, jump_err)
 Get a tolerance of test for discontinuities for the winding number evaluation procedure.
 
subroutine get_n_target (solver, n_target)
 Get a desired number of the function zeros.
 
subroutine get_start_array (solver, n_start, start)
 Get the array of a user supplied starting values for the Newton's iterations.
 
subroutine get_n_split_x (solver, n_split_x)
 Get the number of automatic starting points along Re{z}.
 
subroutine get_n_split_y (solver, n_split_y)
 Get the number of automatic starting points along Im{z}.
 
subroutine get_max_iter_num (solver, max_iter_num)
 Get the maximum number of the Newton's iterations for each starting point.
 
subroutine get_multiplicity (solver, multiplicity)
 Get the multiplicity of a zero.
 
subroutine get_eps_for_arg (solver, abs_eps_z, rel_eps_z)
 Get the absolute and relative tolerances for the convergence condition on z.
 
subroutine get_eps_for_func (solver, abs_eps_f, rel_eps_f)
 Get the absolute and relative tolerances for the convergence condition on f(z).
 
subroutine get_use_winding (solver, use_winding)
 Get a flag that defines whether the solver will use the winding number evaluation or just Newton iterations.
 
subroutine get_max_part_level (solver, max_part_level)
 Get the maximum allowed level of the rectangle partition.
 
subroutine get_debug_level (solver, debug_level)
 Get the debug level (determines the amount of internal checks).
 
subroutine get_print_level (solver, print_level)
 Get the print level (determines the amount of details printed).
 

Detailed Description

The Fortran language bindings for the ZerSol C++ library functions.

The following subroutines demonstrate the Fortran interface of the ZerSol library functions. Make sure that precision of floating point numbers in your Fortran code

integer, parameter :: prec = 8 ! prec = 4 for single precision and prec = 8 for double precision

is consistent with that used in the ZerSol Fortran bindings. You can change the type of floating point numbers used in the ZerSol interface in the file zersolf.cpp in line:

#define _Real double /* float, double (recommended) */

Don't forget to rebuild the ZerSol Fortran bindings after that!

Please note, that pp parameter defined in a user Fortran code (see test cases) must conform the architecture of your machine:

integer, parameter :: pp = 8 ! pp = 4 for 32-bit machines and pp = 8 for 64-bit machines

Function/Subroutine Documentation

subroutine template_subroutine ( complex(prec)  z,
complex(prec)  f,
  p 
)

The template subroutine for complex analytic function f(z) and its derivative f'(z).

Parameters
zvalue of independent complex variable
fthe function value at z
pany additional parameter: a number, an array, etc...
subroutine create_solver ( integer(pp)  solver,
integer(pp)  f,
integer(pp)  df,
  data,
real(prec)  xmin,
real(prec)  xmax,
real(prec)  ymin,
real(prec)  ymax 
)

Create a data structure needed for the subsequent calls of the solver functions.

Parameters
solveraddress of the solver structure
faddress of a Fortran subroutine that evaluates the complex function value
dfaddress of a Fortran subroutine that evaluates the complex function derivative
dataa structure (a number, an array, etc) that can be used to pass any data into the function and its derivative
xminminimum x-coordinate of the rectangular region
xmaxmaximum x-coordinate of the rectangular region
yminminimum y-coordinate of the rectangular region
ymaxmaximum y-coordinate of the rectangular region
subroutine find_zeros ( integer(pp)  solver,
integer  N,
complex(prec), dimension(n)  Z,
complex(prec), dimension(n)  V,
integer  n_zeros,
integer  status 
)

Run the zeros search procedure.

Parameters
solveraddress of the solver structure
Nlength of the passed Z and V arrays
Zarray for the function zeros
Varray for the function values V = F(Z)
n_zerosnumber of the zeros found
statussearch status
subroutine print_status ( integer(pp)  solver,
character(length+1)  file_name,
integer  length 
)

Print the status of the zeros search.

Parameters
solveraddress of the solver structure
file_namename of a file to store the search status
lengthlength of the trimmed file_name character array
subroutine print_dump ( integer(pp)  solver,
character(length+1)  file_name,
integer  length 
)

Print the dump of the solver data.

Parameters
solveraddress of the solver structure
file_namename of a file to store the solver dump
lengthlength of the trimmed file_name character array
subroutine free_solver ( integer(pp)  solver)

Free the memory allocated by the solver.

Parameters
solveraddress of the solver structure
subroutine set_nd_method ( integer(pp)  solver,
integer  method 
)

Set a finite difference method for numerical evaluation of the function derivative.

Parameters
solveraddress of the solver structure
methodfinite difference method: pass method = 0 for 3-point stencil approximation (second order) and method = 1 for 5-point stencil approximation (fourth order)
subroutine set_nd_step ( integer(pp)  solver,
real(prec)  h 
)

Set a step size (dz) for numerical evaluation of the function derivative.

Parameters
solveraddress of the solver structure
hstep size
subroutine set_min_rec_lev ( integer(pp)  solver,
integer  min_rec_lev 
)

Set the minimum recursion level for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
min_rec_levminimum recursion level
subroutine set_max_rec_lev ( integer(pp)  solver,
integer  max_rec_lev 
)

Set the maximum recursion level for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
max_rec_levmaximum recursion level
subroutine set_interp_err ( integer(pp)  solver,
real(prec)  interp_err 
)

Set a tolerance of interpolation for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
interp_errtolerance of interpolation
subroutine set_jump_err ( integer(pp)  solver,
real(prec)  jump_err 
)

Set a tolerance of test for discontinuities for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
jump_errtolerance of test for discontinuities
subroutine set_n_target ( integer(pp)  solver,
integer  n_target 
)

Set a desired number of the function zeros.

Parameters
solveraddress of the solver structure
n_targettarget number of zeros
subroutine set_start_array ( integer(pp)  solver,
integer  n_start,
complex(prec), dimension(n_start)  start 
)

Set the array of a user supplied starting values for the Newton's iterations.

Parameters
solveraddress of the solver structure
n_startnumber of starting values
startarray of starting values
subroutine set_n_split_x ( integer(pp)  solver,
integer  n_split_x 
)

Set the number of automatic starting points along Re{z}.

Parameters
solveraddress of the solver structure
n_split_xnumber of starting points
subroutine set_n_split_y ( integer(pp)  solver,
integer  n_split_y 
)

Set the number of automatic starting points along Im{z}.

Parameters
solveraddress of the solver structure
n_split_ynumber of starting points
subroutine set_max_iter_num ( integer(pp)  solver,
integer  max_iter_num 
)

Set the maximum number of the Newton's iterations for each starting point.

Parameters
solveraddress of the solver structure
max_iter_nummaximum number of iterations
subroutine set_multiplicity ( integer(pp)  solver,
integer  multiplicity 
)

Set the multiplicity of a zero.

Parameters
solveraddress of the solver structure
multiplicityexpected multiplicity of a zero
subroutine set_eps_for_arg ( integer(pp)  solver,
real(prec)  abs_eps_z,
real(prec)  rel_eps_z 
)

Set the absolute and relative tolerances for the convergence condition on z.

Parameters
solveraddress of the solver structure
abs_eps_zabsolute tolerance
rel_eps_zrelative tolerance
subroutine set_eps_for_func ( integer(pp)  solver,
real(prec)  abs_eps_f,
real(prec)  rel_eps_f 
)

Set the absolute and relative tolerances for the convergence condition on f(z).

Parameters
solveraddress of the solver structure
abs_eps_fabsolute tolerance
rel_eps_frelative tolerance
subroutine set_use_winding ( integer(pp)  solver,
integer  use_winding 
)

Set a flag that defines whether the solver will use the winding number evaluation or just Newton iterations.

Parameters
solveraddress of the solver structure
use_windingflag: true - use the winding number evaluation, false - use the Newton's iterations only
subroutine set_max_part_level ( integer(pp)  solver,
integer  max_part_level 
)

Set the maximum allowed level of the rectangle partition.

Parameters
solveraddress of the solver structure
max_part_levelpartition level
subroutine set_debug_level ( integer(pp)  solver,
integer  debug_level 
)

Set the debug level (determines the amount of internal checks).

Parameters
solveraddress of the solver structure
debug_leveldebug level
subroutine set_print_level ( integer(pp)  solver,
integer  print_level 
)

Set the print level (determines the amount of details printed).

Parameters
solveraddress of the solver structure
print_levelprint level
subroutine get_nd_method ( integer(pp)  solver,
integer  method 
)

Get a finite difference method for numerical evaluation of the function derivative.

Parameters
solveraddress of the solver structure
methodfinite difference method: method = 0 for 3-point stencil approximation (second order) and method = 1 for 5-point stencil approximation (fourth order)
subroutine get_nd_step ( integer(pp)  solver,
real(prec)  h 
)

Get a step size (dz) for numerical evaluation of the function derivative.

Parameters
solveraddress of the solver structure
hstep size
subroutine get_min_rec_lev ( integer(pp)  solver,
integer  min_rec_lev 
)

Get the minimum recursion level for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
min_rec_levminimum recursion level
subroutine get_max_rec_lev ( integer(pp)  solver,
integer  max_rec_lev 
)

Get the maximum recursion level for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
max_rec_levmaximum recursion level
subroutine get_interp_err ( integer(pp)  solver,
real(prec)  interp_err 
)

Get a tolerance of interpolation for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
interp_errtolerance of interpolation
subroutine get_jump_err ( integer(pp)  solver,
real(prec)  jump_err 
)

Get a tolerance of test for discontinuities for the winding number evaluation procedure.

Parameters
solveraddress of the solver structure
jump_errtolerance of test for discontinuities
subroutine get_n_target ( integer(pp)  solver,
integer  n_target 
)

Get a desired number of the function zeros.

Parameters
solveraddress of the solver structure
n_targettarget number of zeros
subroutine get_start_array ( integer(pp)  solver,
integer  n_start,
complex(prec)  start 
)

Get the array of a user supplied starting values for the Newton's iterations.

Parameters
solveraddress of the solver structure
n_startnumber of starting values
startarray of starting values to be filled in
subroutine get_n_split_x ( integer(pp)  solver,
integer  n_split_x 
)

Get the number of automatic starting points along Re{z}.

Parameters
solveraddress of the solver structure
n_split_xnumber of starting points
subroutine get_n_split_y ( integer(pp)  solver,
integer  n_split_y 
)

Get the number of automatic starting points along Im{z}.

Parameters
solveraddress of the solver structure
n_split_ynumber of starting points
subroutine get_max_iter_num ( integer(pp)  solver,
integer  max_iter_num 
)

Get the maximum number of the Newton's iterations for each starting point.

Parameters
solveraddress of the solver structure
max_iter_nummaximum number of iterations
subroutine get_multiplicity ( integer(pp)  solver,
integer  multiplicity 
)

Get the multiplicity of a zero.

Parameters
solveraddress of the solver structure
multiplicityexpected multiplicity of a zero
subroutine get_eps_for_arg ( integer(pp)  solver,
real(prec)  abs_eps_z,
real(prec)  rel_eps_z 
)

Get the absolute and relative tolerances for the convergence condition on z.

Parameters
solveraddress of the solver structure
abs_eps_zabsolute tolerance
rel_eps_zrelative tolerance
subroutine get_eps_for_func ( integer(pp)  solver,
real(prec)  abs_eps_f,
real(prec)  rel_eps_f 
)

Get the absolute and relative tolerances for the convergence condition on f(z).

Parameters
solveraddress of the solver structure
abs_eps_fabsolute tolerance
rel_eps_frelative tolerance
subroutine get_use_winding ( integer(pp)  solver,
integer  use_winding 
)

Get a flag that defines whether the solver will use the winding number evaluation or just Newton iterations.

Parameters
solveraddress of the solver structure
use_windingflag: true - use the winding number evaluation, false - use the Newton's iterations only
subroutine get_max_part_level ( integer(pp)  solver,
integer  max_part_level 
)

Get the maximum allowed level of the rectangle partition.

Parameters
solveraddress of the solver structure
max_part_levelmaximum partition level
subroutine get_debug_level ( integer(pp)  solver,
integer  debug_level 
)

Get the debug level (determines the amount of internal checks).

Parameters
solveraddress of the solver structure
debug_leveldebug level
subroutine get_print_level ( integer(pp)  solver,
integer  print_level 
)

Get the print level (determines the amount of details printed).

Parameters
solveraddress of the solver structure
print_levelprint level