Application Examples
This section contains end-to-end examples for each supported kernel.
The FMM uses 64-bit arithmetic when the inputs are Float64 or ComplexF64. If all coordinates, charges, and kernel values are provided as Float32 or ComplexF32, it uses the 32-bit library. Mixing 32-bit and 64-bit inputs is rejected.
Laplace FMM
using MKL # or another BLAS/LAPACK backend configured for your Julia session
using ExaFMMt
# 64 bit representation
nsources = 10000
ntargets = 8000
sources = rand(Float64, nsources, 3)
targets = rand(Float64, ntargets, 3)
charges = rand(Float64, nsources)
A = setup(sources, targets, LaplaceFMMOptions())
y = A * charges
# 32 bit representation
sources = rand(Float32, nsources, 3)
targets = rand(Float32, ntargets, 3)
charges = rand(Float32, nsources)
A = setup(sources, targets, LaplaceFMMOptions())
y = A * charges
y[1:5]5-element Vector{Float32}:
670.5519
897.32587
662.8506
584.6072
631.2276Helmholtz FMM
using MKL # or another BLAS/LAPACK backend configured for your Julia session
using ExaFMMt
# 64 bit representation
nsources = 10000
ntargets = 8000
sources = rand(Float64, nsources, 3)
targets = rand(Float64, ntargets, 3)
charges = rand(ComplexF64, nsources)
wavek = ComplexF64.(1.0 + 1.0*im)
A = setup(sources, targets, HelmholtzFMMOptions(wavek))
y = A * charges
# 32 bit representation
sources = rand(Float32, nsources, 3)
targets = rand(Float32, ntargets, 3)
charges = rand(ComplexF32, nsources)
wavek = ComplexF32.(1.0 + 1.0*im)
A = setup(sources, targets, HelmholtzFMMOptions(wavek))
y = A * charges
y[1:5]5-element Vector{ComplexF32}:
98.67891f0 + 435.6256f0im
186.37039f0 + 590.25854f0im
164.44708f0 + 550.6999f0im
104.95276f0 + 434.86102f0im
281.78732f0 + 730.7535f0imModified-Helmholtz FMM
using MKL # or another BLAS/LAPACK backend configured for your Julia session
using ExaFMMt
# 64 bit representation
nsources = 10000
ntargets = 8000
sources = rand(Float64, nsources, 3)
targets = rand(Float64, ntargets, 3)
charges = rand(Float64, nsources)
wavek = Float64(1.0)
A = setup(sources, targets, ModifiedHelmholtzFMMOptions(wavek))
y = A * charges
# 32 bit representation
sources = rand(Float32, nsources, 3)
targets = rand(Float32, ntargets, 3)
charges = rand(Float32, nsources)
wavek = Float32(1.0)
A = setup(sources, targets, ModifiedHelmholtzFMMOptions(wavek))
y = A * charges
y[1:5]5-element Vector{Float32}:
543.4802
393.66174
317.50958
458.3266
612.35284