-
Notifications
You must be signed in to change notification settings - Fork 2
Add UNURAN sampling #71
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7abe0dd
feat: UNURAN as submodule with build
wrdxwrdxwrdx f77edeb
feat: UNURAN Sampler realization
wrdxwrdxwrdx d1225b2
chore: example of sampling
wrdxwrdxwrdx 4dd85bd
ci: windows UNURAN build
wrdxwrdxwrdx 38e83a4
chore: update README
wrdxwrdxwrdx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [submodule "subprojects/unuran-pysatl"] | ||
| path = subprojects/unuran-pysatl | ||
| url = https://github.com/PySATL/unuran.git | ||
| branch = main |
This file contains hidden or 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 hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| """ | ||
| Public sampling interface re-exporting UNURAN-based defaults. | ||
| """ | ||
|
|
||
| __author__ = "Artem Romanyuk" | ||
| __copyright__ = "Copyright (c) 2025 PySATL project" | ||
| __license__ = "SPDX-License-Identifier: MIT" | ||
|
|
||
| from .unuran import ( | ||
| DefaultUnuranSampler, | ||
| DefaultUnuranSamplingStrategy, | ||
| UnuranMethod, | ||
| UnuranMethodConfig, | ||
| ) | ||
|
|
||
| SamplingMethod = UnuranMethod | ||
| SamplingMethodConfig = UnuranMethodConfig | ||
| DefaultSampler = DefaultUnuranSampler | ||
| DefaultSamplingStrategy = DefaultUnuranSamplingStrategy | ||
|
|
||
| __all__ = [ | ||
| "SamplingMethod", | ||
| "SamplingMethodConfig", | ||
| "DefaultSampler", | ||
| "DefaultSamplingStrategy", | ||
| ] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| """ | ||
| Expose the UNU.RAN sampling API interfaces alongside their default | ||
| implementations backed by our C bindings. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| __author__ = "Artem Romanyuk" | ||
| __copyright__ = "Copyright (c) 2025 PySATL project" | ||
| __license__ = "SPDX-License-Identifier: MIT" | ||
|
|
||
| from .core import ( | ||
| DefaultUnuranSampler, | ||
| DefaultUnuranSamplingStrategy, | ||
| ) | ||
| from .method_config import ( | ||
| UnuranMethod, | ||
| UnuranMethodConfig, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "UnuranMethod", | ||
| "UnuranMethodConfig", | ||
| "DefaultUnuranSampler", | ||
| "DefaultUnuranSamplingStrategy", | ||
| ] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| """ | ||
| PySATL Core — UNU.RAN CFFI Bindings | ||
| ===================================== | ||
|
|
||
| Lazy loader for the compiled CFFI extension module ``_unuran_cffi``. | ||
| Tries the fully-qualified package path first, then falls back to a | ||
| bare top-level import so the extension can be found regardless of | ||
| how it was installed. Exposes ``_unuran_cffi`` (``None`` when the | ||
| binary extension is not available). | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| __author__ = "Artem Romanyuk" | ||
| __copyright__ = "Copyright (c) 2025 PySATL project" | ||
| __license__ = "SPDX-License-Identifier: MIT" | ||
|
|
||
| from importlib import import_module | ||
| from types import ModuleType | ||
|
|
||
| _unuran_cffi_module = None | ||
|
|
||
| for name in ( | ||
| "pysatl_core.sampling.unuran.bindings._unuran_cffi", | ||
| "_unuran_cffi", | ||
| ): | ||
| try: | ||
| _unuran_cffi_module = import_module(name) | ||
| break | ||
| except ModuleNotFoundError: # pragma: no cover - optional binary module | ||
| pass | ||
|
|
||
| _unuran_cffi: ModuleType | None = _unuran_cffi_module | ||
|
|
||
| __all__ = [ | ||
| "_unuran_cffi", | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.