pub trait TensorFftExt {
// Required methods
fn fft<B: TensorBackend>(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
backend: &mut B,
) -> Result<Tensor>;
fn ifft<B: TensorBackend>(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
backend: &mut B,
) -> Result<Tensor>;
fn rfft<B: TensorBackend>(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
backend: &mut B,
) -> Result<Tensor>;
fn irfft<B: TensorBackend>(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
backend: &mut B,
) -> Result<Tensor>;
}Expand description
Backend-explicit FFT methods for concrete Tensor values.
This is the non-AD immediate execution surface. It uses unsuffixed method
names because the receiver is an owned compact tensor value. Use
TensorReadFftExt when the input is a borrowed view or other
TensorRead value.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuBackend;
use tenferro_fft::{FftNorm, TensorFftExt};
use tenferro_tensor::Tensor;
let input = Tensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0, 3.0, 4.0])?;
let mut backend = CpuBackend::new();
let spectrum = input.fft(None, -1, FftNorm::Backward, &mut backend)?;
assert_eq!(spectrum.shape(), &[4]);
assert_eq!(spectrum.as_slice::<Complex64>()?[0], Complex64::new(10.0, 0.0));Required Methods§
Sourcefn fft<B: TensorBackend>(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
backend: &mut B,
) -> Result<Tensor>
fn fft<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>
Execute a one-dimensional FFT along axis.
Sourcefn ifft<B: TensorBackend>(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
backend: &mut B,
) -> Result<Tensor>
fn ifft<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>
Execute a one-dimensional inverse FFT along axis.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.