The Fast Multipole Method and other Fast Summation Techniques

Similar documents
Lecture 2: The Fast Multipole Method

(1) u i = g(x i, x j )q j, i = 1, 2,..., N, where g(x, y) is the interaction potential of electrostatics in the plane. 0 x = y.

INTRODUCTION TO FAST MULTIPOLE METHODS LONG CHEN

Fast multipole method

18.336J/6.335J: Fast methods for partial differential and integral equations. Lecture 13. Instructor: Carlos Pérez Arancibia

A direct solver with O(N) complexity for integral equations on one-dimensional domains

A fast randomized algorithm for computing a Hierarchically Semi-Separable representation of a matrix

Fast matrix algebra for dense matrices with rank-deficient off-diagonal blocks

Approximate Voronoi Diagrams

Fast Matrix Computations via Randomized Sampling. Gunnar Martinsson, The University of Colorado at Boulder

Fast Multipole Methods

A direct solver for elliptic PDEs in three dimensions based on hierarchical merging of Poincaré-Steklov operators

Scalability Metrics for Parallel Molecular Dynamics

Lecture 8: Boundary Integral Equations

Introduction to Discrete Optimization

Fast numerical methods for solving linear PDEs

The Sommerfeld Polynomial Method: Harmonic Oscillator Example

Particle Methods. Lecture Reduce and Broadcast: A function viewpoint

Computing and Communicating Functions over Sensor Networks

Hierarchical Matrices. Jon Cockayne April 18, 2017

A Crash Course on Fast Multipole Method (FMM)

MULTI-LAYER HIERARCHICAL STRUCTURES AND FACTORIZATIONS

Int. Statistical Inst.: Proc. 58th World Statistical Congress, 2011, Dublin (Session CPS014) p.4149

An implementation of the Fast Multipole Method without multipoles

The Convergence of Mimetic Discretization

Fundamental Solutions and Green s functions. Simulation Methods in Acoustics

H 2 -matrices with adaptive bases

Fast Algorithms and Integral Equation Methods. CS 598 APK - Fall 2017

Improved Fast Gauss Transform. Fast Gauss Transform (FGT)

PRIMES Math Problem Set

Notes on the second moment method, Erdős multiplication tables

A HIGH-ORDER ACCURATE ACCELERATED DIRECT SOLVER FOR ACOUSTIC SCATTERING FROM SURFACES

Lecture 1: Introduction

Fast multipole boundary element method for the analysis of plates with many holes

SMT 2013 Power Round February 2, 2013

A Fast N-Body Solver for the Poisson(-Boltzmann) Equation

Analysis of Approximate Quickselect and Related Problems

Course notes: Fast Methods in Scientific Computation

Hilbert Space Methods for Reduced-Rank Gaussian Process Regression

7.4 Relative Rates of Growth

Fast direct solvers for elliptic PDEs

SUPERVISED LEARNING: INTRODUCTION TO CLASSIFICATION

In-Class Soln 1. CS 361, Lecture 4. Today s Outline. In-Class Soln 2

Sequences and Summations. CS/APMA 202 Rosen section 3.2 Aaron Bloomfield

A fast method for solving the Heat equation by Layer Potentials

J.I. Aliaga 1 M. Bollhöfer 2 A.F. Martín 1 E.S. Quintana-Ortí 1. March, 2009

Rapid evaluation of electrostatic interactions in multi-phase media

Image Reconstruction And Poisson s equation

A direct solver for variable coefficient elliptic PDEs discretized via a composite spectral collocation method Abstract: Problem formulation.

data structures and algorithms lecture 2

Combinatorial Optimization

Applications of the Lopsided Lovász Local Lemma Regarding Hypergraphs

Discrete Bayesian Networks: The Exact Posterior Marginal Distributions

A Fast Adaptive Multipole Algorithm in Three Dimensions

On the Average Path Length of Complete m-ary Trees

INF2220: algorithms and data structures Series 1

Fast evaluation of boundary integral operators arising from an eddy current problem. MPI MIS Leipzig

ACO Comprehensive Exam October 14 and 15, 2013

Notes on the Matrix-Tree theorem and Cayley s tree enumerator

Holdout and Cross-Validation Methods Overfitting Avoidance

Algorithms PART II: Partitioning and Divide & Conquer. HPC Fall 2007 Prof. Robert van Engelen

An Overview of Fast Multipole Methods

arxiv: v2 [math.pr] 23 Feb 2017

Analysis of Algorithms I: Asymptotic Notation, Induction, and MergeSort

Multipole-Based Preconditioners for Sparse Linear Systems.

What is a semigroup? What is a group? What is the difference between a semigroup and a group?

Sparse Fourier Transform via Butterfly Algorithm

MATH 829: Introduction to Data Mining and Analysis Graphical Models I

Transforming Hierarchical Trees on Metric Spaces

The Prime Number Theorem

Improved Fast Gauss Transform. (based on work by Changjiang Yang and Vikas Raykar)

CHAPTER 3 POTENTIALS 10/13/2016. Outlines. 1. Laplace s equation. 2. The Method of Images. 3. Separation of Variables. 4. Multipole Expansion

Notes by Zvi Rosen. Thanks to Alyssa Palfreyman for supplements.

The number of Euler tours of random directed graphs

Math 671: Tensor Train decomposition methods

Assignment 5: Solutions

McGill University Faculty of Science. Solutions to Practice Final Examination Math 240 Discrete Structures 1. Time: 3 hours Marked out of 60

Divide and Conquer Algorithms

MARKING A BINARY TREE PROBABILISTIC ANALYSIS OF A RANDOMIZED ALGORITHM

Polynomial evaluation and interpolation on special sets of points

FastMMLib: a generic Fast Multipole Method library. Eric DARRIGRAND. IRMAR Université de Rennes 1

Asymptotic Statistics-III. Changliang Zou

ACO Comprehensive Exam March 20 and 21, Computability, Complexity and Algorithms

On the inverse matrix of the Laplacian and all ones matrix

CS 542G: The Poisson Problem, Finite Differences

Extreme Point Solutions for Infinite Network Flow Problems

3. Numerical Quadrature. Where analytical abilities end...

PHYSICS DEPARTMENT, PRINCETON UNIVERSITY PHYSICS 301 MIDTERM EXAMINATION. October 22, 2003, 10:00 10:50 am, Jadwin A06 SOLUTIONS

Curved spacetime tells matter how to move

5.6 Logarithmic and Exponential Equations

n f(k) k=1 means to evaluate the function f(k) at k = 1, 2,..., n and add up the results. In other words: n f(k) = f(1) + f(2) f(n). 1 = 2n 2.

Phylogenetic Networks, Trees, and Clusters

Newton s Method and Localization

Graphical Models and Kernel Methods

On Procedures Controlling the FDR for Testing Hierarchically Ordered Hypotheses

Homework #5 Solutions

Spatial Misalignment

Randomized Algorithms III Min Cut

Unranked Tree Automata with Sibling Equalities and Disequalities

On zero-sum partitions and anti-magic trees

Transcription:

The Fast Multipole Method and other Fast Summation Techniques Gunnar Martinsson The University of Colorado at Boulder

(The factor of 1/2π is suppressed.) Problem definition: Consider the task of evaluation the sum N (1) u i = G(x i, x j ) q j, i = 1, 2,..., N, j=1 where {x i } N i=1 is a given set of points in a square Ω in the plane, where {q i } N i=1 is a given set of real numbers which we call charges, and where {u i } N i=1 is a sought set of real numbers which we call potentials. The kernel G is given by log(x y), when x y (2) G(x, y) = 0 when x = y. Recall: A point x R 2 is represented by the complex number x = x 1 + i x 2 C. Then the kernel in (2) is a complex representation of the fundamental solution to the Laplace equation in R 2 since log x y = Real ( log(x y) ).

Special case: Sources and targets are separate Charges q j at locations {y j } N j=1. Potentials u i at locations {x i } M i=1. u i = N q j log(x i y j ), j=1 i = 1, 2,..., M u i = u(x i ), i = 1, 2,..., M u(x) = N q j log(x y j ) j=1 Direct evaluation Cost is O(M N).

Special case: Sources and targets are separate Charges q j at locations {y j } N j=1. Potentials u i at locations {x i } M i=1. u i = N q j log(x i y j ), j=1 i = 1, 2,..., M u i = u(x i ), i = 1, 2,..., M u(x) = N q j log(x y j ) j=1 Multipole expansion: Since u is harmonic outside the magenta circle, we know that 1 u(x) = α 0 log(x c) + α p (x c) p, where α p = 1 N ( q j yj c) p. p p=1 j=1

Special case: Sources and targets are separate Charges q j at locations {y j } N j=1. Potentials u i at locations {x i } M i=1. u i = N q j log(x i y j ), j=1 i = 1, 2,..., M u i = u(x i ), i = 1, 2,..., M u(x) = N q j log(x y j ) j=1 Multipole expansion truncated to P + 1 terms: Since u is harmonic outside the magenta circle, we know that P 1 u(x) = α 0 log(x c) + α p (x c) p + E P, where α p = 1 N ( q j yj c) p. p p=1 j=1 ( r ) ( ) P ( ) P P 2a 2 The approximation error E P scales as E P = =. R a

Special case: Sources and targets are separate Charges q j at locations {y j } N j=1. Potentials u i at locations {x i } M i=1. u i = N q j log(x i y j ), j=1 i = 1, 2,..., M u i = u(x i ), i = 1, 2,..., M u(x) = N q j log(x y j ) j=1 Multipole expansion truncated to P + 1 terms costs: Evaluate α p = 1 N ( q j yj c) p for p = 0, 1,..., P cost is O(N P ). p j=1 Evaluate u i = α 0 log(x c) + P p=1 1 α p cost is O(M P ). (x c) p

We write the map in matrix form as A B C ε, or q C ˆq A 2222222 2 B where q = [q j ] N j=1 RN is the vector of sources u = [u i ] M i=1 CM is the vector of potentials ˆq = [ˆq p ] N p=0 CP +1 is the outgoing expansion (the multipole coefficients ) A C M N C C (P +1) N is the outgoing-from-sources map B C M (P +1) is the targets-from-outgoing map. u A ij = log(x i y j ) 1 p = 0 C pj = (1/p) (y j c) p p 0 log(x i c) p = 0 B ip = 1/(x i c) p p 0

Definition: Let Ω be a square with center c = (c 1, c 2 ) and side length 2a. Then we say that a point x R 2 is well-separated from Ω if max( x 1 c 1, x 2 c 2 ) a. y 1 6a 2a c y 2 y Ω x 1 x 2 x x Any point on or outside of the dashed square is well-separated from Ω. Consequently, the points x 2, x, and x are well-separated from Ω, but x 1 is not.

Single-level Barnes-Hut Suppose that we seek to evaluate all pairwise interactions between the N particles shown above. We suppose the particles are more or less evenly distributed for now.

Single-level Barnes-Hut Place a square grid of boxes on top of the computational box. Assume each box holds about N box particles (so there are about N/N box boxes).

Single-level Barnes-Hut How do you evaluate the potentials at the blue locations?

Single-level Barnes-Hut How do you evaluate the potentials at the blue locations? Directly evaluate interactions with the particles close by. For all long-distance interactions, use the out-going expansion!

Cost of the single-level Barnes-Hut algorithm: Let N box denote the number of particles in a box. For each particle, we need to do the following: Step 1: Evaluate the P outgoing moments: Step 2: Evaluate potentials from out-going expansions: Step : Evaluate potentials from close particles: P ((N/N box ) 9) P 9 N box Using that P is a smallish constant we find cost N 2 N box + N N box. Set N box N 1/2 to obtain: cost N 1.5. We re doing better than O(N 2 ) but still not great.

Notation single level Barnes-Hut: Partition the box Ω into smaller boxes and label them: 8 16 2 2 0 8 56 6 7 15 2 1 9 7 55 6 6 1 22 0 8 6 5 62 5 1 21 29 7 5 5 61 12 20 28 6 52 60 11 19 27 5 51 59 2 10 18 26 2 50 58 1 9 17 25 1 9 57 For a box τ, let L (nei) τ denote its neighbors, and L (far) τ denote the remaining boxes.

Notation single level Barnes-Hut: Partition the box Ω into smaller boxes and label them: 8 16 2 2 0 8 56 6 7 15 2 1 9 7 55 6 6 1 22 0 8 6 5 62 5 1 21 29 7 5 5 61 12 20 28 6 52 60 11 19 27 5 51 59 2 10 18 26 2 50 58 1 9 17 25 1 9 57 For a box τ, let L (nei) τ denote its neighbors, and L (far) τ denote the remaining boxes. The box τ = 21 is marked with red.

Notation single level Barnes-Hut: Partition the box Ω into smaller boxes and label them: 8 16 2 2 0 8 56 6 7 15 2 1 9 7 55 6 6 1 22 0 8 6 5 62 5 1 21 29 7 5 5 61 12 20 28 6 52 60 11 19 27 5 51 59 2 10 18 26 2 50 58 1 9 17 25 1 9 57 For a box τ, let L (nei) τ denote its neighbors, and L (far) τ denote the remaining boxes. The box τ = 21 is marked with red. L (nei) 21 = {12, 1, 1, 20, 22, 28, 29, 0} are the blue boxes.

Notation single level Barnes-Hut: Partition the box Ω into smaller boxes and label them: 8 16 2 2 0 8 56 6 7 15 2 1 9 7 55 6 6 1 22 0 8 6 5 62 5 1 21 29 7 5 5 61 12 20 28 6 52 60 11 19 27 5 51 59 2 10 18 26 2 50 58 1 9 17 25 1 9 57 For a box τ, let L (nei) τ denote its neighbors, and L (far) τ denote the remaining boxes. The box τ = 21 is marked with red. L (nei) 21 = {12, 1, 1, 20, 22, 28, 29, 0} are the blue boxes. L (far) 21 = are the green boxes.

Let J τ denote an index vector marking which particles belong to τ: j J τ x j is in box τ. Set q τ = q(j τ ) the sources in τ ˆq τ C P +1 the outgoing expansion for τ (the multipole coefficients ) u τ = u(j τ ) the potentials in τ Then q τ A σ,τ u σ C τ ˆq τ Bσ,τ Recall: P is an integer parameter balancing cost versus accuracy: P large high accuracy and high cost

Single-level Barnes-Hut Compute the outgoing expansions on all boxes: loop over all boxes τ ˆq τ = C τ q(j τ ) end loop Evaluate the far field potentials. Each box τ aggregates the contributions from all well-separated boxes: u = 0 loop over all boxes τ loop over all σ L (far) τ (i.e. all σ that are well-separated from τ) u(j τ ) = u(j τ ) + B τ,σ ˆq σ end loop end loop Evaluate the near field interactions: loop over all leaf boxes τ end u(j τ ) = u(j τ ) + A(J τ, J τ ) q(j τ ) + σ L (nei) τ A(J τ, J σ ) q(j σ )

To get the asymptotic cost down further, we need a hierarchical tree structure on the computational domain: Level 0 Level 1 5 1 2 Level 2 Level 11 1 19 21 2 5 51 50 5 52 75 7 77 76 8 82 85 8 10 12 18 20 9 8 1 0 7 6 9 8 71 70 7 72 79 78 81 80 7 9 15 17 27 26 29 28 5 7 6 59 58 61 60 67 66 69 68 6 8 1 16 2 22 25 2 1 0 2 55 5 57 56 6 62 65 6

We are given N locations and seek the potential at each location.

How do you find the potential at the locations marked in blue?

Tessellate the remainder of the domain using as large boxes as you can, with the constraint that the target box has to be well-separated from every box that is used.

Then replace the original charges in each well-separated box by the corresponding multipole expansion. The work required to evaluate one potential is now O(log N).

Cost of the multi-level Barnes-Hut algorithm: Suppose there are L levels in the tree, and that there are about N box particles in each box so that L log (N/N box ). We let N box is a fixed number (say N box 200) so L log(n). Observation: On each level, there are at most 27 well-separated boxes. For each particle x i, we need to do the following: Step 1: Evaluate the P outgoing moments for the L boxes holding x i : Step 2: Evaluate potentials from out-going expansions: Step : Evaluate potentials from neighbors: L P 27 L P 9 N box Using that P is a smallish constant (say P = 20) we find This is not bad. cost N L N log(n).

Multi-level Barnes-Hut Compute the outgoing expansions on all boxes: loop over all boxes τ on all levels ˆq τ = C τ q(j τ ) end loop For each box τ tessellate Ω into a minimal collection of boxes from which τ is well-separated, and evaluate the far-field potential: u = 0 loop over all boxes τ loop over all σ L (BH) τ (i.e. all σ that are well-separated from τ) u(j τ ) = u(j τ ) + B τ,σ ˆq σ end loop end loop Evaluate the near field interactions: loop over all leaf boxes τ end u(j τ ) = u(j τ ) + A(J τ, J τ ) q(j τ ) + σ L (nei) τ A(J τ, J σ ) q(j σ )

In the Barnes-Hut method, there is a need to construct for each box τ, the list L (BH) τ which identifies a minimal tessellation of Ω into boxes from which τ is well-separated. Example: The box τ is marked with blue. L (BH) τ = {???}

How do you find the tessellation?

2 2 2 2 2 2 2 2 2 2 How do you find the tessellation? Hint: Consider which level each box belongs to.

2 2 2 2 2 2 2 2 2 2 Level Level Level 2

Definition: For a box τ, define its interaction list L (int) τ 1. σ and τ populate the same level of the tree. 2. σ and τ are well-separated.. The parents of σ and τ touch. as the set of all boxes σ such that:

Example: Consider box τ = 10. 10

Example: Consider box τ = 10. 10 The green boxes are the neighbors of τ s parents.

Example: Consider box τ = 10. 10 The green boxes are the children of the neighbors of τ s parents.

Example: Consider box τ = 10. 19 21 10 18 20 15 17 6 8 1 16 The green boxes are the children of the neighbors of τ s parents. Only some of them are well-separated from τ. We find: L (int) τ = {6, 8, 1, 15, 16, 17, 18, 19, 20, 21}

Example: Consider box τ = 0. 0

Example: Consider box τ = 0. 0 The green boxes are the neighbors of τ s parents.

Example: Consider box τ = 0. 0 The green boxes are the children of the neighbors of τ s parents.

Example: Consider box τ = 0. 5 51 5 2 50 52 9 0 8 7 26 28 6 The green boxes are the children of the neighbors of τ s parents. Only some of them are well-separated from τ. We find: L (int) τ = {26, 28,, 6, 7, 2,,, 5, 8, 9, 50, 51, 52, 5}

Example: Consider box τ = 161. 161

Example: Consider box τ = 161. 161 The green boxes are the neighbors of τ s parents.

Example: Consider box τ = 161. 161 The green boxes are the children of the neighbors of τ s parents.

Example: Consider box τ = 161. 155 157 16 165 187 189 15 156 188 151 15 161 185 150 152 18 107 109 115 117 19 11 106 108 11 116 18 10 The green boxes are the children of the neighbors of τ s parents. Only some of them are well-separated from τ. We find: L (int) τ = {106, 107, 108, 109, 11, 115, 116, 117, 18, 19, 10, 11, 18, 185, 187, 188, 189, 150, 151, 152, 15, 15, 155, 156, 157, 16, 165}

Now let L (anc) τ great-grand-parent, etc.). Then denote the list of all ancestors (parent, grand-parent, L (BH) τ = L (int) τ σ L (anc) τ L (int) σ

5 51 5 19 21 2 50 52 155 15 151 150 157 16 165 187 156 15 161 152 189 188 185 18 9 8 18 20 107 106 109 108 115 11 117 116 19 18 11 10 7 15 17 26 28 6 6 8 1 16

2 5 51 50 5 52 19 21 161 0 9 8 10 18 20 7 26 28 6 15 17 6 8 1 16 L (anc) 161 = {, 10, 0} L (BH) 161 = L (int) L (int) 10 L (int) 0 L (int) 161 = {6, 8, 1, 15, 16, 17, 18, 19, 20, 21, 26, 28,, 6, 7, 2,,, 5, 8, 9, 50, 51, 52, 5, 106, 107, 108, 109, 11, 115, 116, 117, 18, 19, 10, 11, 150, 151, 152, 15, 15, 155, 156, 157, 16, 165, 18, 185, 187, 188, 189}