-
Notifications
You must be signed in to change notification settings - Fork 43
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
Deprecate gausschebyshev
and add gausschebyshevt
, ..., gausschebyshevw
#123
Deprecate gausschebyshev
and add gausschebyshevt
, ..., gausschebyshevw
#123
Conversation
gausschebyshev
and add gausschebyshev1
to gausschebyshev4
gausschebyshev
and add gausschebyshev1
, ..., gausschebyshev4
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #123 +/- ##
==========================================
- Coverage 96.65% 96.62% -0.04%
==========================================
Files 9 9
Lines 1227 1244 +17
==========================================
+ Hits 1186 1202 +16
- Misses 41 42 +1
☔ View full report in Codecov by Sentry. |
I think better names would be Cf |
Thank you for the suggestion! This is not a strong preference, but I thought something like |
How about |
I opened a poll on slack. |
Based on the poll, I have updated the name with @dlfivefifty Do you agree with this naming? |
gausschebyshev
and add gausschebyshev1
, ..., gausschebyshev4
gausschebyshev
and add gausschebyshevT
, ..., gausschebyshevW
Note in ClassicalOrthogonalPolynomials.jl I use Is there any precedence for using capital letters in this way? If not I think we should follow SpecialFunctions.jl. So either |
The difference between
In ideal, it would be nice to have names like |
Or, should we rename all of |
Is there any good reason to deprecate the 2-arg method? Bessel functions in SpecialFunctions have besselj and besselj0 for example. |
My first comment (#123 (comment)) is the reason. And the 2-arg method is not friendly with the static analyzer JET.jl. Before this PR julia> using JET, FastGaussQuadrature
julia> f(n) = gausschebyshev(n, 3)
f (generic function with 1 method)
julia> g(n) = gausschebyshev(n, 5) # typo
g (generic function with 1 method)
julia> @report_opt f(8)
No errors detected
julia> @report_opt g(8) # No error!
No errors detected After this PR julia> using JET, FastGaussQuadrature
julia> f(n) = gausschebyshevV(n)
f (generic function with 1 method)
julia> g(n) = gausschebyshevZ(n) # typo
g (generic function with 1 method)
julia> @report_opt f(8)
No errors detected
julia> @report_opt g(8) # Yay!
═════ 1 possible error found ═════
┌ g(n::Int64) @ Main ./REPL[3]:1
│ runtime dispatch detected: %1::Any(n::Int64)::Any
└──────────────────── The 1-arg method would be compiled lighter than 2-arg version, but this is really a slight advantage.
Both arguments of julia> besselj(3.4, 4.2) # Any numbers are accepted (mathematically)
0.4003115265583054
julia> besselj(0, 4.2)
-0.37655705436756765
julia> besselj0(4.2) # Some special case has its function (maybe, special optimization inside?)
-0.37655705436756765 |
To me, that sounds like you may have a case to add definitions, but why must we throw away the 2-arg version? Kind has a mathematical meaning; it's just that it must be one of the integers 1, 2, 3, or 4, not any other real or complex number. |
For better package design:
We can release v0.5.2 with the deprecation message, and remove them (including Are there any reasons to keep the 2-arg version?
That's why I quoted like "mathematical". We can call them type-A to type-D, or something like that. There is not much meaning as an integer (i.e. no addition, no order, etc.), but it's just a label. |
I haven't seen an actual argument for the inconsistency besides you like it better. Personally, I also like it better....but as I said I went with |
Okay, let's change the names to |
gausschebyshev
and add gausschebyshevT
, ..., gausschebyshevW
gausschebyshev
and add gausschebyshevt
, ..., gausschebyshevw
@dlfivefifty @MikaelSlevinsky |
Can you bump the minor version number? |
This is a breaking change it should be the minor version, not the patch version |
No, the 2-arg version is still alive (and is deprecated), so we should bump the patch version. Related comment: #123 (comment) |
Deprecations are breaking changes: it forces a user to change their code |
Also exporting new functions is breaking |
So, do you think we need two breaking releases to remove
I believe it's not breaking and we need just one breaking release. This is because package users don't have to change their code, and they just receive warnings. Many other repositories add
I also believe this is not breaking. They may cause some name conflicts but are not considered as breaking usually. For example, Julia 1.9 exports |
Umm you just leave the deprecation in. It can be deleted whenever another breaking change comes, there's no rush to remove the code. But a warning can turn high-performance code into unusably slow code. And it's incredibly annoying if you are a user of another package that depends on this to suddenly have to see warnings all the time Note the rules are a bit different once something is |
This behavior can be handled by CLI argument
julia> using BenchmarkTools, FastGaussQuadrature
julia> @benchmark besselroots(0.2,5)
┌ Warning: `besselroots(ν::Real, n::Integer)` is deprecated, use `approx_besselroots(ν, n)` instead.
│ caller = var"##core#293"() at execution.jl:489
└ @ Main ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:489
BenchmarkTools.Trial: 579 samples with 1 evaluation.
Range (min … max): 8.226 ms … 12.814 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 8.504 ms ┊ GC (median): 0.00%
Time (mean ± σ): 8.629 ms ± 448.184 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▅█▅▃▁▁▁▂ ▁
▃███████████▆▅▄▅▇▅▅▄▄▅▄▄▄▃▃▄▃▄▃▂▃▃▃▁▂▁▃▁▂▂▂▂▃▂▂▂▂▃▁▃▁▂▁▁▁▁▂ ▃
8.23 ms Histogram: frequency by time 10.1 ms <
Memory estimate: 12.83 KiB, allocs estimate: 93.
julia> @benchmark approx_besselroots(0.2,5)
BenchmarkTools.Trial: 10000 samples with 767 evaluations.
Range (min … max): 164.785 ns … 1.729 μs ┊ GC (min … max): 0.00% … 82.24%
Time (median): 170.714 ns ┊ GC (median): 0.00%
Time (mean ± σ): 181.138 ns ± 71.886 ns ┊ GC (mean ± σ): 2.12% ± 4.83%
▁▆▆█▇▃▂▂▁ ▁ ▂▂▁ ▁ ▁
█████████████▇▇▇▆▆▆▆▆▅▆▆▇████▇▇▇▆▅▇▆▇█▇▇████▇▇▅▆▅▆▅▅▅▆▅▆▅▅▅▄ █
165 ns Histogram: log(frequency) by time 262 ns <
Memory estimate: 208 bytes, allocs estimate: 2.
julia> using BenchmarkTools, FastGaussQuadrature
julia> @benchmark besselroots(0.2,5)
BenchmarkTools.Trial: 10000 samples with 685 evaluations.
Range (min … max): 181.263 ns … 2.680 μs ┊ GC (min … max): 0.00% … 82.70%
Time (median): 185.461 ns ┊ GC (median): 0.00%
Time (mean ± σ): 202.780 ns ± 82.863 ns ┊ GC (mean ± σ): 2.05% ± 4.65%
▃██▄▃▃▁▁▁ ▁▅▅▂▁ ▁ ▁ ▂
███████████▇▇▆▆▇▆▆▆▆▆▅▆▆▆███████████▇████▇▆▆▆▅▅▅▄▄▅▆▆▆▆▄▄▄▃▅ █
181 ns Histogram: log(frequency) by time 288 ns <
Memory estimate: 208 bytes, allocs estimate: 2.
julia> @benchmark approx_besselroots(0.2,5)
BenchmarkTools.Trial: 10000 samples with 763 evaluations.
Range (min … max): 164.336 ns … 1.219 μs ┊ GC (min … max): 0.00% … 82.81%
Time (median): 167.722 ns ┊ GC (median): 0.00%
Time (mean ± σ): 180.819 ns ± 58.174 ns ┊ GC (mean ± σ): 1.57% ± 4.64%
▆█▂▂▁ ▂ ▁ ▁ ▁
███████▇▆▆▆▅▆▆▆███▆▆▅▆██▇▇██▇▇▇▆▆▆▆▆▆▆▆▆▅▆▆▇▆▆▆▆▅▅▄▅▅▅▅▅▅▄▄▄ █
164 ns Histogram: log(frequency) by time 313 ns <
Memory estimate: 208 bytes, allocs estimate: 2. I understand
In Julia community, we treat |
I'm sorry but changing the name of one of the main functions in a package is definitely breaking. I'm not going to tag this as a patch. |
Hmm, can I ask two questions for clarity?
|
Lets just not merge this then until there's another breaking change. |
Okay... |
@ranocha Hi, we are planning to split My question is, should we make a breaking release for this deprecation? Thank you in advance! |
I'm not using |
We currently have
gausschebyshev(n::Integer, kind::Integer)
, but we don't need arithmetic operations forkind
parameter, i.e. some operations such asgausschebyshev(4, 2+1)
is not desired.Enum
orVal
can be used to solve this problem, however, just splitting and renaming the function would be enough here.