# exafmm

committed 4af5452

merge

# include/kernel.h

`     real fact = 1;                                              // Initialize 2 * m + 1`
`     real pn = 1;                                                // Initialize Legendre polynomial Pn`
`     real rhom = 1.0 / rho;                                      // Initialize rho^(-m-1)`
`-    for( int m=0; m!=2*P; ++m ) {                               // Loop over m in Ynm`
`+    for( int m=0; m!=P; ++m ) {                                 // Loop over m in Ynm`
`       complex eim = std::exp(I * real(m * beta));               //  exp(i * m * beta)`
`       real p = pn;                                              //  Associated Legendre polynomial Pnm`
`       int npn = m * m + 2 * m;                                  //  Index of Ynm for m > 0`
`       YnmTheta[npn] = rhom * (p - (m + 1) * x * p1) / y * prefactor[npn] * eim;// theta derivative of r^n * Ynm`
`       rhom /= rho;                                              //  rho^(-m-1)`
`       real rhon = rhom;                                         //  rho^(-n-1)`
`-      for( int n=m+1; n!=2*P; ++n ) {                           //  Loop over n in Ynm`
`+      for( int n=m+1; n!=P; ++n ) {                             //  Loop over n in Ynm`
`         int npm = n * n + n + m;                                //   Index of Ynm for m > 0`
`         int nmm = n * n + n - m;                                //   Index of Ynm for m < 0`
`         Ynm[npm] = rhon * p * prefactor[npm] * eim;             //   rho^n * Ynm for m > 0`
`   void preCalculation() {`
`     const complex I(0.,1.);                                     // Imaginary unit`
`     factorial = new real  [P];                                  // Factorial`
`-    prefactor = new real  [4*P*P];                              // sqrt( (n - |m|)! / (n + |m|)! )`
`-    Anm       = new real  [4*P*P];                              // (-1)^n / sqrt( (n + m)! / (n - m)! )`
`+    prefactor = new real  [P*P];                                // sqrt( (n - |m|)! / (n + |m|)! )`
`+    Anm       = new real  [P*P];                                // (-1)^n / sqrt( (n + m)! / (n - m)! )`
`     Cnm       = new complex [P*P*P*P];                          // M2L translation matrix Cjknm`
` `
`     factorial[0] = 1;                                           // Initialize factorial`
`       factorial[n] = factorial[n-1] * n;                        //  n!`
`     }                                                           // End loop to P`
` `
`-    for( int n=0; n!=2*P; ++n ) {                               // Loop over n in Anm`
`+    for( int n=0; n!=P; ++n ) {                                 // Loop over n in Anm`
`       for( int m=-n; m<=n; ++m ) {                              //  Loop over m in Anm`
`         int nm = n*n+n+m;                                       //   Index of Anm`
`         int nabsm = abs(m);                                     //   |m|`

# kernel/CPUSphericalLaplace.cxx

` template<>`
` void Kernel<Laplace>::P2M(C_iter Cj) {`
`   real Rmax = 0;`
`-  complex Ynm[4*P*P], YnmTheta[4*P*P];`
`-  for( B_iter B=Cj->LEAF; B!=Cj->LEAF+Cj->NDLEAF; ++B ) {`
`+  complex Ynm[P*P], YnmTheta[P*P];`
`+  for( B_iter B=Cj->LEAF; B!=Cj->LEAF+Cj->NCLEAF; ++B ) {`
`     vect dist = B->X - Cj->X;`
`     real R = std::sqrt(norm(dist));`
`     if( R > Rmax ) Rmax = R;`
` template<>`
` void Kernel<Laplace>::M2M(C_iter Ci) {`
`   const complex I(0.,1.);`
`-  complex Ynm[4*P*P], YnmTheta[4*P*P];`
`+  complex Ynm[P*P], YnmTheta[P*P];`
`   real Rmax = Ci->RMAX;`
`   for( C_iter Cj=Cj0+Ci->CHILD; Cj!=Cj0+Ci->CHILD+Ci->NCHILD; ++Cj ) {`
`     vect dist = Ci->X - Cj->X;`
` `
` template<>`
` void Kernel<Laplace>::M2L(C_iter Ci, C_iter Cj) const {`
`-  complex Ynm[4*P*P], YnmTheta[4*P*P];`
`+  complex Ynm[P*P], YnmTheta[P*P];`
`   vect dist = Ci->X - Cj->X - Xperiodic;`
`   real rho, alpha, beta;`
`   cart2sph(rho,alpha,beta,dist);`
`       int jk = j * j + j + k;`
`       int jks = j * (j + 1) / 2 + k;`
`       complex L = 0;`
`-      for( int n=0; n!=P; ++n ) {`
`+      for( int n=0; n!=P-j; ++n ) {`
`         for( int m=-n; m<0; ++m ) {`
`           int nm   = n * n + n + m;`
`           int nms  = n * (n + 1) / 2 - m;`
` template<>`
` void Kernel<Laplace>::M2P(C_iter Ci, C_iter Cj) const {`
`   const complex I(0.,1.);                                       // Imaginary unit`
`-  complex Ynm[4*P*P], YnmTheta[4*P*P];`
`+  complex Ynm[P*P], YnmTheta[P*P];`
`   for( B_iter B=Ci->LEAF; B!=Ci->LEAF+Ci->NDLEAF; ++B ) {`
`     vect dist = B->X - Cj->X - Xperiodic;`
`     vect spherical = 0;`
` template<>`
` void Kernel<Laplace>::L2P(C_iter Ci) const {`
`   const complex I(0.,1.);                                       // Imaginary unit`
`-  complex Ynm[4*P*P], YnmTheta[4*P*P];`
`-  for( B_iter B=Ci->LEAF; B!=Ci->LEAF+Ci->NDLEAF; ++B ) {`
`+  complex Ynm[P*P], YnmTheta[P*P];`
`+  for( B_iter B=Ci->LEAF; B!=Ci->LEAF+Ci->NCLEAF; ++B ) {`
`     vect dist = B->X - Ci->X;`
`     vect spherical = 0;`
`     vect cartesian = 0;`
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.