# tree_d_3d.kernels.fmm_m2l_host.fmm_m2l_host_pyccel

*module*

The Pyccel version (CPU) of the ``fmm_m2l_host`` kernel of the FMM.

``fmm_m2l_host_numpy.py`` next to this file is the version for machines without Pyccel,
with the same arguments; the folder's ``__init__.py`` declares the kernel (see
`tree_d_3d.kernels`). The flat quadtree is described in `tree_d_3d.flat_tree`.

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/kernels/fmm_m2l_host/fmm_m2l_host_pyccel.py#L1-L1)

## tree_d_3d.kernels.fmm_m2l_host.fmm_m2l_host_pyccel.fmm_m2l_host

*function*

```python
def fmm_m2l_host(row_start: int64[:], sources: int64[:], dst_center: float[:, :], src_center: float[:, :], moment_re: float[:, :], moment_im: float[:, :], coeff: float[:, :], local_re: float[:, :], local_im: float[:, :]) -> None
```

Add the multipoles of cells ``sources[row_start[n]:row_start[n + 1]]`` to cell ``n``.

The destination cells' centres are ``dst_center``, the sources' ``src_center``
(the same array within one tree).

With ``t = c_dst - c_src``, ``w = 1 / t`` and the scaled moments
``a'_k = a_k w**k`` (``a'_0 = a_0``), the translation is a real matrix product,
``s_l = sum_k coeff[k, l] a'_k``, with ``coeff[0, l] = 1 / l``,
``coeff[k, 0] = 1 / k`` and ``coeff[k, l] = C(k + l - 1, l) / k`` (zero beyond the
truncation): ``b_0 += a_0 ln t - s_0`` and ``b_l += -(-1)**l s_l w**l``. Each cell
is written by its own row only, so the rows are independent (chunks of 64 cells
share their scratch).

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/kernels/fmm_m2l_host/fmm_m2l_host_pyccel.py#L16-L105)
