fmm package¶
Subpackages¶
Submodules¶
fmm.dtype module¶
Supported datatypes.
fmm.fmm module¶
The Fmm object acts as the API for interacting the PyExaFMM.
- class fmm.fmm.Fmm(config_filename=None)¶
Bases:
object
FMM class. Configure with pre-computed operators and octree.
>>> e = Fmm('config') # Initialise experiment >>> e.run() # Run upward & downward passes together >>> e.clear() # Clear containers, to re-run experiment
- clear()¶
Clear containers
- downward_pass()¶
- Pre-order traversal of tree. Compute local expansions for all nodes,
and evaluate these at target points.
- run()¶
Run full algorithm
- upward_pass()¶
- Post-order traversal of tree, compute multipole expansions for all
nodes.
fmm.kernel module¶
Kernels
- fmm.kernel.laplace_grad_cpu(x, y, c, m_inv_4pi, zero)¶
Numba Laplace kernel gradient.
x : np.array(shape=(3), dtype=float) y : np.array(shape=(3), dtype=float) c : int
Component to consider, c ∈ {0, 1, 2}.
float
- fmm.kernel.laplace_gradient(sources, targets, source_densities)¶
Numba P2P operator for gradient of Laplace kernel.
sources : np.array(shape=(n, 3), dtype=float) targets : np.array(shape=(m, 3), dtype=float) source_densities : np.array(shape=(m), dtype=float)
- np.array(shape=(m, 3), dtype=float)
Target potential gradients.
- fmm.kernel.laplace_gram_matrix_parallel(sources, targets)¶
Dense Numba P2P operator for Laplace kernel.
sources : np.array(shape=(n, 3), dtype=float) targets : np.array(shape=(m, 3), dtype=float)
- np.array(shape=(m, n), dtype=float)
The Gram matrix.
- fmm.kernel.laplace_gram_matrix_serial(sources, targets)¶
Dense Numba P2P operator for Laplace kernel.
sources : np.array(shape=(n, 3), dtype=float) targets : np.array(shape=(m, 3), dtype=float)
- np.array(shape=(m, n), dtype=float)
The Gram matrix.
- fmm.kernel.laplace_kernel_cpu(x, y, m_inv_4pi, zero)¶
Numba Laplace CPU kernel.
- xnp.array(shape=(3), dtype=float)
Source coordinate.
- ynp.array(shape=(3), dtype=float)
Target coordinate.
float
- fmm.kernel.laplace_p2p_parallel(sources, targets, source_densities, source_index_pointer, target_index_pointer)¶
- Parallelised P2P function, which relies on source/target data being described
by index pointers such that they are arranged by interaction. i.e. targets and all sources required for P2P evaluation have the same pointer. This is needed to maximise cache re-use, and reduce accesses to memory during the parallel evaluation. This function calculates potentials and gradients.
sources: np.array((nsources, 3), dtype=float) targets : np.array((ntargets, 3), dtype=float) source_densities : np.array((nsources, 3), dtype=float) source_index_pointer: np.array(nnodes+1, dtype=int)
Created using the backend.prepare_u_list_data function.
- target_index_pointer: np.array(nnodes+1, dtype=int)
Created using the backend.prepare_u_list_data function.
- fmm.kernel.laplace_p2p_serial(sources, targets, source_densities)¶
Numba P2P operator for Laplace kernel.
sources : np.array(shape=(n, 3), dtype=float) targets : np.array(shape=(m, 3), dtype=float) source_densities : np.array(shape=(m,), dtype=float)
- np.array(shape=(m), dtype=float)
Target potential densities.
- fmm.kernel.laplace_scale(level)¶
Level scale for the Laplace kernel.
level : int
float
fmm.linalg module¶
Linear algebra utilities
- fmm.linalg.pinv(a)¶
Moore-Penrose Pseudo-Inverse calculation via SVD.
a : np.array(shape=(m, n), dtype=float)
- fmm.linalg.pinv2(a)¶
- Moore-Penrose Pseudo-Inverse calculation via SVD. Return SVD result in two
components, as in Malhotra et. al. (2015).
a : np.array(shape=(m, n), dtype=float)
fmm.surface module¶
Surface creation utilities
- fmm.surface.compute_surface(order, dtype)¶
Compute surface to a specified order.
- orderint
Order, n_coefficients = 6(order-1)^2 + 2
- dtypetype
np.float32, np.float64
- fmm.surface.scale_surface(surf, radius, level, center, alpha)¶
- Shift and scale a given surface to a new center, and radius relative to the
original surface.
- surfnp.array(shape=(n, 3), dtype=float)
Discretized surface.
- radiusfloat
Half side length of the octree root node.
- levelint
Tree level of the scaled node.
- centernp.array(shape=(1, 3), dtype=float)
Centre of the shifted node.
- alphafloat
Relative size of surface.
- np.array(shape=(n_coeffs, 3), dtype=float)
Scaled and shifted surface.