Summation of certain locally bilinear forms and its applications to the Fast Multipole Method
Abstract
The Fast Multipole Method (FMM) reduces the computation of pairwise two-body interactions among -particles to order , whose computation cost should be of order by brute force. However, its implementation is somewhat complicated and requires a considerable amount of time to write the code.
In this paper, I show a method that enables us to implement and write FMM algorithm code simply and briefly. FMM algorithm is composed of several steps. The main steps are Upward Pass and Downward Pass. Both the Upward Pass and Downward Pass include shift processes by which we move the centers of local expansions and multipole expansions. In this paper, I show a method that enables us to get rid of these processes.
As a result of this simplification, the coding of FMM becomes much easier, and we can save considerable computation time. I compared the accuracy and time required to calculate potential fields with that of the existing FMM code.
Keywords:Fast Multipole Method, Parallel computation
1 Introduction
The fast multipole algorithm developed by Greengard and Rokhlin [1] enables us to calculate -particles interaction of particles such as gravitational or electrostatic forces with operations with predictable error bounds and considered as one of the top 10 algorithms of the 20th century [2]. Thus, a large amount of papers were published relating to this theory (such as [3]-[7]). The interaction is divided into two parts; near interaction and the rest (not near) interaction. The near interaction part is the interaction of particles each two of which are within a given distance (or within some boxes). This is calculated directly with operations. The rest part is calculated by the FMM also with operations. Thanks to the FMM algorithm, we can perform large-scale simulation ([8]). However, its implementation is not necessarily easy and the time needed to perform simulation is not necessarily short. In [8], we spent about half the computation time for the computation of forces, even though we employed FMM. Therefore, I propose a less time-consuming and easier to implement FMM in this paper.
2 Theory
2.1 Greengardβs Fast Multipole Method
In the following, I describe a two-dimensional case, which is simpler than three-dimensional cases but would be sufficient to understand more general cases intuitively. Unlike Greengardβs FMM, our method for two-dimensional cases can be applied to three dimensional cases straightforwardly. We use the following notation:
-
I.
βThe (computation) boxβ is a (two-dimensional) square with sides of length five. We say the box is at level-zero. The size of the square can be chosen arbitrarily, but I set it five for convenience.
-
II.
The box contains -charged particles.
-
III.
The box is composed of four same-size regular squares, and we call them level-one squares. Here, the βfourβ is because we are dealing with a two-dimensional case for simplicity. For a three-dimensional case, it should be βnineβ.
-
IV.
Each level-one square is composed of four same squares, and we say the squares are at level-two. We repeat this procedure up to a given level . If a square is at level , we write as to indicate its level if necessary. is the computation box (Fig.1).
Figure 1: Squares at level 0, 1, 2. -
V.
For with , there is a list of squares around called βinteraction listβ (see Fig.2,[1]). If is on the interaction list of , we denote . We call same-sized squares well-separated if the distance between the squares is length of the sides of them.

The method I describe in this paper (and Greengardβs method as well) is not restricted to cases where computation boxes are regular squares, nor two-dimensional. We can apply our method to three-dimensional cases. However, for the sake of depicting figures, I restrict myself to two-dimensional cases. The method I describe here for two-dimensional cases can be straightforwardly applied to higher-dimensional cases.
Now, we recall some basic steps composing the Greengardβs FMM briefly and then compare the steps of our
method with that. For details, please refer to [1].
FMM is composed of the following steps:
Upward Pass:
-
U-1
Form multipole expansions of the potential field due to charged particles in each finest level square about the square center using spherical harmonics (associated Legendre functions).
-
U-2
Form multipole expansions about the centers of all squares at all coarser levels. This step is done by shifting the multipole expansions at level to the center of squares containing . Then add the four resulting multipole expansions to obtain . Repeating this from to , we obtain all βs. The βshiftβ is a translation of associated Legendre functions.
Downward Pass:
-
D-1
Form a local expansion about the center of each square at each level .
This is done by first converting multipole expansions for squares to a local expansion about the center of . We denote this by
Then, adding these multipole expansions , we obtain :
-
D-2
Form a local expansion and compute interactions at the finest level .
Let for the square at level 0. We shift the center of local expansion of level to the centers of , , , in , where they are at level (now, we have made four local expansions). Then, we define by adding these local expansions to . Repeating this procedure inductively, we obtain local expansions at the finest level .
Evaluate:
-
E-1
For each charge evaluate the potential (or force) due to not near (not contained in nor adjacent eight squares ) particles.
-
E-2
Compute potential due to charges not contained in E-1 directly and add it to the results of E-1.
2.2 Our Method
As mentioned above, the Greengardβs Fast Multipole Method first evaluates the total action of charged particles in a square toward a charged particle in another same-sized square in its interaction list, and sums up the total actions in a specific way so that the order of the calculation to be N. Greengardβs FMM represented this total action using spherical harmonics. In our method, we represent total actions of charges in a square by charges fixed in position in the square .
We first describe our method in some general manner as βsummation of locally bilinear formsβ, and apply it to the computation of the potential of charges.
2.2.1 Locally bilinear forms
I describe here some results on βsummation of locally bilinear formsβ.
We assume that there are points in the computation box . Each of these point is tagged to a different vector in a -dimensional vector space . We denote this relation by . If and , we write as by abuse of language. always holds. We will define the map explicitly for charges in two dimensional space later, where the image of is determined by combining positions and electric charges of .
We also assume that there are bilinear forms for . They are bilinear with respect to vectors , , however, the bilinear forms have specific meanings only for and and vectors spanned by them (spanned by vectors in each square). In this sense, we call them locally bilinear forms.
Then, we compute the summation of the locally bilinear forms for by
Note that is not defined for near (i.e., in the inside of adjacent or same square of ), we understand as in this case. We can compute interactions of well-separated particles (i.e., interaction between points in well-separated squares) using later.
The main result of this paper
is that we can compute the function in a computation without βshiftβ procedure.
To show that the computation above is , we proceed as follows:
Upward Pass:
-
-1
Form vectors for all by , where are squares at level (the finest level).
-
-2
Form vectors from finest squares to coarser squares inductively by
Downward Pass:
-
-1
We form locally linear forms for each square at each level . For a square , we add for squares , and denote the resulting bilinear form by :
-
-2
Compute interactions at the finest level . Let for the square at level 0. We add the linear forms of level to βs (), where ,,, are the (level ) four squares in . We denote the resulting linear forms by . Repeating this procedure inductively, we obtain the linear forms at the finest level .
For (a finest level square), put .
This is the same as previously defined .
Each of these additions (appeared in -1 and -2) is essentially
addition of -dimensional dual vectors.
The reason why this method is is almost the same as
Greengardβs FMM.
2.2.2 Applications to FMM
To apply the results obtained above, we proceed as follows. For details, see the appendix.
-
I.
First, we fix a one-to-one correspondence between a charged particle and
-
II.
Second, we construct bilinear forms such that a interaction (such as Coulomb interaction) between and is equal to within a predictable error bound, where and . In the following, an βerror is predictableβ means that the value error is bounded where is the distance between the squares and we know the exponent . becomes large if we increase the dimension . The error would be estimated more specifically, but we do not pursue this issue.
-
III.
Lastly, we compute the interaction from nearby particles (which are not well-separated) directly.
Note: The map
does not depend on the choice of squares containing a charge , i.e.,
if and (here the level of and should be different),
the image of the map is the same.
Because of this fact, we can get rid of βshiftββs in Upward Pass and Downward Pass.
3 Results
I have prepared a Fortran program by modifying existing FMM program developed by Prof. Shuji Ogata (FMMP[9]) to test execution time and accuracy. In the computation, I fixed positions in each cube precisely the same as Fig.2 in the appendix (The lengths of the sides are five. We are now dealing with three-dimensional cases, so I use a cube instead of a box). The computations were performed in double precision, compiled with Intel Fortran compiler version 19.1, the CPU used is Core i7-9700.
Here, in this section, we compare the computation timings and accuracies of our program with that of FMMP. In FMMP, the maximum order of multipoles is set to five except for a test case shown in the last row in Table 2 which is added to see how the maximum order of multipoles influences the results. Our method can be applied to parallel computing as with Prof. Ogataβs FMMP. However, I have coded for one node this time.
In the following tests, I scattered charges randomly in a cubic box. The charges are or .
number of particles=80000, and maximum level =3
[h]
program
t_up
1
t_down
2
t_pfs
3
total (sec)
accuracy4
FMMP
9.1
1.4
2.9
program based on our method
2.2
8.5
9.0
-
1
time for upward pass
-
2
time for downward pass
-
3
time for computing potential field and force field
-
4
averaged values of the relative errors (average of )
program | t_up |
t_down |
t_pfs |
total (sec) | accuracy |
---|---|---|---|---|---|
FMMP | 9.4 | 1.7 | 7.3 | ||
program based on our method | 2.3 | 9.1 | 2.3 | ||
FMMP(maximum order | |||||
of multipoles is four) | 5.3 | 8.1 | 5.6 |
program | t_up |
t_down |
t_pfs |
total (sec) | accuracy |
---|---|---|---|---|---|
FMMP | 1.9 | 9.7 | 2.9 | ||
program based on our method | 7.8 | 6.4 | 8.0 |
4 Discussions
(1) We first replaced spherical harmonics by charges fixed in position using
Lagrange interpolation.
However, there may be other interpolation suitable for FMM.
Such a method had been
already invented by William Fong and Eric Darve [3]. They used Chebyshev polynomials
to interpolate.
Their accuracies seem to be better than ours. However, since I have already coded my program
before I knew
their results and this paper aims to introduce a method that can remove βshiftβ in FMM,
I left as it was.
It seems likely that the method introduced in this paper can be applied to Chebyshev polynomials.
(2) It takes time to compute the bilinear forms . However, since it does not depend
on and , we can compute and store the bilinear forms in the memory in advance.
It requires only once, so I ignored the time required to compute the bilinear forms.
For the case of FMMP, some computation may be done in advance and
shorten the computation time.
(3) The bilinear forms are essentially matrices. The computations to obtain
the matrices go through computation with large numbers and end up with relatively small number entries.
Thus, the computation of should not be done in a single precision.
(4) As shown in the tables in the previous section, we could save computation time substantially (about half).
However, the accuracy of our method is slightly worse than that obtained by the FMMP program.
It may become more accurate if we increase the dimension of or
employ the method of William Fong and Eric Darve [3].
We find that if we set the maximum order of multipoles equal to four in FMM, the accuracy
becomes considerably worse (), but not so fast.
(5) Since the array data is very large, the time required to access memory
storing the array is a crucial factor to determine computation time.
If we find a good way to manage the memory, it is probable that the
computation time would become less.
Appendix A Appendix
In this appendix, I will give a construction of the bilinear forms introduced in in more detail in the following steps. I also provide here descriptions for and in . We assume that the dimension of is equal to 16 for the sake of description. We denote by a function determined by charges and such as Coulomb potential. We also write if is within a predictable error.
-
STEP1
We define 16 (=) positions in each square at every level (Fig.3).
-
STEP2
Let a charge with . We define a map from to 16 point-charges on the fixed 16 positions in . For this map is the map introduced in . The map has the following property (for detail, see A.2.2): If charges and with and and are well-separated, then
where ={, ()}. By assigning the electric charges of the 16 point charges to the coordinate of 16 dimensional vector space, the image of the map can be regarded as a column vector in a 16-dimensional space. We also denote this column vector by . We identify the vector space with the values of the 16 point-charges in .
-
STEP3
We define a bilinear form for and by
where and , ={, ()}, and ={, ()}.
-
STEP4
By the STEP2 above, we can map a charge to 16 point charges . Let be the 16 point charges of arranged as in Fig.3. We assume , where denote the electric charge of . We can transform each of the 16 point charges in to the 16 point charges in by . Then, we define a matrix by
transforms the 16 charges of to the 16 charges in .
-
STEP5
We define bilinear forms by
Writing with a suitable matrix , the matrix for is
where denotes its transpose.
In the following, I describe the steps above in more detail.
A.1 STEP1
We fix 16 points as illustrated in Fig.3. The number of points should be and for 2-dimensional case and 3-dimensional case, respectively.

A.2 STEP2
A.2.1 Lagrange interpolation
For any polynomial with , we have
(1) |
for arbitrarily chosen distinct -numbers {}, where .
If or is a power series, . Thus potential field is approximated with a predictable error.
A.2.2 Approximation of a charge by charges fixed in position
Let us assume that a charged particle is located at a point . We represent the field of charge due to this particle at point by four charges located at by applying the results above. Let be a function determined by charges and . For instance, where denote the electric charge of the point charge .
Let be points shown in Fig.4, can be written as
(2) |
where is the function defined in the previous section for and , and is the coordinate of the point as depicted in the figure. Putting , , and as ={, ()} described in STEP2, we get the relation .

References
- [1] Leslie F. Greengard, The Rapid Evaluation of Potential Fields in Particle Systems, The MIT Press, Cambridge, Massachusetts, 1988
- [2] The Best of the 20th Century: Editors Name Top 10 Algorithms, SIAM News, 33, 1 (2000)
- [3] William Fong, Eric Darve, The black-box fast multipole method, J. Comp. Phys. 228, 8712-8725 (2009)
- [4] Board, J. and Schulten, K. ,The fast multipole algorithm, Comput. Sci. Eng. 2, 76-79 (2000)
- [5] C.A. White and M. Head-Gordon, Derivation and efficient implementation of the fast multipole method, J. Chem. Phys., 101, 6593-6605 (1994)
- [6] H. Fujiwara, The fast multipole method for solving integral equations of three-dimensional topography and basin problems, Geophys. Int. J.,140, 198-210 (2000)
- [7] T. Hrycak and V. Rokhlin, An improved fast multipole algorithm for potential fields,SIAM J. Sci. Comput., 19, 1804-1826 (1998)
- [8] Y. Kajima, S. Ogata, R. Kobayashi, M. Hiyama, and T. Tamura, Fluctuating Local Recrystallization of Quasi-Liquid Layer of Sub-Micrometer-Scale Ice: A Molecular Dynamics Study, J. Phys. Soc. Jpn. 83, 83601 (2014)
- [9] Shuji Ogata, Timothy J. Campbell, Rajiv K. Kalia, Aiichiro Nakano, Priya Vashishta, and Satyavani Vemparala, Scalable and portable implementation of the fast multipole method on parallel computers, Comp. Phys. Comm., 153, 445-461 (2003)