# tree_d_3d.kernels.cart_moments_upward.cart_moments_upward_pyccel

*module*

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

``cart_moments_upward_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`).

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

## tree_d_3d.kernels.cart_moments_upward.cart_moments_upward_pyccel.cart_moments_upward

*function*

```python
def cart_moments_upward(pos: float[:, :], charge: float[:], perm: int64[:], levels: int64[:], node_center: float[:, :], node_start: int64[:], node_end: int64[:], node_child: int64[:], mono_parent: int64[:], mono_dir: int64[:], shift: int64[:, :], shift_coef: float[:], moments: float[:, :]) -> None
```

Moments ``m_g = sum_j q_j (r_j - c)^g`` of every node, ``|g| <= p``.

``levels[d]:levels[d + 1]`` are the nodes at depth ``d``. Leaves sum their
particles; a parent adds each child's moments shifted by ``s = c_child - c``,
``m_g += sum_b C(g, b) m_b(child) s^(g - b)`` (rows ``shift``). Levels are done from
the deepest up; the nodes of a level are independent.

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/kernels/cart_moments_upward/cart_moments_upward_pyccel.py#L14-L82)
