Skip to content

Commit

Permalink
Update qmods
Browse files Browse the repository at this point in the history
  • Loading branch information
OriRothClassiq committed Dec 17, 2024
1 parent bb1143d commit 6b63cf6
Show file tree
Hide file tree
Showing 24 changed files with 325 additions and 220 deletions.
90 changes: 45 additions & 45 deletions algorithms/dqi/dqi_max_xorsat.qmod
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ qfunc binary_to_one_hot_expanded___0(input binary: qnum<2, False, 0>, output one
inplace_binary_to_one_hot_expanded___0(one_hot);
}

qfunc iteration_lambda___0_0_expanded___0(qvar___3_captured__inplace_one_hot_to_unary__5: qbit, qvar___2_captured__inplace_one_hot_to_unary__5: qbit) {
CX(qvar___3_captured__inplace_one_hot_to_unary__5, qvar___2_captured__inplace_one_hot_to_unary__5);
qfunc iteration_0_lambda___0_0_expanded___0(qvar___3_captured__inplace_one_hot_to_unary__4: qbit, qvar___2_captured__inplace_one_hot_to_unary__4: qbit) {
CX(qvar___3_captured__inplace_one_hot_to_unary__4, qvar___2_captured__inplace_one_hot_to_unary__4);
}

qfunc iteration_lambda___0_0_expanded___1(qvar___2_captured__inplace_one_hot_to_unary__5: qbit, qvar___1_captured__inplace_one_hot_to_unary__5: qbit) {
CX(qvar___2_captured__inplace_one_hot_to_unary__5, qvar___1_captured__inplace_one_hot_to_unary__5);
qfunc iteration_0_lambda___0_0_expanded___1(qvar___2_captured__inplace_one_hot_to_unary__4: qbit, qvar___1_captured__inplace_one_hot_to_unary__4: qbit) {
CX(qvar___2_captured__inplace_one_hot_to_unary__4, qvar___1_captured__inplace_one_hot_to_unary__4);
}

qfunc iteration_lambda___0_0_expanded___2(qvar___1_captured__inplace_one_hot_to_unary__5: qbit, qvar___0_captured__inplace_one_hot_to_unary__5: qbit) {
CX(qvar___1_captured__inplace_one_hot_to_unary__5, qvar___0_captured__inplace_one_hot_to_unary__5);
qfunc iteration_0_lambda___0_0_expanded___2(qvar___1_captured__inplace_one_hot_to_unary__4: qbit, qvar___0_captured__inplace_one_hot_to_unary__4: qbit) {
CX(qvar___1_captured__inplace_one_hot_to_unary__4, qvar___0_captured__inplace_one_hot_to_unary__4);
}

qfunc inplace_one_hot_to_unary_expanded___0(qvar: qbit[4]) {
iteration_lambda___0_0_expanded___0(qvar[3], qvar[2]);
iteration_lambda___0_0_expanded___1(qvar[2], qvar[1]);
iteration_lambda___0_0_expanded___2(qvar[1], qvar[0]);
iteration_0_lambda___0_0_expanded___0(qvar[3], qvar[2]);
iteration_0_lambda___0_0_expanded___1(qvar[2], qvar[1]);
iteration_0_lambda___0_0_expanded___2(qvar[1], qvar[0]);
X(qvar[0]);
}

Expand Down Expand Up @@ -165,37 +165,37 @@ qfunc prepare_dick_state_unary_input_expanded___5(qvar: qbit[6]) {
prepare_dick_state_unary_input_expanded___4(qvar[1:6]);
}

qfunc iteration_lambda___0_0_expanded___3(y___0_captured__vector_product_phase__3: qbit) {
Z(y___0_captured__vector_product_phase__3);
qfunc iteration_1_lambda___0_0_expanded___0(y___0_captured__vector_product_phase__2: qbit) {
Z(y___0_captured__vector_product_phase__2);
}

qfunc iteration_lambda___0_0_expanded___4(y___1_captured__vector_product_phase__3: qbit) {
Z(y___1_captured__vector_product_phase__3);
qfunc iteration_1_lambda___0_0_expanded___1(y___1_captured__vector_product_phase__2: qbit) {
Z(y___1_captured__vector_product_phase__2);
}

qfunc iteration_lambda___0_0_expanded___5(y___2_captured__vector_product_phase__3: qbit) {
Z(y___2_captured__vector_product_phase__3);
qfunc iteration_1_lambda___0_0_expanded___2(y___2_captured__vector_product_phase__2: qbit) {
Z(y___2_captured__vector_product_phase__2);
}

qfunc iteration_lambda___0_0_expanded___6(y___3_captured__vector_product_phase__3: qbit) {
Z(y___3_captured__vector_product_phase__3);
qfunc iteration_1_lambda___0_0_expanded___3(y___3_captured__vector_product_phase__2: qbit) {
Z(y___3_captured__vector_product_phase__2);
}

qfunc iteration_lambda___0_0_expanded___7(y___4_captured__vector_product_phase__3: qbit) {
Z(y___4_captured__vector_product_phase__3);
qfunc iteration_1_lambda___0_0_expanded___4(y___4_captured__vector_product_phase__2: qbit) {
Z(y___4_captured__vector_product_phase__2);
}

qfunc iteration_lambda___0_0_expanded___8(y___5_captured__vector_product_phase__3: qbit) {
Z(y___5_captured__vector_product_phase__3);
qfunc iteration_1_lambda___0_0_expanded___5(y___5_captured__vector_product_phase__2: qbit) {
Z(y___5_captured__vector_product_phase__2);
}

qfunc vector_product_phase_expanded___0(y: qbit[6]) {
iteration_lambda___0_0_expanded___3(y[0]);
iteration_lambda___0_0_expanded___4(y[1]);
iteration_lambda___0_0_expanded___5(y[2]);
iteration_lambda___0_0_expanded___6(y[3]);
iteration_lambda___0_0_expanded___7(y[4]);
iteration_lambda___0_0_expanded___8(y[5]);
iteration_1_lambda___0_0_expanded___0(y[0]);
iteration_1_lambda___0_0_expanded___1(y[1]);
iteration_1_lambda___0_0_expanded___2(y[2]);
iteration_1_lambda___0_0_expanded___3(y[3]);
iteration_1_lambda___0_0_expanded___4(y[4]);
iteration_1_lambda___0_0_expanded___5(y[5]);
}

qfunc matrix_vector_product_expanded___0(y: qbit[6], output out: qbit[6]) {
Expand Down Expand Up @@ -277,37 +277,37 @@ qfunc syndrome_decode_lookuptable_expanded___0(syndrome: qnum<6, False, 0>, erro
}
}

qfunc iteration_lambda___0_0_expanded___9(target___0_captured__apply_to_all__4: qbit) {
H(target___0_captured__apply_to_all__4);
qfunc iteration_2_lambda___0_0_expanded___0(target___0_captured__apply_to_all__3: qbit) {
H(target___0_captured__apply_to_all__3);
}

qfunc iteration_lambda___0_0_expanded___10(target___1_captured__apply_to_all__4: qbit) {
H(target___1_captured__apply_to_all__4);
qfunc iteration_2_lambda___0_0_expanded___1(target___1_captured__apply_to_all__3: qbit) {
H(target___1_captured__apply_to_all__3);
}

qfunc iteration_lambda___0_0_expanded___11(target___2_captured__apply_to_all__4: qbit) {
H(target___2_captured__apply_to_all__4);
qfunc iteration_2_lambda___0_0_expanded___2(target___2_captured__apply_to_all__3: qbit) {
H(target___2_captured__apply_to_all__3);
}

qfunc iteration_lambda___0_0_expanded___12(target___3_captured__apply_to_all__4: qbit) {
H(target___3_captured__apply_to_all__4);
qfunc iteration_2_lambda___0_0_expanded___3(target___3_captured__apply_to_all__3: qbit) {
H(target___3_captured__apply_to_all__3);
}

qfunc iteration_lambda___0_0_expanded___13(target___4_captured__apply_to_all__4: qbit) {
H(target___4_captured__apply_to_all__4);
qfunc iteration_2_lambda___0_0_expanded___4(target___4_captured__apply_to_all__3: qbit) {
H(target___4_captured__apply_to_all__3);
}

qfunc iteration_lambda___0_0_expanded___14(target___5_captured__apply_to_all__4: qbit) {
H(target___5_captured__apply_to_all__4);
qfunc iteration_2_lambda___0_0_expanded___5(target___5_captured__apply_to_all__3: qbit) {
H(target___5_captured__apply_to_all__3);
}

qfunc apply_to_all_expanded___0(target: qbit[6]) {
iteration_lambda___0_0_expanded___9(target[0]);
iteration_lambda___0_0_expanded___10(target[1]);
iteration_lambda___0_0_expanded___11(target[2]);
iteration_lambda___0_0_expanded___12(target[3]);
iteration_lambda___0_0_expanded___13(target[4]);
iteration_lambda___0_0_expanded___14(target[5]);
iteration_2_lambda___0_0_expanded___0(target[0]);
iteration_2_lambda___0_0_expanded___1(target[1]);
iteration_2_lambda___0_0_expanded___2(target[2]);
iteration_2_lambda___0_0_expanded___3(target[3]);
iteration_2_lambda___0_0_expanded___4(target[4]);
iteration_2_lambda___0_0_expanded___5(target[5]);
}

qfunc hadamard_transform_expanded___0(target: qbit[6]) {
Expand Down
38 changes: 18 additions & 20 deletions algorithms/dqi/dqi_max_xorsat.synthesis_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,37 @@
"machine_precision": 8,
"custom_hardware_settings": {
"basis_gates": [
"z",
"rz",
"cx",
"h",
"u1",
"p",
"cy",
"r",
"id",
"y",
"sdg",
"x",
"u2",
"sx",
"s",
"ry",
"cx",
"rz",
"h",
"rx",
"y",
"cy",
"tdg",
"cz",
"ry",
"u2",
"u",
"rx",
"x",
"cz",
"z",
"sxdg",
"sdg",
"t",
"sx",
"sxdg"
"p",
"id"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"synthesize_all_separately": false,
"output_format": [
"qasm"
],
"output_format": ["qasm"],
"pretty_qasm": true,
"transpilation_option": "auto optimize",
"timeout_seconds": 300,
"random_seed": 3679731798
"random_seed": -1
}
}
2 changes: 1 addition & 1 deletion algorithms/grover/3_sat_grover/3_sat_grover.qmod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ qfunc sat_oracle(x: qbit[], res: qbit) {
}

qfunc main(output x: qbit[3]) {
allocate(3, x);
allocate(x.len, x);
grover_search(1, lambda(vars) {
phase_oracle(sat_oracle, vars);
}, x);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
{
"constraints": {
"max_width": 20
"max_width": 20,
"max_gate_count": {},
"optimization_parameter": "no_opt"
},
"preferences": {
"machine_precision": 8,
"custom_hardware_settings": {
"basis_gates": [
"rz",
"cx",
"h",
"u1",
"r",
"sx",
"s",
"rx",
"y",
"cy",
"tdg",
"ry",
"u2",
"u",
"x",
"cz",
"z",
"sxdg",
"sdg",
"t",
"p",
"id"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"synthesize_all_separately": false,
"output_format": ["qasm"],
"pretty_qasm": true,
"transpilation_option": "auto optimize",
"timeout_seconds": 300,
"random_seed": -1
}
}
2 changes: 1 addition & 1 deletion algorithms/grover/3_sat_grover/3_sat_grover_large.qmod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ qfunc sat_oracle_large(x: qbit[], res: qbit) {
}

qfunc main(output x: qbit[4]) {
allocate(4, x);
allocate(x.len, x);
grover_search(2, lambda(vars) {
phase_oracle(sat_oracle_large, vars);
}, x);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
{
"constraints": {
"max_width": 24
"max_width": 24,
"max_gate_count": {},
"optimization_parameter": "no_opt"
},
"preferences": {
"machine_precision": 8,
"custom_hardware_settings": {
"basis_gates": [
"rz",
"cx",
"h",
"u1",
"r",
"sx",
"s",
"rx",
"y",
"cy",
"tdg",
"ry",
"u2",
"u",
"x",
"cz",
"z",
"sxdg",
"sdg",
"t",
"p",
"id"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"synthesize_all_separately": false,
"output_format": ["qasm"],
"pretty_qasm": true,
"transpilation_option": "auto optimize",
"timeout_seconds": 300,
"random_seed": -1
}
}
2 changes: 1 addition & 1 deletion algorithms/grover/grover_max_cut/grover_max_cut.qmod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ qfunc cut_oracle(cut_size: int, nodes: qbit[], res: qbit) {
}

qfunc main(output nodes: qbit[5]) {
allocate(5, nodes);
allocate(nodes.len, nodes);
grover_search(3, lambda(vars) {
phase_oracle(lambda(vars, res) {
cut_oracle(4, vars, res);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
{
"constraints": {
"max_width": 22
"max_width": 22,
"max_gate_count": {},
"optimization_parameter": "no_opt"
},
"preferences": {
"machine_precision": 8,
"custom_hardware_settings": {
"basis_gates": [
"rz",
"cx",
"h",
"u1",
"r",
"sx",
"s",
"rx",
"y",
"cy",
"tdg",
"ry",
"u2",
"u",
"x",
"cz",
"z",
"sxdg",
"sdg",
"t",
"p",
"id"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"synthesize_all_separately": false,
"output_format": ["qasm"],
"pretty_qasm": true,
"transpilation_option": "auto optimize",
"timeout_seconds": 300,
"random_seed": -1
}
}
12 changes: 6 additions & 6 deletions algorithms/hhl/hhl/hhl_exact.qmod
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
qfunc unitary_with_power_logic(pw: int, matrix: real[][], target: qbit[]) {
power (pw) {
unitary(matrix, target);
}
}

qfunc load_b(amplitudes: real[], output state: qbit[], bound: real) {
prepare_amplitudes(amplitudes, bound, state);
}
Expand All @@ -30,6 +24,12 @@ qfunc hhl(rhs_vector: real[], bound: real, precision: int, hamiltonian_evolution
}
}

qfunc unitary_with_power_logic(pw: int, matrix: real[][], target: qbit[]) {
power (pw) {
unitary(matrix, target);
}
}

qfunc main(output res: qnum, output phase: qnum, output indicator: qbit) {
hhl([
0.18257418583505536,
Expand Down
Loading

0 comments on commit 6b63cf6

Please sign in to comment.