Introduce immutable RNG state for correct comparisons and pickling
All threads resolved!
All threads resolved!
This MR refactors the frontend RNG architecture of !474 (merged) to use immutable RNG state objects.
An immutable state object must be attached to each RNG invocation in order to correctly compare equivalent invocations and allow them to be pickled. The RNG objects themselves now serve as factories for their invocations and associated series of state objects.
- Add
RngState
class for immutable RNG state objects - Turn
RngBase
and subclassPhilox
into factories for their state - Remove
RngFunc
and replace it by an introspection-based typechecking mechanism (inheritance fromRngFunc
is not preserved by pickle) - Adapt backend parsing
- Add test cases for RNG comparion and pickling
- Bump SymPy dependency to
~=1.14
(RNG functions need https://github.com/sympy/sympy/pull/26881) - Fix SymPy-related spurious mypy errors
Edited by Frederik Hennig
Merge request reports
Activity
changed milestone to %Release 2.0
assigned to @da15siwa
requested review from @kuron
removed review request for @kuron
added 1 commit
- da6cb8a7 - Replace `RngFunc` by a runtime checking protocol
requested review from @kuron
mentioned in merge request lbmpy!172 (merged)
mentioned in issue #130
- Resolved by Frederik Hennig
- Resolved by Frederik Hennig
enabled an automatic merge when all merge checks for ffde2c83 pass
mentioned in commit 5c4f9d2c
Please register or sign in to reply