This repository provides MATLAB routines for quickly computing N-Body calculations in 2D and 3D and is designed to work with generic translation invariant kernels
The routines can also be used to compute sums involving source and target derivatives, such as
NOTE: The routines always skip terms with
The documentation is available at https://pcfft.readthedocs.io/en/latest/.
PCFFT can be installed from source
git clone https://github.com/meliao/pcfft.git --recurse-submodules
The --recurse-submodules flag ensures that the FLAM package is available.
Detailed documentation is being built in docs/.
[grid_info, proxy_info] = get_grid(kernel, src_info, targ_info, ...
tol, n_nbr)
This routine determines the size of the equispaced grid, the number of proxy points used for spreading, and the spreading parameters.
[A_spread, sort_info] = get_spread(kern_0, kern_der, ...
src_info, grid_info, proxy_info, der_fields)
This routine returns the matrix that maps charge strengths at src_info.r to charge strengths on the equispaced grid, it also returns some point binning info used in get_addsub()
A_addsub = get_addsub(kern_0, kern_st, grid_info, proxy_info, sort_info_s, ...
sort_info_t, A_spread_s, A_spread_t)
This routine returns the matrix that fixes the near-field interactions that are done incorrectly by the spreading.
kern_hat = get_kernhat(kern_0, grid_info)
Evaluate FFT of kern_0 on the equispaced grid.
u = pcfft_apply(sigma, A_spread_s, A_spread_t, A_addsub, kern_0hat)
Compute the N-body sum using a precorrected FFT.
See the demos/ directory for a variety of examples, including demonstrating pairing this package with some popular repositories.
This method in this package requires solving many poorly conditioned least squares problems. The numerous warnings that this generates can be suppresed by running warning('off','MATLAB:rankDeficientMatrix');.