pub struct DiffableGaussian2D<T: Float> {
pub mean: [T; 2],
pub cov: [[T; 2]; 2],
pub inv_cov: [[T; 2]; 2],
pub logdet_cov: T,
pub norm_const: T,
}Expand description
A 2D Gaussian target distribution, parameterized by mean and covariance.
This struct also precomputes the inverse covariance and a log-normalization
constant so we can quickly compute log-densities and gradients in unnorm_logp.
Fields§
§mean: [T; 2]§cov: [[T; 2]; 2]§inv_cov: [[T; 2]; 2]§logdet_cov: T§norm_const: TImplementations§
Trait Implementations§
Source§impl<T, B> BatchedGradientTarget<T, B> for DiffableGaussian2D<T>
impl<T, B> BatchedGradientTarget<T, B> for DiffableGaussian2D<T>
Source§fn unnorm_logp_batch(&self, positions: Tensor<B, 2>) -> Tensor<B, 1>
fn unnorm_logp_batch(&self, positions: Tensor<B, 2>) -> Tensor<B, 1>
Evaluate the log probability for a batch of positions: shape [n_chains, 2]. Return shape [n_chains]. Note: It is not necessary to return the log probability here but for easier debugging we do so anyways.
Source§impl<T: Clone + Float> Clone for DiffableGaussian2D<T>
impl<T: Clone + Float> Clone for DiffableGaussian2D<T>
Source§fn clone(&self) -> DiffableGaussian2D<T>
fn clone(&self) -> DiffableGaussian2D<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, B> GradientTarget<T, B> for DiffableGaussian2D<T>
impl<T, B> GradientTarget<T, B> for DiffableGaussian2D<T>
Auto Trait Implementations§
impl<T> Freeze for DiffableGaussian2D<T>where
T: Freeze,
impl<T> RefUnwindSafe for DiffableGaussian2D<T>where
T: RefUnwindSafe,
impl<T> Send for DiffableGaussian2D<T>where
T: Send,
impl<T> Sync for DiffableGaussian2D<T>where
T: Sync,
impl<T> Unpin for DiffableGaussian2D<T>where
T: Unpin,
impl<T> UnwindSafe for DiffableGaussian2D<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more