Skip to main content

SiteAddrs

Struct SiteAddrs 

Source
pub struct SiteAddrs { /* private fields */ }
Expand description

The MCMC site addresses of one taste program, built once.

Single-site MH re-executes the whole program on every step, so every sample() node — d·K + S + (n_stars − 1) + K·G of them, 206 as shipped (K = 5, d = 40, one session, and no fused group, since the fused prior defaults to off; a group would add K) — is reconstructed 26 000 times per fit. Building each address inline (addr!(format!("theta{k}"), i)) therefore cost a format! into a String, a re-allocation into Arc<str> and a SipHash of that string, per site per step: ~3.7 M allocations per mature fit, and measurably the bulk of the fit’s wall time (see examples/fit_bench.rs — the fit is steps × sites-shaped, and the likelihood is ~20 % of it even at n_obs = 100).

The addresses are a pure function of (k_styles, n_features, n_stars, n_sessions), none of which move during a fit, so they are built once and [Address] is cloned into each node — an Arc refcount bump plus a copy of the cached hash, no allocation and no hashing.

The strings are produced by the same addr! invocations as before (theta<k>#i, tau#s, cut#j), so traces, serialized posteriors and any warm-start path see byte-identical addresses.

Implementations§

Source§

impl SiteAddrs

Source

pub fn site_count(&self) -> usize

Total sample() nodes in the program — what single-site MH divides its step budget across, and the number the fit’s cost is linear in.

d·K + S + (n_stars − 1) + K·G, where G is the number of fused groups. At K = 5, d = 40, S = 1 and one brightness group that is 200 + 1 + 5 + 5 = 211; without the group it is the 206 the module doc quotes.

Source

pub fn new(cfg: &TasteConfig, n_sessions: usize) -> Self

Build the address table for cfg over a log spanning n_sessions.

Trait Implementations§

Source§

impl Clone for SiteAddrs

Source§

fn clone(&self) -> SiteAddrs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SiteAddrs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,