pub trait FftOps: AsView {
Show 16 methods
// Required methods
fn fft(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn fft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn ifft(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn ifft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn rfft(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn rfft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn irfft(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Real>
where Self::Repr: FftRepr;
fn irfft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Real>
where Self::Repr: FftRepr;
fn fftn(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn fftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn ifftn(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn ifftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn rfftn(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn rfftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
where Self::Repr: FftRepr;
fn irfftn(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Real>
where Self::Repr: FftRepr;
fn irfftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Real>
where Self::Repr: FftRepr;
}Expand description
FFTs on anything that implements AsView: owned and borrowed tensors, typed tensors and strided views. Results are Tensors for erased inputs and typed tensors of the transform’s dtype for typed inputs. Every operation takes the options last-but-one and the engine last.
Generated by api_ops! from the fft registry.
Required Methods§
Sourcefn fft(&self, exec: &mut dyn Engine) -> Result<<Self::Repr as FftRepr>::Complex>
fn fft(&self, exec: &mut dyn Engine) -> Result<<Self::Repr as FftRepr>::Complex>
One-axis discrete Fourier transform along axis (default the last axis).
Uses the default FftOptions; same as fft_with with &FftOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64])?;
let y = x.fft(&mut engine)?;
let z = x.fft_with(&FftOptions::default().axis(0), &mut engine)?;
assert_eq!(y.shape(), &[4]);
assert_eq!(z.shape(), &[4]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(10.0, 0.0)).norm() < 1e-12);Sourcefn fft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn fft_with( &self, options: &FftOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
One-axis discrete Fourier transform along axis (default the last axis).
With explicit FftOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64])?;
let y = x.fft(&mut engine)?;
let z = x.fft_with(&FftOptions::default().axis(0), &mut engine)?;
assert_eq!(y.shape(), &[4]);
assert_eq!(z.shape(), &[4]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(10.0, 0.0)).norm() < 1e-12);Sourcefn ifft(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn ifft( &self, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
One-axis inverse discrete Fourier transform along axis.
Uses the default FftOptions; same as ifft_with with &FftOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![4], vec![Complex64::new(1.0, 0.0), Complex64::new(2.0, 0.0), Complex64::new(3.0, 0.0), Complex64::new(4.0, 0.0)])?;
let y = x.ifft(&mut engine)?;
let z = x.ifft_with(&FftOptions::default().axis(0), &mut engine)?;
assert_eq!(y.shape(), &[4]);
assert_eq!(z.shape(), &[4]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(2.5, 0.0)).norm() < 1e-12);Sourcefn ifft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn ifft_with( &self, options: &FftOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
One-axis inverse discrete Fourier transform along axis.
With explicit FftOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![4], vec![Complex64::new(1.0, 0.0), Complex64::new(2.0, 0.0), Complex64::new(3.0, 0.0), Complex64::new(4.0, 0.0)])?;
let y = x.ifft(&mut engine)?;
let z = x.ifft_with(&FftOptions::default().axis(0), &mut engine)?;
assert_eq!(y.shape(), &[4]);
assert_eq!(z.shape(), &[4]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(2.5, 0.0)).norm() < 1e-12);Sourcefn rfft(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn rfft( &self, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
One-axis transform of a real signal, returning the one-sided spectrum.
Uses the default FftOptions; same as rfft_with with &FftOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64])?;
let y = x.rfft(&mut engine)?;
let z = x.rfft_with(&FftOptions::default().axis(0), &mut engine)?;
assert_eq!(y.shape(), &[3]);
assert_eq!(z.shape(), &[3]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(10.0, 0.0)).norm() < 1e-12);Sourcefn rfft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn rfft_with( &self, options: &FftOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
One-axis transform of a real signal, returning the one-sided spectrum.
With explicit FftOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![4], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64])?;
let y = x.rfft(&mut engine)?;
let z = x.rfft_with(&FftOptions::default().axis(0), &mut engine)?;
assert_eq!(y.shape(), &[3]);
assert_eq!(z.shape(), &[3]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(10.0, 0.0)).norm() < 1e-12);Sourcefn irfft(&self, exec: &mut dyn Engine) -> Result<<Self::Repr as FftRepr>::Real>
fn irfft(&self, exec: &mut dyn Engine) -> Result<<Self::Repr as FftRepr>::Real>
Inverse of rfft: a one-sided spectrum back to a real signal.
Uses the default FftOptions; same as irfft_with with &FftOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
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 = x.irfft(&mut engine)?;
let z = x.irfft_with(&FftOptions::default().n(Some(4)), &mut engine)?;
assert_eq!(y.shape(), &[4]);
assert_eq!(z.shape(), &[4]);
let v = y.as_slice::<f64>()?[0];
assert!((v - 2.0).abs() < 1e-12);Sourcefn irfft_with(
&self,
options: &FftOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Real>
fn irfft_with( &self, options: &FftOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Real>
Inverse of rfft: a one-sided spectrum back to a real signal.
With explicit FftOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
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 = x.irfft(&mut engine)?;
let z = x.irfft_with(&FftOptions::default().n(Some(4)), &mut engine)?;
assert_eq!(y.shape(), &[4]);
assert_eq!(z.shape(), &[4]);
let v = y.as_slice::<f64>()?[0];
assert!((v - 2.0).abs() < 1e-12);Sourcefn fftn(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn fftn( &self, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
N-dimensional discrete Fourier transform over axes (default every axis).
Uses the default FftnOptions; same as fftn_with with &FftnOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 2], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64])?;
let y = x.fftn(&mut engine)?;
let z = x.fftn_with(&FftnOptions::default().axes(vec![0, 1]), &mut engine)?;
assert_eq!(y.shape(), &[2, 2]);
assert_eq!(z.shape(), &[2, 2]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(10.0, 0.0)).norm() < 1e-12);Sourcefn fftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn fftn_with( &self, options: &FftnOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
N-dimensional discrete Fourier transform over axes (default every axis).
With explicit FftnOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 2], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64])?;
let y = x.fftn(&mut engine)?;
let z = x.fftn_with(&FftnOptions::default().axes(vec![0, 1]), &mut engine)?;
assert_eq!(y.shape(), &[2, 2]);
assert_eq!(z.shape(), &[2, 2]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(10.0, 0.0)).norm() < 1e-12);Sourcefn ifftn(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn ifftn( &self, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
N-dimensional inverse discrete Fourier transform over axes.
Uses the default FftnOptions; same as ifftn_with with &FftnOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 2], vec![Complex64::new(1.0, 0.0), Complex64::new(2.0, 0.0), Complex64::new(3.0, 0.0), Complex64::new(4.0, 0.0)])?;
let y = x.ifftn(&mut engine)?;
let z = x.ifftn_with(&FftnOptions::default().axes(vec![0, 1]), &mut engine)?;
assert_eq!(y.shape(), &[2, 2]);
assert_eq!(z.shape(), &[2, 2]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(2.5, 0.0)).norm() < 1e-12);Sourcefn ifftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn ifftn_with( &self, options: &FftnOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
N-dimensional inverse discrete Fourier transform over axes.
With explicit FftnOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 2], vec![Complex64::new(1.0, 0.0), Complex64::new(2.0, 0.0), Complex64::new(3.0, 0.0), Complex64::new(4.0, 0.0)])?;
let y = x.ifftn(&mut engine)?;
let z = x.ifftn_with(&FftnOptions::default().axes(vec![0, 1]), &mut engine)?;
assert_eq!(y.shape(), &[2, 2]);
assert_eq!(z.shape(), &[2, 2]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(2.5, 0.0)).norm() < 1e-12);Sourcefn rfftn(
&self,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn rfftn( &self, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
N-dimensional transform of a real signal; the last transformed axis is one-sided.
Uses the default FftnOptions; same as rfftn_with with &FftnOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 4], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64, 5.0_f64, 6.0_f64, 7.0_f64, 8.0_f64])?;
let y = x.rfftn(&mut engine)?;
let z = x.rfftn_with(&FftnOptions::default().axes(vec![0, 1]), &mut engine)?;
assert_eq!(y.shape(), &[2, 3]);
assert_eq!(z.shape(), &[2, 3]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(36.0, 0.0)).norm() < 1e-12);Sourcefn rfftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Complex>
fn rfftn_with( &self, options: &FftnOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Complex>
N-dimensional transform of a real signal; the last transformed axis is one-sided.
With explicit FftnOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 4], vec![1.0_f64, 2.0_f64, 3.0_f64, 4.0_f64, 5.0_f64, 6.0_f64, 7.0_f64, 8.0_f64])?;
let y = x.rfftn(&mut engine)?;
let z = x.rfftn_with(&FftnOptions::default().axes(vec![0, 1]), &mut engine)?;
assert_eq!(y.shape(), &[2, 3]);
assert_eq!(z.shape(), &[2, 3]);
let v = y.as_slice::<Complex64>()?[0];
assert!((v - Complex64::new(36.0, 0.0)).norm() < 1e-12);Sourcefn irfftn(&self, exec: &mut dyn Engine) -> Result<<Self::Repr as FftRepr>::Real>
fn irfftn(&self, exec: &mut dyn Engine) -> Result<<Self::Repr as FftRepr>::Real>
Inverse of rfftn.
Uses the default FftnOptions; same as irfftn_with with &FftnOptions::default().
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 3], vec![Complex64::new(8.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0)])?;
let y = x.irfftn(&mut engine)?;
let z = x.irfftn_with(&FftnOptions::default().shape(Some(vec![2, 4])), &mut engine)?;
assert_eq!(y.shape(), &[2, 4]);
assert_eq!(z.shape(), &[2, 4]);
let v = y.as_slice::<f64>()?[0];
assert!((v - 1.0).abs() < 1e-12);Sourcefn irfftn_with(
&self,
options: &FftnOptions,
exec: &mut dyn Engine,
) -> Result<<Self::Repr as FftRepr>::Real>
fn irfftn_with( &self, options: &FftnOptions, exec: &mut dyn Engine, ) -> Result<<Self::Repr as FftRepr>::Real>
Inverse of rfftn.
With explicit FftnOptions.
§Layout
On the CPU provider a compact column-major operand is read in place; any other strided view (transposed, sliced, negative strides) is gathered once into a compact buffer of the same placement and dtype before the transform. The CUDA provider canonicalizes on the device. Operands stay on their device; nothing is transferred. The transform runs one one-axis transform per axis; the intermediate spectra stay on the device and the normalization is applied once to the whole transform.
§Errors
Returns an error of kind:
ValidationUnsupported
§Omissions
- lanes (
CpuEngine::with_lanes): an FFT on a lane engine returnsUnsupported
§Examples
use num_complex::Complex64;
use tenferro_cpu::CpuEngine;
use tenferro_fft::{FftOps, FftnOptions};
use tenferro_tensor::Tensor;
let mut engine = CpuEngine::serial();
let x = Tensor::from_vec_col_major(vec![2, 3], vec![Complex64::new(8.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0)])?;
let y = x.irfftn(&mut engine)?;
let z = x.irfftn_with(&FftnOptions::default().shape(Some(vec![2, 4])), &mut engine)?;
assert_eq!(y.shape(), &[2, 4]);
assert_eq!(z.shape(), &[2, 4]);
let v = y.as_slice::<f64>()?[0];
assert!((v - 1.0).abs() < 1e-12);Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".