Skip to main content

TensorReadFftExt

Trait TensorReadFftExt 

Source
pub trait TensorReadFftExt {
    // Required methods
    fn fft_read<B: TensorBackend>(
        &self,
        n: Option<usize>,
        axis: isize,
        norm: FftNorm,
        backend: &mut B,
    ) -> Result<Tensor>;
    fn ifft_read<B: TensorBackend>(
        &self,
        n: Option<usize>,
        axis: isize,
        norm: FftNorm,
        backend: &mut B,
    ) -> Result<Tensor>;
    fn rfft_read<B: TensorBackend>(
        &self,
        n: Option<usize>,
        axis: isize,
        norm: FftNorm,
        backend: &mut B,
    ) -> Result<Tensor>;
    fn irfft_read<B: TensorBackend>(
        &self,
        n: Option<usize>,
        axis: isize,
        norm: FftNorm,
        backend: &mut B,
    ) -> Result<Tensor>;
}
Expand description

Backend-explicit FFT methods for read-only tensor inputs.

The _read suffix follows the repository convention for APIs that explicitly accept TensorRead values such as borrowed views.

§Examples

use num_complex::Complex64;
use tenferro_cpu::CpuBackend;
use tenferro_fft::{FftNorm, TensorReadFftExt};
use tenferro_tensor::{TensorRead, TensorView};

let shape = [4usize];
let data = [1.0_f64, 2.0, 3.0, 4.0];
let input = TensorRead::from_view(TensorView::f64(&shape, &data)?);
let mut backend = CpuBackend::new();

let spectrum = input.fft_read(None, -1, FftNorm::Backward, &mut backend)?;
assert_eq!(spectrum.as_slice::<Complex64>()?[0], Complex64::new(10.0, 0.0));

Required Methods§

Source

fn fft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Execute a one-dimensional FFT along axis.

Source

fn ifft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Execute a one-dimensional inverse FFT along axis.

Source

fn rfft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Execute a one-dimensional real FFT along axis.

Source

fn irfft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Execute a one-dimensional inverse real 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.

Implementations on Foreign Types§

Source§

impl TensorReadFftExt for TensorRead<'_>

Source§

fn fft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Source§

fn ifft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Source§

fn rfft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Source§

fn irfft_read<B: TensorBackend>( &self, n: Option<usize>, axis: isize, norm: FftNorm, backend: &mut B, ) -> Result<Tensor>

Implementors§