Struct fetish_lib::embedder_state::EmbedderState[][src]

pub struct EmbedderState<'a> {
    pub model_spaces: HashMap<TypeId, EmbeddingSpace<'a>>,
    pub ctxt: &'a Context,
}
Expand description

An EmbedderState keeps track of the embeddings of function terms (TermModels) which come from some InterpreterState, and also the learned Elaborators for every function type.

Fields

model_spaces: HashMap<TypeId, EmbeddingSpace<'a>>ctxt: &'a Context

Implementations

impl<'a> EmbedderState<'a>[src]

pub fn sample(&self, rng: &mut ThreadRng) -> SampledEmbedderState<'a>[src]

Draws a sample from the distribution over TermModels represented in this EmbedderState, yielding a SampledEmbedderState.

pub fn new(
    model_prior_specification: &'a dyn PriorSpecification,
    elaborator_prior_specification: &'a dyn PriorSpecification,
    ctxt: &'a Context
) -> EmbedderState<'a>
[src]

Creates a new EmbedderState, initially populated with default embeddings for primitive terms in the passed Context.

pub fn init_embeddings_for_new_terms(
    &mut self,
    newly_evaluated_terms: &NewlyEvaluatedTerms
)
[src]

Initializes default embeddings for the passed collection of terms in a NewlyEvaluatedTerms.

pub fn bayesian_update_step(
    &mut self,
    interpreter_state: &InterpreterState<'_>,
    newly_evaluated_terms: &NewlyEvaluatedTerms
)
[src]

Given an InterpreterState and a collection of NewlyEvaluatedTerms, performs a bottom-up (data) update followed by a top-down (prior) update recursively on all modified terms. This method may be used to keep the TermModels in this EmbedderState up-to-date with new information.

pub fn has_embedding(&self, term_ptr: TermPointer) -> bool[src]

Determines whether/not there is a stored TermModel for the given TermPointer.

pub fn get_embedding(&self, term_ptr: TermPointer) -> &TermModel<'_>[src]

Given a TermPointer pointing to a TermModel tracked by this EmbedderState, yields a reference to the TermModel. Panics if there is no such entry stored.

pub fn get_mut_embedding(&mut self, term_ptr: TermPointer) -> &mut TermModel<'a>[src]

Like EmbedderState, but yields a mutable reference to the TermModel given a TermPointer pointing to it.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for EmbedderState<'a>

impl<'a> !Send for EmbedderState<'a>

impl<'a> !Sync for EmbedderState<'a>

impl<'a> Unpin for EmbedderState<'a>

impl<'a> !UnwindSafe for EmbedderState<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

pub fn vzip(self) -> V