-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow specifying non-existant bounds to truncated using nothing (#1489)
* Add kwarg method * Add fallbacks to Truncated * Document the method generically * Expand truncated docstring * Raise deprecation warning if infinite bounds provided * Improve warning * Fix warning for older Julia versions * Remove deprecated method calls * Use new syntax in show method * Remove last call to deprecated function * Add tests for variants of truncated * Add missing tests * Add LogUniform tests * Add Uniform and LogUniform overloads * Improve documentation * Apply suggestions from code review Co-authored-by: David Widmann <devmotion@users.noreply.github.com> * Fix typo * Test deprecation warnings * Test show methods * Use `@test_deprecated` * Update src/truncate.jl Co-authored-by: David Widmann <devmotion@users.noreply.github.com> * Don't force deprecation warnings Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
- Loading branch information
Showing
10 changed files
with
119 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
truncated(d::LogUniform, lo::T, hi::T) where {T<:Real} = LogUniform(max(d.a, lo), min(d.b, hi)) | ||
truncated(d::LogUniform, lo::Real, ::Nothing) = LogUniform(max(d.a, lo), d.b) | ||
truncated(d::LogUniform, ::Nothing, hi::Real) = LogUniform(d.a, min(d.b, hi)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters