This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 99 [rand.dist.samp.genpdf] Status: Resolved Submitter: Stephan Tolksdorf Opened: 2007-09-21 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [rand.dist.samp.genpdf].
View all issues with Resolved status.
Duplicate of: 795
Discussion:
99 [rand.dist.samp.genpdf] describes the interface for a distribution template that is meant to simulate random numbers from any general distribution given only the density and the support of the distribution. I'm not aware of any general purpose algorithm that would be capable of correctly and efficiently implementing the described functionality. From what I know, this is essentially an unsolved research problem. Existing algorithms either require more knowledge about the distribution and the problem domain or work only under very limited circumstances. Even the state of the art special purpose library UNU.RAN does not solve the problem in full generality, and in any case, testing and customer support for such a library feature would be a nightmare.
Possible resolution: For these reasons, I propose to delete section 99 [rand.dist.samp.genpdf].
[ Bellevue: ]
Disagreement persists.
Objection to this issue is that this function takes a general functor. The general approach would be to normalize this function, integrate it, and take the inverse of the integral, which is not possible in general. An example function is sin(1+n*x) — for any spatial frequency that the implementor chooses, there is a value of n that renders that choice arbitrarily erroneous.
Correction: The formula above should instead read 1+sin(n*x).
Objector proposes the following possible compromise positions:
- rand.dist.samp.genpdf takes an number of points so that implementor need not guess.
- replace rand.disk.samp.genpdf with an extension to either or both of the discrete functions to take arguments that take a functor and number of points in place of the list of probabilities. Reference issues 793 and 794.
Proposed resolution:
See N2813 for the proposed resolution.
Rationale:
Addressed by N2836 "Wording Tweaks for Concept-enabled Random Number Generation in C++0X".