Skip to main content

GuruPlan

Struct GuruPlan 

Source
pub struct GuruPlan<T: Float> { /* private fields */ }
Expand description

Guru interface for maximum flexibility.

Allows specifying arbitrary dimensions, strides, and batch parameters. This is the most general FFT interface, supporting:

  • Arbitrary transform dimensions (1D, 2D, 3D, ND)
  • Arbitrary strides for input and output
  • Batched transforms with arbitrary batch dimensions
  • In-place or out-of-place operation

§Example

use oxifft::{Complex, Direction, Flags, IoDim, Tensor};
use oxifft::api::GuruPlan;

// Create a batched 1D FFT: 10 transforms of size 256
let dims = Tensor::new(vec![IoDim::contiguous(256)]);
let howmany = Tensor::new(vec![IoDim::new(10, 256, 256)]); // 10 batches, stride=256

let mut input = vec![Complex::new(0.0, 0.0); 2560];
let mut output = vec![Complex::new(0.0, 0.0); 2560];

let plan = GuruPlan::<f64>::dft(
    &dims,
    &howmany,
    Direction::Forward,
    Flags::ESTIMATE,
).unwrap();

plan.execute(&input, &mut output);

Implementations§

Source§

impl<T: Float> GuruPlan<T>

Source

pub fn dft( dims: &Tensor, howmany: &Tensor, direction: Direction, flags: Flags, ) -> Option<Self>

Create a guru DFT plan with full control over dimensions and strides.

§Arguments
  • dims - Transform dimensions with input/output strides
  • howmany - Batch dimensions (vector rank). Can be empty for single transform.
  • direction - Forward or Backward
  • flags - Planning flags
§Returns

A plan that can be executed on buffers with the specified layout. Returns None if any dimension has size 0.

§Memory Layout
  • dims specifies the transform dimensions (innermost dimensions transform)
  • howmany specifies the batch dimensions (outermost dimensions iterate)
  • Strides can be different for input and output (for in-place: use same strides)
Source

pub fn dims(&self) -> &Tensor

Get the transform dimensions.

Source

pub fn howmany(&self) -> &Tensor

Get the batch dimensions.

Source

pub fn direction(&self) -> Direction

Get the transform direction.

Source

pub fn transform_size(&self) -> usize

Get the total number of elements in one transform.

Source

pub fn batch_count(&self) -> usize

Get the total number of transforms (batch count).

Source

pub fn execute(&self, input: &[Complex<T>], output: &mut [Complex<T>])

Execute the guru plan on the given buffers.

§Arguments
  • input - Input buffer with layout matching dims and howmany
  • output - Output buffer with layout matching dims and howmany
§Panics

Panics if buffers are too small for the specified layout.

Source

pub fn execute_inplace(&self, data: &mut [Complex<T>])

Execute the plan in-place.

For in-place execution, input and output strides must be identical.

Auto Trait Implementations§

§

impl<T> Freeze for GuruPlan<T>

§

impl<T> RefUnwindSafe for GuruPlan<T>
where T: RefUnwindSafe,

§

impl<T> Send for GuruPlan<T>

§

impl<T> Sync for GuruPlan<T>

§

impl<T> Unpin for GuruPlan<T>

§

impl<T> UnwindSafe for GuruPlan<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.