Fourier 变换与算术

oracq.algorithms.common.fourier

Forward and inverse Fourier transforms, interface adapters, and modular addition without a carry register.

oracq.algorithms.common.fourier.qft(width)[源代码]

Generate the positive-sign discrete Fourier transform.

参数:

width -- Target bit width, in the range 1..64.

返回:

Has only a target register, includes the trailing swaps, and the bit order is little endian.

返回类型:

Operation

The matrix elements are exp(2πi*x*y/2**width)/sqrt(2**width).

oracq.algorithms.common.fourier.qft_with_work(width)[源代码]

QFT adapter preserving the earlier zero-width work interface.

参数:

width -- Target bit width, in the range 1..64.

返回:

QFT operation that additionally carries a zero-width work register besides target.

返回类型:

Operation

oracq.algorithms.common.fourier.inverse_qft(width)[源代码]

Generate the adjoint of the QFT, keeping the module call.

参数:

width -- Target bit width, in the range 1..64.

返回:

Inverse QFT operation wrapped in an adjoint module call.

返回类型:

Operation

oracq.algorithms.common.fourier.fourier_add(width)[源代码]

Modular addition without a carry register, implemented with the QFT.

参数:

width -- Common bit width of a and b.

返回:

|a,b> -> |a,(a+b) mod 2**width>. a is preserved and there is no additional public workspace.

返回类型:

Operation

The Fourier transform and its inverse are kept as module calls.