Skip to main content

Rhdh

Struct Rhdh 

Source
pub struct Rhdh {
    pub padded: usize,
    /* private fields */
}
Expand description

A reusable RHDH context: the random sign diagonal for a padded dimension.

Fields§

§padded: usize

Implementations§

Source§

impl Rhdh

Source

pub fn new(dim: usize, seed: u64) -> Self

Build the transform for dim dimensions from a deterministic seed.

Source

pub fn apply(&self, v: &[f32], out: &mut Vec<f32>)

Apply the randomized Hadamard transform to a unit-normalized input of dim values. Returns a vector of padded values, approximately N(0, 1) per coordinate. The padding zeros receive random signs too, which keeps energy spread uniformly.

Auto Trait Implementations§

§

impl Freeze for Rhdh

§

impl RefUnwindSafe for Rhdh

§

impl Send for Rhdh

§

impl Sync for Rhdh

§

impl Unpin for Rhdh

§

impl UnsafeUnpin for Rhdh

§

impl UnwindSafe for Rhdh

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.