-
Notifications
You must be signed in to change notification settings - Fork 15
Add LaguerreGaussKernel #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #893 +/- ##
==========================================
- Coverage 65.94% 65.88% -0.06%
==========================================
Files 113 113
Lines 7852 7880 +28
==========================================
+ Hits 5178 5192 +14
- Misses 2674 2688 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The normal smoothing kernel test that we have doesn't work here since the truncation error is too large. |
The Gauss kernel is also truncated. Why can't you run the same tests for this kernel? |
I can but the errors seem to be unreasonable because they are larger than 1. |
| Poly6Kernel, | ||
| LaguerreGaussKernel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the other tests?
| # C' = 1 / (4 * pi * h^3 * integral) | ||
| # integral = (7 * sqrt(pi) / 32) * erf(2) - (77 / 24) * exp(-4) | ||
| return (1 / (4 * pi * ((7 * sqrt(pi) / 32) * erf(2) - (77 / 24) * exp(-4)))) / h^3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Why not write it like in the comment? This is easier to read and avoids the division by
h^3. erfis expensive:julia> @b erf(2) 19.637 ns
| # C' = 1 / (4 * pi * h^3 * integral) | |
| # integral = (7 * sqrt(pi) / 32) * erf(2) - (77 / 24) * exp(-4) | |
| return (1 / (4 * pi * ((7 * sqrt(pi) / 32) * erf(2) - (77 / 24) * exp(-4)))) / h^3 | |
| erf2 = 0.9953223f0 | |
| sqrt_pi = sqrt(oftype(h, pi)) | |
| integral = (7 * sqrt_pi / 32) * erf2 - 77 * exp(-4) / 24 | |
| return 1 / (pi * h^3 * 4 * integral) |
Same with the other normalization factors.
| return ifelse(s < 2, val, zero(val)) | ||
| end | ||
|
|
||
| @muladd @inline function kernel_deriv(kernel::LaguerreGaussKernel, r::Real, h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @muladd @inline function kernel_deriv(kernel::LaguerreGaussKernel, r::Real, h) | |
| @inline function kernel_deriv(kernel::LaguerreGaussKernel, r::Real, h) |
There is no muladd used anywhere in this function. Same for the one above.
| s = r * invh | ||
| if s >= 2 | ||
| return zero(s) | ||
| end | ||
| # dg/ds = (s/3)*(-s^4 + 5s^2 - 9) * exp(-s^2) | ||
| poly = ((-s^2 + 5) * s^2 - 9) * (s / 3) | ||
| return normalization_factor(kernel, h) * exp(-s^2) * poly * invh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please avoid branching
- Please use
qlike in all other kernels.
| s = r * invh | |
| if s >= 2 | |
| return zero(s) | |
| end | |
| # dg/ds = (s/3)*(-s^4 + 5s^2 - 9) * exp(-s^2) | |
| poly = ((-s^2 + 5) * s^2 - 9) * (s / 3) | |
| return normalization_factor(kernel, h) * exp(-s^2) * poly * invh | |
| q = r * invh | |
| # dg/dq = (q/3)*(-q^4 + 5q^2 - 9) * exp(-q^2) | |
| poly = ((-q^2 + 5) * q^2 - 9) * (q / 3) | |
| return ifelse(q < 2, normalization_factor(kernel, h) * exp(-q^2) * poly * invh, zero(q) |
| Truncated Laguerre–Gauss kernel (fourth-order smoothing) as defined in | ||
| [Wang2024](@cite). Its radial form uses | ||
| `s = r/h` and is truncated at `s = 2` (compact support `2h`): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the equation below and use math here instead of code.
| with normalization constants | ||
| α₁ = 8/(5√π), α₂ = 3/π, α₃ = 8/π^{3/2}. | ||
| Recommended practical choice from the paper: use h ≈ 1.3Δx and the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Recommended practical choice from the paper: use h ≈ 1.3Δx and the same | |
| Recommended practical choice from the paper: use ``h \approx 1.3Δx`` and the same |
|
|
||
| Any Kernel with a stability rating of more than '+++' doesn't suffer from pairing-instability. | ||
|
|
||
| ```julia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be a doctest to generate a plot?
|
|
||
| [default.extend-words] | ||
| ba = "ba" | ||
| Comput = "Comput" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
In my quick testing this didn't show the claimed accuracy improvement vs Wendland and Quintic.