Skip to content

Support for distributions as "requires" and "ensures" items #96

Description

@luketpeterson

Rather than simply a block of Rust code that returns a bool, we could additionally support a "distribution" object.

I'm thinking along the lines of a trait that could implement:

  • fn membership(val: &T) -> bool (this is a special case of fn log_prob(&T) -> Option<f64>) to check whether a value is part of the distribution. I.e. the same functionality as the current requires & ensures clause.

  • fn sample(ent: f64) -> T to generate a value in the distribution from an entropy source ranging from 0.0 to 1.0. This could then be connected to a QMC sampler.

Not all data types exist in a space that's easy to sample from, so this isn't a universal solution. But when it works it can provide more super-powers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions