Fortran interfaces

Helmholtz FMM

The Helmholtz FMM evaluates the following potential, its gradient and its hessian

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla H_{0}^{(1)}(\|x-x_{j}\|) \, .\]

Here \(x_{j}\) are the source locations, \(c_{j}\) are the charge strengths, \(v_{j}\) are the dipole strengths, and \(d_{j}\) are the dipole orientation vectors. The collection of \(x\) at which the potential and its gradient are evaluated are referred to as the evalution points.

There are 27 different Fortran wrappers for the Helmholtz FMM to account for collection of evaluation points (sources only, targets only, sources+targets), interaction kernel (charges only, dipoles only, charges + dipoles), output request (potential, potential+gradient,potential+gradient+hessian).

For example, the subroutine to evaluate the potential and gradient, at a collection of targets \(t_{i}\) due to a collection of charges is:

hfmm2d_t_c_g

In general, the subroutine names take the following form:

hfmm2d_<eval-pts>_<int-ker>_<out>
  • <eval-pts>: evaluation points. Collection of x where \(u\) and its gradient is to be evaluated

    • s: Evaluate \(u\) and its gradient at the source locations \(x_{i}\)

    • t: Evaluate \(u\) and its gradient at \(t_{i}\), a collection of target locations specified by the user.

    • st: Evaluate \(u\) and its gradient at both source and target locations \(x_{i}\) and \(t_{i}\).

  • <int-ker>: kernel of interaction (type of sources present)

    • c: charges

    • d: dipoles

    • cd: charges + dipoles

  • <out>: flag for evaluating potential or potential + gradient

    • p: on output only \(u\) is evaluated

    • g: on output both \(u\) and its gradient are evaluated

    • h: on output \(u\), its gradient and its hessian are evaluated

These are all the single density routines. To get a vectorized version of any of the routines use:

<subroutine name>_vec

Note

For the vectorized subroutines, the charge strengths, dipole strengths, potentials, and gradients are interleaved as opposed to provided in a sequential manner. For example for three sets of charge strengths, they should be stored as \(c_{1,1}, c_{2,1}, c_{3,1}, c_{1,2}, c_{2,2},c_{3,2} \ldots c_{1,N}, c_{2,N}, c_{3,N}\).

Example drivers:

  • examples/hfmm2d_example.f. The corresponding makefile is examples/hfmm2d_example.make

  • examples/hfmm2d_vec_example.f. The corresponding makefile is examples/hfmm2d_vec_example.make

List of interfaces

hfmm2d_s_c_p

  • Evaluation points: Sources

  • Interaction kernel: Charges

  • Outputs requested: Potential


subroutine hfmm2d_s_c_p(eps,zk,nsource,source,charge,pot,ier)

This subroutine evaluates the potential

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_c_p_vec(nd,eps,zk,nsource,source,charge,pot,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_c_g

  • Evaluation points: Sources

  • Interaction kernel: Charges

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_s_c_g(eps,zk,nsource,source,charge,pot,grad,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_c_g_vec(nd,eps,zk,nsource,source,charge,pot,grad,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_c_h

  • Evaluation points: Sources

  • Interaction kernel: Charges

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_s_c_h(eps,zk,nsource,source,charge,pot,grad,hess,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • hess: double complex(3,nsource)

    Hessian at source locations, \(\nabla \nabla u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_c_h_vec(nd,eps,zk,nsource,source,charge,pot,grad,hess,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • hess: double complex(nd,3,nsource)

    Hessian at source locations, \(\nabla \nabla u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_d_p

  • Evaluation points: Sources

  • Interaction kernel: Dipoles

  • Outputs requested: Potential


subroutine hfmm2d_s_d_p(eps,zk,nsource,source,dipstr,dipvec,pot,ier)

This subroutine evaluates the potential

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_d_p_vec(nd,eps,zk,nsource,source,dipstr,dipvec,pot,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_d_g

  • Evaluation points: Sources

  • Interaction kernel: Dipoles

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_s_d_g(eps,zk,nsource,source,dipstr,dipvec,pot,grad,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_d_g_vec(nd,eps,zk,nsource,source,dipstr,dipvec,pot,grad,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_d_h

  • Evaluation points: Sources

  • Interaction kernel: Dipoles

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_s_d_h(eps,zk,nsource,source,dipstr,dipvec,pot,grad,hess,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • hess: double complex(3,nsource)

    Hessian at source locations, \(\nabla \nabla u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_d_h_vec(nd,eps,zk,nsource,source,dipstr,dipvec,pot,grad,hess,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • hess: double complex(nd,3,nsource)

    Hessian at source locations, \(\nabla \nabla u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_cd_p

  • Evaluation points: Sources

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential


subroutine hfmm2d_s_cd_p(eps,zk,nsource,source,charge,dipstr,dipvec,pot,ier)

This subroutine evaluates the potential

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_cd_p_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,pot,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_cd_g

  • Evaluation points: Sources

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_s_cd_g(eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_cd_g_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_s_cd_h

  • Evaluation points: Sources

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_s_cd_h(eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,hess,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • hess: double complex(3,nsource)

    Hessian at source locations, \(\nabla \nabla u(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_s_cd_h_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,hess,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source locations \(x=x_{j}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • hess: double complex(nd,3,nsource)

    Hessian at source locations, \(\nabla \nabla u_{\ell}(x_{j})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_c_p

  • Evaluation points: Targets

  • Interaction kernel: Charges

  • Outputs requested: Potential


subroutine hfmm2d_t_c_p(eps,zk,nsource,source,charge,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_c_p_vec(nd,eps,zk,nsource,source,charge,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_c_g

  • Evaluation points: Targets

  • Interaction kernel: Charges

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_t_c_g(eps,zk,nsource,source,charge,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_c_g_vec(nd,eps,zk,nsource,source,charge,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_c_h

  • Evaluation points: Targets

  • Interaction kernel: Charges

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_t_c_h(eps,zk,nsource,source,charge,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • hesstarg: double complex(3,ntarg)

    Hessian at target locations, \(\nabla \nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_c_h_vec(nd,eps,zk,nsource,source,charge,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • hesstarg: double complex(nd,3,ntarg)

    Hessian at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_d_p

  • Evaluation points: Targets

  • Interaction kernel: Dipoles

  • Outputs requested: Potential


subroutine hfmm2d_t_d_p(eps,zk,nsource,source,dipstr,dipvec,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_d_p_vec(nd,eps,zk,nsource,source,dipstr,dipvec,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_d_g

  • Evaluation points: Targets

  • Interaction kernel: Dipoles

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_t_d_g(eps,zk,nsource,source,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_d_g_vec(nd,eps,zk,nsource,source,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_d_h

  • Evaluation points: Targets

  • Interaction kernel: Dipoles

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_t_d_h(eps,zk,nsource,source,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • hesstarg: double complex(3,ntarg)

    Hessian at target locations, \(\nabla \nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_d_h_vec(nd,eps,zk,nsource,source,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • hesstarg: double complex(nd,3,ntarg)

    Hessian at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_cd_p

  • Evaluation points: Targets

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential


subroutine hfmm2d_t_cd_p(eps,zk,nsource,source,charge,dipstr,dipvec,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_cd_p_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_cd_g

  • Evaluation points: Targets

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_t_cd_g(eps,zk,nsource,source,charge,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_cd_g_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_t_cd_h

  • Evaluation points: Targets

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_t_cd_h(eps,zk,nsource,source,charge,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • hesstarg: double complex(3,ntarg)

    Hessian at target locations, \(\nabla \nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_t_cd_h_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the target locations \(x=t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • hesstarg: double complex(nd,3,ntarg)

    Hessian at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_c_p

  • Evaluation points: Sources and Targets

  • Interaction kernel: Charges

  • Outputs requested: Potential


subroutine hfmm2d_st_c_p(eps,zk,nsource,source,charge,pot,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_c_p_vec(nd,eps,zk,nsource,source,charge,pot,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_c_g

  • Evaluation points: Sources and Targets

  • Interaction kernel: Charges

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_st_c_g(eps,zk,nsource,source,charge,pot,grad,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_c_g_vec(nd,eps,zk,nsource,source,charge,pot,grad,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_c_h

  • Evaluation points: Sources and Targets

  • Interaction kernel: Charges

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_st_c_h(eps,zk,nsource,source,charge,pot,grad,hess,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • hess: double complex(3,nsource)

    Hessian at source locations, \(\nabla \nabla u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • hesstarg: double complex(3,ntarg)

    Hessian at target locations, \(\nabla \nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_c_h_vec(nd,eps,zk,nsource,source,charge,pot,grad,hess,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • hess: double complex(nd,3,nsource)

    Hessian at source locations, \(\nabla \nabla u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • hesstarg: double complex(nd,3,ntarg)

    Hessian at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_d_p

  • Evaluation points: Sources and Targets

  • Interaction kernel: Dipoles

  • Outputs requested: Potential


subroutine hfmm2d_st_d_p(eps,zk,nsource,source,dipstr,dipvec,pot,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_d_p_vec(nd,eps,zk,nsource,source,dipstr,dipvec,pot,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_d_g

  • Evaluation points: Sources and Targets

  • Interaction kernel: Dipoles

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_st_d_g(eps,zk,nsource,source,dipstr,dipvec,pot,grad,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_d_g_vec(nd,eps,zk,nsource,source,dipstr,dipvec,pot,grad,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_d_h

  • Evaluation points: Sources and Targets

  • Interaction kernel: Dipoles

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_st_d_h(eps,zk,nsource,source,dipstr,dipvec,pot,grad,hess,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = -\sum_{j=1}^{N} v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • hess: double complex(3,nsource)

    Hessian at source locations, \(\nabla \nabla u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • hesstarg: double complex(3,ntarg)

    Hessian at target locations, \(\nabla \nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_d_h_vec(nd,eps,zk,nsource,source,dipstr,dipvec,pot,grad,hess,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • hess: double complex(nd,3,nsource)

    Hessian at source locations, \(\nabla \nabla u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • hesstarg: double complex(nd,3,ntarg)

    Hessian at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_cd_p

  • Evaluation points: Sources and Targets

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential


subroutine hfmm2d_st_cd_p(eps,zk,nsource,source,charge,dipstr,dipvec,pot,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_cd_p_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,pot,ntarg,targ,pottarg,ier)

This subroutine evaluates the potential

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_cd_g

  • Evaluation points: Sources and Targets

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential and Gradient


subroutine hfmm2d_st_cd_g(eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_cd_g_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,ntarg,targ,pottarg,gradtarg,ier)

This subroutine evaluates the potential and its gradient

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory

hfmm2d_st_cd_h

  • Evaluation points: Sources and Targets

  • Interaction kernel: Charges and Dipoles

  • Outputs requested: Potential, Gradient and Hessian


subroutine hfmm2d_st_cd_h(eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,hess,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u(x) = \sum_{j=1}^{N} c_{j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{j} d_{j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • eps: double precision

    precision requested

  • zk: double complex

    Helmholtz parameter, k

  • nsource: integer

    Number of sources

  • source: double precision(3,nsource)

    Source locations, \(x_{j}\)

  • charge: double complex(nsource)

    Charge strengths, \(c_{j}\)

  • dipstr: double complex(nsource)

    Dipole strengths, \(v_{j}\)

  • dipvec: double precision(2,nsource)

    Dipole orientation vectors, \(d_{j}\)

  • ntarg: integer

    Number of targets

  • targ: double precision(3,ntarg)

    Target locations, \(t_{i}\)

Output arguments:

  • pot: double complex(nsource)

    Potential at source locations, \(u(x_{j})\)

  • grad: double complex(2,nsource)

    Gradient at source locations, \(\nabla u(x_{j})\)

  • hess: double complex(3,nsource)

    Hessian at source locations, \(\nabla \nabla u(x_{j})\)

  • pottarg: double complex(ntarg)

    Potential at target locations, \(u(t_{i})\)

  • gradtarg: double complex(2,ntarg)

    Gradient at target locations, \(\nabla u(t_{i})\)

  • hesstarg: double complex(3,ntarg)

    Hessian at target locations, \(\nabla \nabla u(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory


Vectorized version:

subroutine hfmm2d_st_cd_h_vec(nd,eps,zk,nsource,source,charge,dipstr,dipvec,pot,grad,hess,ntarg,targ,pottarg,gradtarg,hesstarg,ier)

This subroutine evaluates the potential, its gradient, and its hessian

\[u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} H_{0}^{(1)}(k\|x-x_{j}\|) - v_{\ell,j} d_{\ell,j}\cdot \nabla \left( H_{0}^{(1)}(k\|x-x_{j}\|)\right)\]

at the source and target locations \(x=x_{j},t_{i}\). When \(x=x_{j}\), the term corresponding to \(x_{j}\) is dropped from the sum.

Input arguments:

  • nd: integer

    number of densities

  • charge: double complex(nd,nsource)

    Charge strengths, \(c_{\ell,j}\)

  • dipstr: double complex(nd,nsource)

    Dipole strengths, \(v_{\ell,j}\)

  • dipvec: double precision(nd,2,nsource)

    Dipole orientation vectors, \(d_{\ell,j}\)

Output arguments:

  • pot: double complex(nd,nsource)

    Potential at source locations, \(u_{\ell}(x_{j})\)

  • grad: double complex(nd,2,nsource)

    Gradient at source locations, \(\nabla u_{\ell}(x_{j})\)

  • hess: double complex(nd,3,nsource)

    Hessian at source locations, \(\nabla \nabla u_{\ell}(x_{j})\)

  • pottarg: double complex(nd,ntarg)

    Potential at target locations, \(u_{\ell}(t_{i})\)

  • gradtarg: double complex(nd,2,ntarg)

    Gradient at target locations, \(\nabla u_{\ell}(t_{i})\)

  • hesstarg: double complex(nd,3,ntarg)

    Hessian at target locations, \(\nabla u_{\ell}(t_{i})\)

  • ier: integer

    Error flag; ier=0 implies successful execution, and ier=4/8 implies insufficient memory