Skip to content
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

Add more analytical unit tests #166

Merged
merged 9 commits into from
Jan 18, 2025
Merged

Add more analytical unit tests #166

merged 9 commits into from
Jan 18, 2025

Conversation

mikeingold
Copy link
Collaborator

@mikeingold mikeingold commented Jan 17, 2025

More progress toward #67

  • Ellipsoid
  • Hexahedron
  • Tetrahedron
  • Torus
  • Triangle

test/combinations.jl Outdated Show resolved Hide resolved
test/combinations.jl Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (7818474) to head (32ddbcb).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #166   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines          181       181           
=========================================
  Hits           181       181           

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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

github-actions bot commented Jan 17, 2025

Benchmark Results

main 32ddbcb... main/32ddbcb330eb19...
Differentials/Differential 0.202 ± 0.0011 μs 0.205 ± 0.002 μs 0.985
Differentials/Jacobian 0.167 ± 0.001 μs 0.167 ± 0.001 μs 1
Integrals/Segment/Scalar GaussKronrod 0.826 ± 0.0068 μs 0.841 ± 0.0091 μs 0.982
Integrals/Segment/Scalar GaussLegendre 1.64 ± 0.007 μs 1.62 ± 0.009 μs 1.01
Integrals/Segment/Scalar HAdaptiveCubature 1.16 ± 0.13 μs 1.16 ± 0.12 μs 1
Integrals/Segment/Vector GaussKronrod 3.12 ± 0.083 μs 3.03 ± 0.068 μs 1.03
Integrals/Segment/Vector GaussLegendre 19.5 ± 0.73 μs 17.9 ± 0.58 μs 1.09
Integrals/Segment/Vector HAdaptiveCubature 3.9 ± 0.1 μs 3.89 ± 0.1 μs 1
Integrals/Sphere/Scalar GaussKronrod 0.0728 ± 0.0018 ms 0.0728 ± 0.0019 ms 1
Integrals/Sphere/Scalar GaussLegendre 1.82 ± 0.0025 ms 1.82 ± 0.0031 ms 0.997
Integrals/Sphere/Scalar HAdaptiveCubature 0.047 ± 0.00011 ms 0.0471 ± 0.00014 ms 0.997
Integrals/Sphere/Vector GaussKronrod 0.107 ± 0.0016 ms 0.108 ± 0.0016 ms 0.987
Integrals/Sphere/Vector GaussLegendre 3.43 ± 0.074 ms 3.62 ± 0.094 ms 0.948
Integrals/Sphere/Vector HAdaptiveCubature 0.0995 ± 0.0016 ms 0.0982 ± 0.0013 ms 1.01
Rules/GaussLegendre 21.8 ± 0.56 μs 21.7 ± 0.77 μs 1.01
Specializations/Scalar GaussLegendre/BezierCurve 0.25 ± 0.0071 ms 0.251 ± 0.0022 ms 0.999
Specializations/Scalar GaussLegendre/Line 6.95 ± 0.056 μs 7.11 ± 0.064 μs 0.977
Specializations/Scalar GaussLegendre/Plane 0.747 ± 0.0016 ms 0.745 ± 0.002 ms 1
Specializations/Scalar GaussLegendre/Ray 5.97 ± 0.052 μs 6.08 ± 0.055 μs 0.981
Specializations/Scalar GaussLegendre/Rope 0.0508 ± 0.00021 ms 0.0516 ± 0.0003 ms 0.986
Specializations/Scalar GaussLegendre/Tetrahedron 0.158 ± 0.0017 s 0.157 ± 0.0021 s 1
Specializations/Scalar GaussLegendre/Triangle 0.604 ± 0.0075 ms 0.606 ± 0.0074 ms 0.996
time_to_load 1.53 ± 0.0053 s 1.51 ± 0.018 s 1.01

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@mikeingold mikeingold self-assigned this Jan 18, 2025
@mikeingold
Copy link
Collaborator Author

Not sure why Downgrade fails...

@JoshuaLampert
Copy link
Member

Not sure why Downgrade fails...

That's why: https://github.com/JuliaGeometry/MeshIntegrals.jl/actions/runs/12840564494/job/35809354687?pr=166#step:8:477. The necessary diff is also given there. Aqua.jl wants the entries to be ordered alphabetically. This wasn't caught in the previous PR already because we skip CI for changes under docs/.

Copy link
Member

@JoshuaLampert JoshuaLampert left a comment

Choose a reason for hiding this comment

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

LGTM.
Just out of interest: How did you come up with the functions and their solutions? Did you compute the solutions by hand, did you use some symbolic solver or similar, or did you find them in some reference, or something else?

@mikeingold
Copy link
Collaborator Author

Not sure why Downgrade fails...

That's why: https://github.com/JuliaGeometry/MeshIntegrals.jl/actions/runs/12840564494/job/35809354687?pr=166#step:8:477. The necessary diff is also given there. Aqua.jl wants the entries to be ordered alphabetically. This wasn't caught in the previous PR already because we skip CI for changes under docs/.

Oooohhhhh… I guess they’re using the sorting convention that all upper-case letters come before lower-case letters.

@mikeingold
Copy link
Collaborator Author

Just out of interest: How did you come up with the functions and their solutions? Did you compute the solutions by hand, did you use some symbolic solver or similar, or did you find them in some reference, or something else?

Usually I hand-derive integral problems and just choose an integrand function that produces a non-zero solution but is also still pretty reasonable to derive by hand.

The Hexahedron and Ellipsoid solutions here came from the observation that both have degenerate cases, i.e. they can just be turned into a cube and a sphere.

The others in this PR actually came from experimenting with an LLM (GPT 4o) which was surprisingly competent at suggesting test cases with step-by-step derived solutions. I just guided the model a bit and then validated the provided solution by hand.

@JoshuaLampert
Copy link
Member

Just out of interest: How did you come up with the functions and their solutions? Did you compute the solutions by hand, did you use some symbolic solver or similar, or did you find them in some reference, or something else?

Usually I hand-derive integral problems and just choose an integrand function that produces a non-zero solution but is also still pretty reasonable to derive by hand.

The Hexahedron and Ellipsoid solutions here came from the observation that both have degenerate cases, i.e. they can just be turned into a cube and a sphere.

The others in this PR actually came from experimenting with an LLM (GPT 4o) which was surprisingly competent at suggesting test cases with step-by-step derived solutions. I just guided the model a bit and then validated the provided solution by hand.

Sounds good.

@mikeingold mikeingold marked this pull request as ready for review January 18, 2025 18:16
@mikeingold
Copy link
Collaborator Author

Thanks!

@mikeingold mikeingold merged commit f757e63 into main Jan 18, 2025
12 checks passed
@mikeingold mikeingold deleted the tests branch January 18, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants