Skip to main content

ConvolveRealFft

Enum ConvolveRealFft 

Source
pub enum ConvolveRealFft {}

Implementations§

Source§

impl ConvolveRealFft

Source

pub fn middle_product_f64( a: impl ExactSizeIterator<Item = f64>, b: impl ExactSizeIterator<Item = f64>, ) -> Vec<f64>

Returns coefficients b.len() - 1..a.len() of the convolution of a and b. Panics unless 0 < b.len() <= a.len().

Examples found in repository?
crates/competitive/src/string/wildcard_pattern_matching.rs (lines 19-22)
7fn wildcard_pattern_matching_with_rng(p: &[u8], s: &[u8], rng: &mut Xorshift) -> Vec<bool> {
8    assert!(!p.is_empty());
9    assert!(p.len() <= s.len());
10    let mut direct = [0.0; 256];
11    let mut inverse = [0.0; 256];
12    for i in 0..256 {
13        let x = 1.25 + 0.75 * rng.randf();
14        direct[i] = x;
15        inverse[i] = 1.0 / x;
16    }
17    direct[b'?' as usize] = 0.0;
18    inverse[b'?' as usize] = 0.0;
19    ConvolveRealFft::middle_product_f64(
20        s.iter().map(|&c| direct[c as usize]),
21        p.iter().rev().map(|&c| inverse[c as usize]),
22    )
23    .into_iter()
24    .map(|x| (x - x.round()).abs() < 1e-8)
25    .collect()
26}

Trait Implementations§

Source§

impl ConvolveSteps for ConvolveRealFft

Source§

type T = Vec<i64>

Source§

type F = Vec<Complex<f64>>

Source§

fn length(t: &Self::T) -> usize

Source§

fn transform(t: Self::T, len: usize) -> Self::F

Source§

fn inverse_transform(f: Self::F, len: usize) -> Self::T

Source§

fn convolve(a: Self::T, b: Self::T) -> Self::T

Source§

fn multiply(f: &mut Self::F, g: &Self::F)

Source§

const CYCLIC: bool = false

Whether transform multiplication computes modulo x^n - 1 in the coefficient ring.
Source§

fn square(t: Self::T, len: usize) -> Self::T
where Self::T: Clone,

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

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, !>

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.