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.
This further speeds up the joint distribution by allowing it work on an array of values. Since many (all?) of the distributions in the distributions module are not vectorized, you still can't do vectorized prior evaluation for most practical purposes, but this is a step in that direction.
My main reason for doing this was to speed up the rvs function when you have many constraints. Currently, this is quite slow, because it draws one point at a time, evaluating each as they go. In this patch, the rvs will draw a batch of points, then use the now vectorized
contains
function to evaluate them all at once. It will then keep the points that pass the constraints, and continue until it's acquired the requested size. On each loop it will also increase the size of the draws based on the previous loop's acceptance (up to a maximum of a million draws). In my test, the constraints resulted in only ~1 in 10000 draws being kept. With that, it would take potentially hours to draw 1000 points. With this patch, it takes ~minute.