API Reference#

pytorch_finufft.functional.finufft_type1(points: Tensor, values: Tensor, output_shape: int | Tuple[int] | Tuple[int, int] | Tuple[int, int, int], **finufftkwargs: int | float) Tensor[source]#

Evaluates the Type 1 (nonuniform-to-uniform) NUFFT on the inputs.

This is a wrapper around finufft.nufft1d1(), finufft.nufft2d1(), and finufft.nufft3d1() on CPU, and cufinufft.nufft1d1(), cufinufft.nufft2d1(), and cufinufft.nufft3d1() on GPU.

Parameters:
  • points (torch.Tensor) – DxN tensor of locations of the non-uniform points. Points must lie in the range [-3pi, 3pi].

  • values (torch.Tensor) – Complex-valued tensor of values at the non-uniform points. All dimensions except the final dimension are treated as batch dimensions. The final dimension must have size N.

  • output_shape (int | tuple(int, ...)) – Requested output shape of Fourier modes. Must be a tuple of length D or an integer (1D only).

  • **finufftkwargs (int | float) –

    Additional keyword arguments are forwarded to the underlying FINUFFT functions. A few notable options are

    • eps: precision requested (default: 1e-6)

    • modeord: 0 for FINUFFT default, 1 for Pytorch default (default: 1)

    • isign: Sign of the exponent in the Fourier transform (default: -1)

Returns:

Tensor with shape *[batch], *output_shape containing the Fourier transform of the values.

Return type:

torch.Tensor

pytorch_finufft.functional.finufft_type2(points: Tensor, targets: Tensor, **finufftkwargs: int | float) Tensor[source]#

Evaluates the Type 2 (uniform-to-nonuniform) NUFFT on the inputs.

This is a wrapper around finufft.nufft1d2(), finufft.nufft2d2(), and finufft.nufft3d2() on CPU, and cufinufft.nufft1d2(), cufinufft.nufft2d2(), and cufinufft.nufft3d2() on GPU.

Parameters:
  • points (torch.Tensor) – DxN tensor of locations of the non-uniform points. Points must lie in the range [-3pi, 3pi].

  • targets (torch.Tensor) – Complex-valued tensor of Fourier modes to evaluate at the points. The final D dimensions must contain the Fourier modes, and any preceding dimensions are treated as batch dimensions.

  • **finufftkwargs (int | float) –

    Additional keyword arguments are forwarded to the underlying FINUFFT functions. A few notable options are

    • eps: precision requested (default: 1e-6)

    • modeord: 0 for FINUFFT default, 1 for Pytorch default (default: 1)

    • isign: Sign of the exponent in the Fourier transform (default: -1)

Returns:

A [batch]xDxN tensor of values at the non-uniform points.

Return type:

torch.Tensor