ruoxi-wang / BBFMM3D

Other
23 stars 13 forks source link

The values of kernel K in BBFM3D differs from that in MATLAB #4

Closed vktsn0303 closed 6 years ago

vktsn0303 commented 6 years ago

Hello Ruoxi Wang,

I've been trying to use the BBFMM3D code in C++ and I have been trying to validate it using a simple code written in MATLAB to calculate the same 1./r kernel. At line number 679 of compute.hpp I have written a cout statement to be able to see what the values are in the kernel (cout << *Kij << endl;). It is oberved that the values of K from the BBFMM3D code are completely different from the one obtained in MATLAB. However, the final result of K*q is approximately correct. I would just like to know if I'm accessing Kij in the cout statement correctly or if the actual value of K is calculated somewhere else in the code. Can you please help me understand this?

Many thanks, vktsn0303

ruoxi-wang commented 6 years ago

Hi,

The BBFMM3D code does not form the entire matrix explicitly, otherwise, it will fall back to an O(n^2) method. Instead, it factorizes the matrix in a hierarchical fashion and returns an operator that can be applied to a vector in O(n) complexity. You can refer to the paper titled "The black-box fast multipole method" for detailed information. The code in line 679 used the variable name Kij but it is not the exact entry in your matrix. If you want to see what the approximated matrix is like, you can apply the operator to an identity matrix.

I hope this helps.

On Tue, Apr 3, 2018 at 7:15 AM, vktsn0303 notifications@github.com wrote:

Hello Ruoxi Wang,

I've been trying to use the BBFMM3D code in C++ and I have been trying to validate it using a simple code written in MATLAB to calculate the same 1./r kernel. At line number 679 of compute.hpp I have written a cout statement to be able to see what the values are in the kernel (cout << Kij << endl;). It is oberved that the values of K from the BBFMM3D code are completely different from the one obtained in MATLAB. However, the final result of Kq is approximately correct. I would just like to know if I'm accessing Kij in the cout statement correctly or if the actual value of K is calculated somewhere else in the code. Can you please help me understand this?

Many thanks, vktsn0303

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ruoxi-wang/BBFMM3D/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AE18-BrzLipNPrEqJKC2wPpHCX0x84RQks5tk4P3gaJpZM4TFKFN .

vktsn0303 commented 6 years ago

Hi,

Thank you very much for that explanation. I can see what you mean.

vktsn0303