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).
HadaMAG.call_fht! — Method
call_fht!(vec::Vector{Float64}, L::Int32)In-place fast Hadamard transform using the currently active backend.
HadaMAG.fht_backend — Method
fht_backend()Return the currently active FHT backend.
HadaMAG.haar_random_unitary — Function
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 toGLOBAL_RNG).
HadaMAG.integrate_simpson_uniform — Method
integrate_simpson_uniform(x, y) -> Float64Simpson's rule on a uniform grid x. Requires an odd number of points.
HadaMAG.use_default_fht — Method
use_default_fht()Revert to whichever backend was auto-selected at load time.
HadaMAG.use_fht_lib — Method
use_fht_lib(path::String)Use a custom .so that exports :fht_double. Overrides any other backend.
HadaMAG.use_jll_fht — Method
use_jll_fht()Switch to the FastHadamardStructuredTransforms_jll backend (x86 only). Throws on unsupported platforms.
HadaMAG.use_julia_fht — Method
use_julia_fht()Switch to the pure Julia + LoopVectorization backend (works on all platforms).