## Documentation for module negf_integr_simpson

Adaptive Simpson's rule algorithm to integrate a complex-valued function in a complex plane

source: negf_integr_simpson.F

#### public Types:

simpsonrule_type
A structure to store data needed for adaptive Simpson's rule algorithm.

#### public Subroutines/Functions:

Get the next set of nodes where to compute integrand.
Initialise a Simpson's rule environment variable.
Compute integral using the simpson's rules.
Release a Simpson's rule environment variable.

#### Parameters:

 INTEGER :: sr_shape_arc = contour_shape_arc INTEGER :: sr_shape_linear = contour_shape_linear

#### TYPE :: simpsonrule_type^

A structure to store data needed for adaptive Simpson's rule algorithm.

 COMPLEX(dp) :: a ... COMPLEX(dp) :: b ... INTEGER :: shape_id ... REAL(dp) :: conv ... REAL(dp) :: error ... REAL(dp) :: error_conv ... TYPE(cp_cfm_type), POINTER :: integral ... TYPE(cp_cfm_type), POINTER :: integral_conv ... TYPE(cp_cfm_type), POINTER :: integral_abc ... TYPE(cp_cfm_type), POINTER :: integral_cde ... TYPE(cp_cfm_type), POINTER :: integral_ace ... TYPE(cp_fm_type), POINTER :: error_fm ... TYPE(cp_fm_type), POINTER :: weights ... TYPE(simpsonrule_subinterval_type), ALLOCATABLE, DIMENSION(:) :: subintervals ... REAL(dp), ALLOCATABLE, DIMENSION(:) :: tnodes ...

#### SUBROUTINEsimpsonrule_get_next_nodes(sr_env, xnodes_next, nnodes)^

Get the next set of nodes where to compute integrand.

##### Arguments:
 TYPE(simpsonrule_type), INTENT(inout) :: sr_env Simpson's rule environment (modified on exit) COMPLEX(dp), INTENT(out) :: xnodes_next(nnodes) list of additional points (initialised on exit) INTEGER, INTENT(inout) :: nnodes actual number of points to compute (modified on exit)

#### SUBROUTINEsimpsonrule_init(sr_env, xnodes, nnodes, a, b, shape_id, conv, weights, tnodes_restart)^

Initialise a Simpson's rule environment variable.

##### Arguments:
 TYPE(simpsonrule_type), INTENT(out) :: sr_env Simpson's rule environment (initialised on exit) COMPLEX(dp), INTENT(out) :: xnodes(nnodes) points at which an integrand needs to be computed (initialised on exit) INTEGER, INTENT(inout) :: nnodes initial number of points to compute (initialised on exit) COMPLEX(dp), INTENT(in) :: a integral lower boundary COMPLEX(dp), INTENT(in) :: b integral upper boundary INTEGER, INTENT(in) :: shape_id shape of a curve along which the integral will be evaluated REAL(dp), INTENT(in) :: conv convergence threshold TYPE(cp_fm_type), POINTER :: weights weights associated with matrix elements; used to compute cumulative error REAL(dp), INTENT(in), OPTIONAL :: tnodes_restart(nnodes) list of nodes over the interval [-1 .. 1] from a previous integral evaluation. If present, the same set of 'xnodes' will be used to compute this integral.

#### SUBROUTINEsimpsonrule_refine_integral(sr_env, zdata_next)^

Compute integral using the simpson's rules.

##### Arguments:
 TYPE(simpsonrule_type), INTENT(inout) :: sr_env Simpson's rule environment TYPE(cp_cfm_p_type), INTENT(inout) :: zdata_next(:) precomputed integrand values at points xnodes_next (nullified on exit)

#### SUBROUTINEsimpsonrule_release(sr_env)^

Release a Simpson's rule environment variable.

##### Arguments:
 TYPE(simpsonrule_type), INTENT(inout) :: sr_env Simpson's rule environment (modified on exit)

#### TYPE :: simpsonrule_subinterval_type^

A structure to store data for non-converged sub-interval.

 REAL(dp) :: lb ... REAL(dp) :: ub ... REAL(dp) :: conv ... REAL(dp) :: error ... TYPE(cp_cfm_type), POINTER :: fa ... TYPE(cp_cfm_type), POINTER :: fb ... TYPE(cp_cfm_type), POINTER :: fc ... TYPE(cp_cfm_type), POINTER :: fd ... TYPE(cp_cfm_type), POINTER :: fe ...