Bitwise Invert
The bitwise inversion operation receives a quantum register representing some number \(x\), and inverts its binary representation, namely, replaces \(1\)s by \(0\)s and vice versa.
Example
from classiq import *
@qfunc
def main(x: Output[QNum], y: Output[QNum]) -> None:
prepare_int(6, x)
y |= ~x
qmod = create_model(main, out_file="bitwise_invert_example")
qprog = synthesize(qmod)
result = execute(qprog).result_value()
print(result.counts_of_multiple_outputs(["x", "y"]))
{('011', '100'): 1000}