Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/notebooks/test_hamming_weights_compilation_workshop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from tests.utils_for_testbook import (
validate_quantum_program_size,
validate_quantum_model,
wrap_testbook,
)
from testbook.client import TestbookNotebookClient


@wrap_testbook("hamming_weights_compilation_workshop", timeout_seconds=1801)
def test_notebook(tb: TestbookNotebookClient) -> None:
# test notebook content
pass # Todo
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
qstruct PermutationStruct {
lsb: qbit[3];
target: qbit;
msb: qbit;
}

qfunc copy_var(x: qnum, y: qnum) {
y ^= x;
}

qfunc set_target(target: qbit, lsb: qbit[3]) {
target ^= ((lsb[0] + lsb[1]) + lsb[2]) == 2;
}

qfunc unitary_permute(x: PermutationStruct) {
control (x.msb == 0) {
set_target(x.target, x.lsb);
}
}

qfunc main(output result: qnum, output reference: qnum) {
allocate(5, result);
allocate(5, reference);
hadamard_transform(result);
copy_var(result, reference);
unitary_permute(result);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"constraints": {
"max_gate_count": {},
"optimization_parameter": "no_opt"
},
"preferences": {
"custom_hardware_settings": {
"basis_gates": [
"cz",
"u1",
"u2",
"rx",
"tdg",
"sdg",
"cx",
"ry",
"t",
"id",
"p",
"rz",
"z",
"cy",
"sxdg",
"h",
"u",
"r",
"x",
"s",
"y",
"sx"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"machine_precision": 8,
"optimization_level": 1,
"output_format": ["qasm"],
"pretty_qasm": true,
"random_seed": 3940793967,
"synthesize_all_separately": false,
"timeout_seconds": 300,
"transpilation_option": "auto optimize"
}
}
Loading
Loading