Struct CpuMath

Source
pub struct CpuMath<F: CpuLogpFunc> { /* private fields */ }

Implementations§

Source§

impl<F: CpuLogpFunc> CpuMath<F>

Source

pub fn new(logp_func: F) -> Self

Trait Implementations§

Source§

impl<F: Debug + CpuLogpFunc> Debug for CpuMath<F>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<F: CpuLogpFunc> Math for CpuMath<F>

Source§

type Vector = Col<Own<f64>>

Source§

type EigVectors = Mat<Own<f64>>

Source§

type EigValues = Col<Own<f64>>

Source§

type LogpErr = <F as CpuLogpFunc>::LogpError

Source§

type Err = CpuMathError

Source§

type TransformParams = <F as CpuLogpFunc>::TransformParams

Source§

fn new_array(&mut self) -> Self::Vector

Source§

fn new_eig_vectors<'a>( &'a mut self, vals: impl ExactSizeIterator<Item = &'a [f64]>, ) -> Self::EigVectors

Source§

fn new_eig_values(&mut self, vals: &[f64]) -> Self::EigValues

Source§

fn logp_array( &mut self, position: &Self::Vector, gradient: &mut Self::Vector, ) -> Result<f64, Self::LogpErr>

Compute the unnormalized log probability density of the posterior Read more
Source§

fn logp( &mut self, position: &[f64], gradient: &mut [f64], ) -> Result<f64, Self::LogpErr>

Source§

fn dim(&self) -> usize

Source§

fn scalar_prods3( &mut self, positive1: &Self::Vector, negative1: &Self::Vector, positive2: &Self::Vector, x: &Self::Vector, y: &Self::Vector, ) -> (f64, f64)

Source§

fn scalar_prods2( &mut self, positive1: &Self::Vector, positive2: &Self::Vector, x: &Self::Vector, y: &Self::Vector, ) -> (f64, f64)

Source§

fn sq_norm_sum(&mut self, x: &Self::Vector, y: &Self::Vector) -> f64

Source§

fn read_from_slice(&mut self, dest: &mut Self::Vector, source: &[f64])

Source§

fn write_to_slice(&mut self, source: &Self::Vector, dest: &mut [f64])

Source§

fn copy_into(&mut self, array: &Self::Vector, dest: &mut Self::Vector)

Source§

fn axpy_out( &mut self, x: &Self::Vector, y: &Self::Vector, a: f64, out: &mut Self::Vector, )

Source§

fn axpy(&mut self, x: &Self::Vector, y: &mut Self::Vector, a: f64)

Source§

fn fill_array(&mut self, array: &mut Self::Vector, val: f64)

Source§

fn array_all_finite(&mut self, array: &Self::Vector) -> bool

Source§

fn array_all_finite_and_nonzero(&mut self, array: &Self::Vector) -> bool

Source§

fn array_mult( &mut self, array1: &Self::Vector, array2: &Self::Vector, dest: &mut Self::Vector, )

Source§

fn array_mult_eigs( &mut self, stds: &Self::Vector, rhs: &Self::Vector, dest: &mut Self::Vector, vecs: &Self::EigVectors, vals: &Self::EigValues, )

Source§

fn array_vector_dot( &mut self, array1: &Self::Vector, array2: &Self::Vector, ) -> f64

Source§

fn array_gaussian<R: Rng + ?Sized>( &mut self, rng: &mut R, dest: &mut Self::Vector, stds: &Self::Vector, )

Source§

fn array_gaussian_eigs<R: Rng + ?Sized>( &mut self, rng: &mut R, dest: &mut Self::Vector, scale: &Self::Vector, vals: &Self::EigValues, vecs: &Self::EigVectors, )

Source§

fn array_update_variance( &mut self, mean: &mut Self::Vector, variance: &mut Self::Vector, value: &Self::Vector, diff_scale: f64, )

Source§

fn array_update_var_inv_std_draw( &mut self, variance_out: &mut Self::Vector, inv_std: &mut Self::Vector, draw_var: &Self::Vector, scale: f64, fill_invalid: Option<f64>, clamp: (f64, f64), )

Source§

fn array_update_var_inv_std_draw_grad( &mut self, variance_out: &mut Self::Vector, inv_std: &mut Self::Vector, draw_var: &Self::Vector, grad_var: &Self::Vector, fill_invalid: Option<f64>, clamp: (f64, f64), )

Source§

fn array_update_var_inv_std_grad( &mut self, variance_out: &mut Self::Vector, inv_std: &mut Self::Vector, gradient: &Self::Vector, fill_invalid: f64, clamp: (f64, f64), )

Source§

fn eigs_as_array(&mut self, source: &Self::EigValues) -> Box<[f64]>

Source§

fn inv_transform_normalize( &mut self, params: &Self::TransformParams, untransformed_position: &Self::Vector, untransofrmed_gradient: &Self::Vector, transformed_position: &mut Self::Vector, transformed_gradient: &mut Self::Vector, ) -> Result<f64, Self::LogpErr>

Source§

fn init_from_untransformed_position( &mut self, params: &Self::TransformParams, untransformed_position: &Self::Vector, untransformed_gradient: &mut Self::Vector, transformed_position: &mut Self::Vector, transformed_gradient: &mut Self::Vector, ) -> Result<(f64, f64), Self::LogpErr>

Source§

fn init_from_transformed_position( &mut self, params: &Self::TransformParams, untransformed_position: &mut Self::Vector, untransformed_gradient: &mut Self::Vector, transformed_position: &Self::Vector, transformed_gradient: &mut Self::Vector, ) -> Result<(f64, f64), Self::LogpErr>

Source§

fn update_transformation<'a, R: Rng + ?Sized>( &'a mut self, rng: &mut R, untransformed_positions: impl ExactSizeIterator<Item = &'a Self::Vector>, untransformed_gradients: impl ExactSizeIterator<Item = &'a Self::Vector>, untransformed_logp: impl ExactSizeIterator<Item = &'a f64>, params: &'a mut Self::TransformParams, ) -> Result<(), Self::LogpErr>

Source§

fn new_transformation<R: Rng + ?Sized>( &mut self, rng: &mut R, untransformed_position: &Self::Vector, untransfogmed_gradient: &Self::Vector, chain: u64, ) -> Result<Self::TransformParams, Self::LogpErr>

Source§

fn transformation_id( &self, params: &Self::TransformParams, ) -> Result<i64, Self::LogpErr>

Source§

fn copy_array(&mut self, array: &Self::Vector) -> Self::Vector

Source§

fn box_array(&mut self, array: &Self::Vector) -> Box<[f64]>

Auto Trait Implementations§

§

impl<F> Freeze for CpuMath<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for CpuMath<F>
where F: RefUnwindSafe,

§

impl<F> Send for CpuMath<F>
where F: Send,

§

impl<F> Sync for CpuMath<F>
where F: Sync,

§

impl<F> Unpin for CpuMath<F>
where F: Unpin,

§

impl<F> UnwindSafe for CpuMath<F>
where F: UnwindSafe,

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,