Skip to content

Hadamard Transform

View on GitHub Experiment in the IDE

The Hadamard transform function applies an H gate on each qubit of the register inputted to the function.

Function: hadamard_transform

Arguments:

  • target: QArray[QBit]

The target quantum argument is the quantum state on which we apply the Hadamard Transform.

Example

from classiq import (
    Output,
    QArray,
    QBit,
    allocate,
    create_model,
    hadamard_transform,
    qfunc,
)


@qfunc
def main(x: Output[QArray[QBit]]):

    allocate(3, x)
    hadamard_transform(x)


qmod = create_model(main)
from classiq import synthesize, write_qmod

write_qmod(qmod, "hadamard_transform")
qprog = synthesize(qmod)