Skip to content
Open
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
2 changes: 2 additions & 0 deletions tests/resources/timeouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ hamiltonian_simulation_guide_trotter.qmod: 300
hamiltonian_simulation_qsvt.qmod: 300
hamiltonian_simulation_qubitization.qmod: 300
hamiltonian_simulation_with_block_encoding.ipynb: 900
hamming_weights.qmod: 1799
hamming_weights_compilation_workshop.ipynb: 1799
hardware_aware_mcx.ipynb: 56
hardware_aware_mcx_all_to_all.qmod: 36
hardware_aware_mcx_grid.qmod: 10
Expand Down
12 changes: 12 additions & 0 deletions tests/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": [
"id",
"t",
"s",
"cz",
"u",
"rz",
"u1",
"sx",
"cy",
"u2",
"ry",
"tdg",
"r",
"cx",
"sxdg",
"rx",
"sdg",
"y",
"x",
"h",
"p",
"z"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"machine_precision": 8,
"optimization_level": 1,
"output_format": ["qasm"],
"pretty_qasm": true,
"random_seed": 192315740,
"synthesize_all_separately": false,
"timeout_seconds": 300,
"transpilation_option": "auto optimize"
}
}
Loading
Loading