Helper functions in HadaMAG.jl

HadaMAG.build_tmp!Method
build_tmp!(tmp1, tmp2, X)

Compute tmp1 = real(X)+imag(X), tmp2 = imag(X)-real(X) in place. X is the complex state vector (length = 2^L).

source
HadaMAG.call_fht!Method
call_fht!(vec::Vector{Float64}, L::Int32)

In-place fast Hadamard transform using the currently active backend.

source
HadaMAG.haar_random_unitaryFunction
haar_random_unitary(q::Int, n_qudits::Integer, rng::AbstractRNG = Random.GLOBAL_RNG)

Generate a Haar-distributed random unitary matrix of size q^nqudits × q^nqudits.

Arguments

  • q::Int: local dimension (2 for qubits, 3 for qutrits).
  • n_qudits::Integer: number of qubits; the output U lives in U(2^n_qubits).
  • rng::AbstractRNG: random number generator (defaults to GLOBAL_RNG).
source
HadaMAG.use_fht_libMethod
use_fht_lib(path::String)

Use a custom .so that exports :fht_double. Overrides any other backend.

source
HadaMAG.use_jll_fhtMethod
use_jll_fht()

Switch to the FastHadamardStructuredTransforms_jll backend (x86 only). Throws on unsupported platforms.

source