Skip to content

Conversation

@svchb
Copy link
Collaborator

@svchb svchb commented Sep 4, 2025

In my quick testing this didn't show the claimed accuracy improvement vs Wendland and Quintic.

@codecov
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 57.14286% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.88%. Comparing base (d193c71) to head (f800e03).
⚠️ Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
src/general/smoothing_kernels.jl 57.14% 9 Missing ⚠️
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     
Flag Coverage Δ
unit 65.88% <57.14%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@svchb svchb self-assigned this Sep 4, 2025
@svchb svchb added the enhancement New feature or request label Sep 4, 2025
@svchb
Copy link
Collaborator Author

svchb commented Sep 4, 2025

The normal smoothing kernel test that we have doesn't work here since the truncation error is too large.

@efaulhaber
Copy link
Member

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?

@efaulhaber efaulhaber closed this Sep 26, 2025
@efaulhaber efaulhaber reopened this Sep 26, 2025
@svchb
Copy link
Collaborator Author

svchb commented Sep 26, 2025

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.

@svchb svchb requested a review from efaulhaber September 29, 2025 13:08
Comment on lines +40 to +41
Poly6Kernel,
LaguerreGaussKernel
Copy link
Member

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?

Comment on lines +743 to +745
# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why not write it like in the comment? This is easier to read and avoids the division by h^3.
  2. erf is expensive:
    julia> @b erf(2)
    19.637 ns
Suggested change
# 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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.

Comment on lines +714 to +720
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please avoid branching
  2. Please use q like in all other kernels.
Suggested change
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`):
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants