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

General dimensional refinement #354

Merged
merged 5 commits into from
Dec 13, 2023
Merged

Conversation

hyrodium
Copy link
Owner

No description provided.

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Attention: 41 lines in your changes are missing coverage. Please review.

Comparison is base (b405724) 96.27% compared to head (1371c1c) 93.60%.

Files Patch % Lines
src/_Refinement.jl 56.38% 41 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
- Coverage   96.27%   93.60%   -2.67%     
==========================================
  Files          14       14              
  Lines        1583     1642      +59     
==========================================
+ Hits         1524     1537      +13     
- Misses         59      105      +46     

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

@hyrodium
Copy link
Owner Author

Performance improvements in this PR! 🚀

Before this PR

julia> using BasicBSpline, BenchmarkTools

julia> P1 = BSplineSpace{2}(knotvector"1112121113")
BSplineSpace{2, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 10, 10]))

julia> P2 = BSplineSpace{1}(knotvector"11111 12")
BSplineSpace{1, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 4, 5, 7, 8, 8]))

julia> P1′ = expandspace_I(P1, Val(1))
BSplineSpace{3, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10]))

julia> P2′ = expandspace_I(P2, Val(1))
BSplineSpace{2, Int64, KnotVector{Int64}}(KnotVector([1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 7, 8, 8, 8]))

julia> n1 = dim(P1)
11

julia> n2 = dim(P2)
6

julia> a = rand(n1, n2);

julia> M = BSplineManifold(a, P1, P2);

julia> @benchmark refinement(M, (P1, P2))
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
 Range (min  max):  42.751 μs   2.508 ms  ┊ GC (min  max): 0.00%  95.87%
 Time  (median):     44.344 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   45.398 μs ± 34.695 μs  ┊ GC (mean ± σ):  1.06% ±  1.36%

    ▁▂▄▄▇██▆▄▁                                                 
  ▂▅██████████▇▇▆▅▅▅▄▄▄▄▄▄▃▃▃▃▃▂▂▂▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▃
  42.8 μs         Histogram: frequency by time        52.7 μs <

 Memory estimate: 8.47 KiB, allocs estimate: 87.

After this PR

julia> using BasicBSpline, BenchmarkTools

julia> P1 = BSplineSpace{2}(knotvector"1112121113")
BSplineSpace{2, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 10, 10]))

julia> P2 = BSplineSpace{1}(knotvector"11111 12")
BSplineSpace{1, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 4, 5, 7, 8, 8]))

julia> P1′ = expandspace_I(P1, Val(1))
BSplineSpace{3, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10]))

julia> P2′ = expandspace_I(P2, Val(1))
BSplineSpace{2, Int64, KnotVector{Int64}}(KnotVector([1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 7, 8, 8, 8]))

julia> n1 = dim(P1)
11

julia> n2 = dim(P2)
6

julia> a = rand(n1, n2);

julia> M = BSplineManifold(a, P1, P2);

julia> @benchmark refinement_I(M, (P1, P2))
BenchmarkTools.Trial: 10000 samples with 5 evaluations.
 Range (min  max):  6.582 μs  536.418 μs  ┊ GC (min  max): 0.00%  96.21%
 Time  (median):     7.013 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   7.704 μs ±  15.731 μs  ┊ GC (mean ± σ):  5.97% ±  2.89%

   ▁▄▆▇███▇▆▆▄▃▂                ▁▁ ▁▁▁▁▁▁▁▁▁▁▁                ▂
  ▅████████████████▇██▇▇▇▇▇▇▇▇▇██████████████████▆▇▆▇▇▆▆▆▅▅▅▆ █
  6.58 μs      Histogram: log(frequency) by time      10.1 μs <

 Memory estimate: 8.86 KiB, allocs estimate: 89.

@hyrodium
Copy link
Owner Author

Okay, let's merge this for now. Here's a TODO list after fixing #353.

  • Add more test cases
  • Fix type inference
  • Check performance
  • Remove Base.promote_op use

@hyrodium hyrodium merged commit ae5ba38 into main Dec 13, 2023
11 of 13 checks passed
@hyrodium hyrodium mentioned this pull request Dec 16, 2023
@hyrodium hyrodium deleted the feature/general_dimensions_refinement branch December 17, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant