pub struct Analytic {
pub id: u64,
pub family: Family,
pub domain: Domain,
pub pieces: Pieces,
pub int: bool,
pub form: Option<Arc<Linear>>,
pub weight: Option<Arc<Likelihood>>,
}Fields§
§id: u64§family: Family§domain: Domain§pieces: Pieces§int: boolWhether it’s an int, as floor(x) is: then every piece is a whole
number.
form: Option<Arc<Linear>>For a function of several normal latents, its axis: a linear form
of them, whose distribution is family. id is then 0.
weight: Option<Arc<Likelihood>>The latent’s likelihood, with @integrate: a weight on family.
Implementations§
Source§impl Analytic
impl Analytic
pub fn new(id: u64, family: Family) -> Self
Sourcepub fn same_axis(&self, other: &Analytic) -> bool
pub fn same_axis(&self, other: &Analytic) -> bool
Whether it’s a function of the same axis as other.
Sourcepub fn linear(&self) -> Option<Linear>
pub fn linear(&self) -> Option<Linear>
The linear form of independent normal latents it is, if it’s one: affine in a normal latent or a form, and unrestricted.
Sourcepub fn renamed(&self, map: &BTreeMap<u64, u64>) -> Self
pub fn renamed(&self, map: &BTreeMap<u64, u64>) -> Self
The same outcome of other latents: each as map renames it.
Sourcepub fn at(&self, c: f64, value: f64) -> Value
pub fn at(&self, c: f64, value: f64) -> Value
Its value where its axis is value, at the CDF coordinate c.
Sourcepub fn moved(&self, to: &Family) -> Self
pub fn moved(&self, to: &Family) -> Self
The same function of the same values of the draw, in the coordinates
of to, a distribution of the draw with the same support or less.
Sourcepub fn piecewise_affine(&self) -> bool
pub fn piecewise_affine(&self) -> bool
Whether it’s affine on each piece: then it has a density where it isn’t constant.
pub fn key(&self) -> impl Ord + Hash + use<>
pub fn value(self) -> OpResult<Value>
Sourcepub fn is_discrete(&self) -> bool
pub fn is_discrete(&self) -> bool
Whether each of its values has positive probability: it’s a constant
on each part of the domain, like floor(x).
Sourcepub fn atoms(&self) -> Vec<(Value, Domain, f64)>
pub fn atoms(&self) -> Vec<(Value, Domain, f64)>
Each value of a discrete outcome, with where the draw is when it’s that value, and that part’s share of the domain’s probability.
Sourcepub fn segments(&self) -> Vec<(f64, f64, Fun)>
pub fn segments(&self) -> Vec<(f64, f64, Fun)>
Each part of the domain, with the piece of the function there, as
(lo, hi, f).
Sourcepub fn has_atoms(&self) -> bool
pub fn has_atoms(&self) -> bool
Whether a single value has positive probability: a constant piece.
Sourcepub fn measure(&self, d: &Domain) -> f64
pub fn measure(&self, d: &Domain) -> f64
The measure of part of its coordinates: its length, or with a likelihood, the likelihood’s integral there.
The probability of part of its coordinates, given its domain.
pub fn cdf(&self, x: f64) -> f64
Sourcepub fn pdf(&self, x: f64) -> f64
pub fn pdf(&self, x: f64) -> f64
The density at x, of a piecewise affine outcome: the caller rules
out atoms and other functions.
pub fn quantile(&self, q: f64) -> f64
Sourcepub fn integrated_moments(&self, tolerance: f64) -> Option<(f64, f64)>
pub fn integrated_moments(&self, tolerance: f64) -> Option<(f64, f64)>
The mean and variance by numerical integration, to tolerance, for
@integrate where there’s no formula: None if an integral doesn’t
converge.
Sourcepub fn moments(&self) -> Option<(f64, f64)>
pub fn moments(&self) -> Option<(f64, f64)>
The mean and variance, from formulas: None where a piece’s function
has none for the draw’s family.
pub fn sd(&self) -> Option<f64>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Analytic
impl RefUnwindSafe for Analytic
impl Send for Analytic
impl Sync for Analytic
impl Unpin for Analytic
impl UnsafeUnpin for Analytic
impl UnwindSafe for Analytic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);