pub struct FftExecutor { /* private fields */ }Expand description
Reusable concrete FFT executor with an explicitly owned backend-neutral cache.
Use this executor for repeated concrete FFT calls that should reuse backend
plans (exception E02). The FftOps methods stay
one-shot and do not retain hidden process-global, thread-local, or
backend-owned plan state between calls.
Implementations§
Source§impl FftExecutor
impl FftExecutor
Sourcepub fn new(plans: FftPlanCache) -> Self
pub fn new(plans: FftPlanCache) -> Self
Create an executor from a caller-configured FFT execution cache.
Sourcepub const fn plan_cache(&self) -> &FftPlanCache
pub const fn plan_cache(&self) -> &FftPlanCache
Inspect the owned backend-neutral FFT cache.
Sourcepub fn plan_cache_mut(&mut self) -> &mut FftPlanCache
pub fn plan_cache_mut(&mut self) -> &mut FftPlanCache
Mutably inspect or configure the owned backend-neutral FFT cache.
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Snapshot aggregate statistics for every backend cache namespace.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Remove every retained backend plan or workspace from this executor.
Sourcepub fn fft_with(
&mut self,
input: &Tensor,
opts: &FftOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn fft_with( &mut self, input: &Tensor, opts: &FftOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::fft (complex, or full spectrum of a real input) reusing this
executor’s plans. Bit-identical to FftOps::fft_with on the same input.
§Errors
As FftOps::fft: Validation for an invalid axis/n,
Unsupported for an unsupported dtype or an engine without an FFT
capability, or the backend’s typed error.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let x = Tensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0, 3.0, 4.0])?;
let y = executor.fft_with(&x, &FftOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.as_slice::<Complex64>()?[0], Complex64::new(10.0, 0.0));
assert!(executor.cache_stats().entries > 0);Sourcepub fn ifft_with(
&mut self,
input: &Tensor,
opts: &FftOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn ifft_with( &mut self, input: &Tensor, opts: &FftOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::ifft reusing this executor’s plans.
§Errors
As FftOps::ifft: Validation for an invalid axis/n,
Unsupported for an unsupported dtype or an engine without an FFT
capability, or the backend’s typed error.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let x = Tensor::from_vec_col_major(
vec![2],
vec![Complex64::new(3.0, 0.0), Complex64::new(-1.0, 0.0)],
)?;
let y = executor.ifft_with(&x, &FftOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.as_slice::<Complex64>()?[1], Complex64::new(2.0, 0.0));Sourcepub fn rfft_with(
&mut self,
input: &Tensor,
opts: &FftOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn rfft_with( &mut self, input: &Tensor, opts: &FftOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::rfft reusing this executor’s plans.
§Errors
As FftOps::rfft: Validation for an invalid axis/n or a
non-real input, Unsupported for an unsupported dtype or an engine
without an FFT capability, or the backend’s typed error.
§Examples
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let x = Tensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0, 3.0, 4.0])?;
let y = executor.rfft_with(&x, &FftOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.shape(), &[3]);Sourcepub fn irfft_with(
&mut self,
input: &Tensor,
opts: &FftOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn irfft_with( &mut self, input: &Tensor, opts: &FftOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::irfft reusing this executor’s plans.
§Errors
As FftOps::irfft: Validation for an invalid axis/n or a
complex input, Unsupported for an unsupported dtype or an engine
without an FFT capability, or the backend’s typed error.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let x = Tensor::from_vec_col_major(
vec![3],
vec![Complex64::new(10.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(-2.0, 0.0)],
)?;
let y = executor.irfft_with(&x, &FftOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.shape(), &[4]);Sourcepub fn fftn_with(
&mut self,
input: &Tensor,
opts: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn fftn_with( &mut self, input: &Tensor, opts: &FftnOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::fftn reusing this executor’s plans.
§Errors
As FftOps::fftn: Validation for an invalid axes/shape/n,
Unsupported for an unsupported dtype or an engine without an N-d FFT
capability, or the backend’s typed error.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftnOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let x = Tensor::from_vec_col_major(vec![2, 2], vec![1.0_f64, 2.0, 3.0, 4.0])?;
let y = executor.fftn_with(&x, &FftnOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.as_slice::<Complex64>()?[0], Complex64::new(10.0, 0.0));Sourcepub fn ifftn_with(
&mut self,
input: &Tensor,
opts: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn ifftn_with( &mut self, input: &Tensor, opts: &FftnOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::ifftn reusing this executor’s plans.
§Errors
As FftOps::ifftn: Validation for an invalid axes/shape/n,
Unsupported for an unsupported dtype or an engine without an N-d FFT
capability, or the backend’s typed error.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftnOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let x = Tensor::from_vec_col_major(vec![1, 2], vec![Complex64::new(3.0, 0.0), Complex64::new(-1.0, 0.0)])?;
let y = executor.ifftn_with(&x, &FftnOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.as_slice::<Complex64>()?[1], Complex64::new(2.0, 0.0));Sourcepub fn rfftn_with(
&mut self,
input: &Tensor,
opts: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn rfftn_with( &mut self, input: &Tensor, opts: &FftnOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::rfftn reusing this executor’s plans.
§Errors
As FftOps::rfftn: Validation for an invalid axes/shape/n or a
non-real input, Unsupported for an unsupported dtype or an engine
without an N-d FFT capability, or the backend’s typed error.
§Examples
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftnOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let x = Tensor::from_vec_col_major(vec![2, 4], vec![1.0_f64; 8])?;
let y = executor.rfftn_with(&x, &FftnOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.shape(), &[2, 3]);Sourcepub fn irfftn_with(
&mut self,
input: &Tensor,
opts: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<Tensor>
pub fn irfftn_with( &mut self, input: &Tensor, opts: &FftnOptions, exec: &mut dyn Engine, ) -> Result<Tensor>
FftOps::irfftn reusing this executor’s plans.
§Errors
As FftOps::irfftn: Validation for an invalid axes/shape/n or a
complex input, Unsupported for an unsupported dtype or an engine
without an N-d FFT capability, or the backend’s typed error.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftExecutor, FftnOptions};
use tenferro_tensor::Tensor;
let mut executor = FftExecutor::default();
let mut spectrum = vec![Complex64::new(0.0, 0.0); 6];
spectrum[0] = Complex64::new(8.0, 0.0);
let x = Tensor::from_vec_col_major(vec![2, 3], spectrum)?;
let y = executor.irfftn_with(&x, &FftnOptions::default(), &mut CpuEngine::serial())?;
assert_eq!(y.as_slice::<f64>()?, &[1.0; 8]);Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FftExecutor
impl !UnwindSafe for FftExecutor
impl Freeze for FftExecutor
impl Send for FftExecutor
impl Sync for FftExecutor
impl Unpin for FftExecutor
impl UnsafeUnpin for FftExecutor
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
impl<T, U> Imply<T> for U
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> ⓘ
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> ⓘ
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