pub trait TensorReadFftExt {
// Required methods
fn fft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> Result<Tensor>;
fn ifft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> Result<Tensor>;
fn rfft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> Result<Tensor>;
fn irfft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> 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.
Direct read calls intentionally materialize through a call-local one-shot
FFT plan cache. Use FftExecutor on compact owned tensors when repeated
concrete calls should retain backend plans across calls.
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuBackend;
use tenferro_fft::{FftNorm, TensorReadFftExt};
use tenferro_tensor::{BackendSessionHost, 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 = backend
.with_backend_session(|session| input.fft_read(None, -1, FftNorm::Backward, session))?;
assert_eq!(spectrum.as_slice::<Complex64>()?[0], Complex64::new(10.0, 0.0));Required Methods§
Sourcefn fft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> Result<Tensor>
fn fft_read( &self, n: Option<usize>, axis: isize, norm: FftNorm, session: &mut dyn BackendSession, ) -> Result<Tensor>
Execute a one-dimensional FFT along axis.
§Errors
Returns Error::Validation with AxisOutOfBounds or InvalidArgument
for axis/n, Error::Extension with ErrorKind::Unsupported for an
integer or boolean input, a typed capability error when the session
does not expose an FFT execution capability, or a typed backend source
for materialization or execution.
Sourcefn ifft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> Result<Tensor>
fn ifft_read( &self, n: Option<usize>, axis: isize, norm: FftNorm, session: &mut dyn BackendSession, ) -> Result<Tensor>
Execute a one-dimensional inverse FFT along axis.
§Errors
Returns Error::Validation with AxisOutOfBounds or InvalidArgument
for axis/n, Error::Extension with ErrorKind::Unsupported for a
non-complex input, a typed capability error when the session does not
expose an FFT execution capability, or a typed backend source for
materialization.
Sourcefn rfft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> Result<Tensor>
fn rfft_read( &self, n: Option<usize>, axis: isize, norm: FftNorm, session: &mut dyn BackendSession, ) -> Result<Tensor>
Execute a one-dimensional real FFT along axis.
§Errors
Returns Error::Validation with AxisOutOfBounds or InvalidArgument
for axis/n, Error::Extension with ErrorKind::Unsupported for a
non-F32/F64 input, a typed capability error when the session does
not expose an FFT execution capability, or a typed backend source for
materialization.
Sourcefn irfft_read(
&self,
n: Option<usize>,
axis: isize,
norm: FftNorm,
session: &mut dyn BackendSession,
) -> Result<Tensor>
fn irfft_read( &self, n: Option<usize>, axis: isize, norm: FftNorm, session: &mut dyn BackendSession, ) -> Result<Tensor>
Execute a one-dimensional inverse real FFT along axis.
§Errors
Returns Error::Validation with AxisOutOfBounds, InvalidArgument,
or spectrum-length details, Error::Extension with
ErrorKind::Unsupported for a non-complex input, a typed capability
error when the session does not expose an FFT execution capability, or
a typed backend source for materialization.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".