Skip to content

Commit d7f218c

Browse files
committed
fixed cooling systems uncomputation
1 parent d6b4921 commit d7f218c

File tree

5 files changed

+63
-60
lines changed

5 files changed

+63
-60
lines changed

applications/automotive/cooling_systems_optimization/block_encoding.synthesis_options.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
"preferences": {
77
"custom_hardware_settings": {
88
"basis_gates": [
9-
"tdg",
10-
"u1",
11-
"id",
12-
"x",
139
"rz",
14-
"h",
15-
"r",
16-
"y",
1710
"ry",
18-
"u",
19-
"cz",
2011
"cx",
12+
"u",
13+
"s",
2114
"t",
15+
"sx",
16+
"z",
17+
"y",
18+
"id",
19+
"cz",
2220
"cy",
23-
"s",
21+
"tdg",
22+
"r",
2423
"p",
24+
"x",
2525
"sdg",
26+
"u1",
27+
"h",
28+
"rx",
2629
"u2",
27-
"z",
28-
"sxdg",
29-
"sx",
30-
"rx"
30+
"sxdg"
3131
],
3232
"is_symmetric_connectivity": true
3333
},
@@ -36,7 +36,7 @@
3636
"optimization_level": 0,
3737
"output_format": ["qasm"],
3838
"pretty_qasm": true,
39-
"random_seed": 1095822036,
39+
"random_seed": 2436614125,
4040
"synthesize_all_separately": false,
4141
"timeout_seconds": 14400,
4242
"transpilation_option": "none"

applications/automotive/cooling_systems_optimization/cooling_systems_optimization.ipynb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@
528528
"name": "stdout",
529529
"output_type": "stream",
530530
"text": [
531-
"Quantum program link: https://platform.classiq.io/circuit/35Ymmdx4Nd4yMDLkrEFuj3x5jfq\n"
531+
"Quantum program link: https://platform.classiq.io/circuit/36Kv3IHzCrF6u4tlpAq5B1HR8Si\n"
532532
]
533533
}
534534
],
@@ -800,7 +800,7 @@
800800
"name": "stdout",
801801
"output_type": "stream",
802802
"text": [
803-
"Quantum program link: https://platform.classiq.io/circuit/35YmvV3AiErG6tre2cgDPt1W8eT\n"
803+
"Quantum program link: https://platform.classiq.io/circuit/36KvCqUGkELsrxHNs9Qxdqc4oeP\n"
804804
]
805805
}
806806
],
@@ -854,7 +854,7 @@
854854
"name": "stdout",
855855
"output_type": "stream",
856856
"text": [
857-
"QSVT solution: [2.02991919 3.19791738 0.90593325 2.02250168]\n",
857+
"QSVT solution: [1.57739789 2.77684905 0.27102853 0.84553989]\n",
858858
"Classical solution: [1.60481928 2.84578313 0.25179803 0.90240044]\n"
859859
]
860860
}
@@ -1274,7 +1274,7 @@
12741274
" )\n",
12751275
"\n",
12761276
"\n",
1277-
"@qfunc\n",
1277+
"@qperm\n",
12781278
"def phase_application(qae_phase: Const[QArray], gamma: CReal):\n",
12791279
" phase(\n",
12801280
" get_func_polynomial_expression(func, 1.0, n_phase_qubits, qae_phase),\n",
@@ -1287,9 +1287,9 @@
12871287
" magnitudes_list: list[list[float]],\n",
12881288
" phases_list: list[list[float]],\n",
12891289
" qae_phase: QArray,\n",
1290-
" reg: QNum,\n",
1290+
" reg: Const[QNum],\n",
1291+
" dummy_data: Output[QBit],\n",
12911292
"):\n",
1292-
" dummy_data = QBit()\n",
12931293
" full_qae = QArray()\n",
12941294
" allocate(dummy_data)\n",
12951295
" bind([qae_phase, dummy_data], full_qae)\n",
@@ -1305,9 +1305,10 @@
13051305
"\n",
13061306
"@qfunc\n",
13071307
"def dummy_cost_layer(qae_phase: QArray, reg: QArray, gamma: CReal) -> None:\n",
1308+
" dummy_data = QBit()\n",
13081309
" within_apply(\n",
13091310
" lambda: dummy_qae(\n",
1310-
" qae_amplitudes_magnitudes, qae_amplitudes_phases, qae_phase, reg\n",
1311+
" qae_amplitudes_magnitudes, qae_amplitudes_phases, qae_phase, reg, dummy_data\n",
13111312
" ),\n",
13121313
" lambda: phase_application(qae_phase, gamma),\n",
13131314
" )\n",
@@ -1325,7 +1326,8 @@
13251326
" allocate(n_phase_qubits, qae_phase)\n",
13261327
" hadamard_transform(reg)\n",
13271328
" for i in range(gammas.len):\n",
1328-
" qaoa_layer(qae_phase, reg, gammas[i], betas[i])"
1329+
" qaoa_layer(qae_phase, reg, gammas[i], betas[i])\n",
1330+
" drop(qae_phase)"
13291331
]
13301332
},
13311333
{
@@ -1338,7 +1340,7 @@
13381340
},
13391341
{
13401342
"cell_type": "code",
1341-
"execution_count": 21,
1343+
"execution_count": 24,
13421344
"id": "36",
13431345
"metadata": {},
13441346
"outputs": [
@@ -1368,7 +1370,7 @@
13681370
},
13691371
{
13701372
"cell_type": "code",
1371-
"execution_count": 24,
1373+
"execution_count": 25,
13721374
"id": "37",
13731375
"metadata": {},
13741376
"outputs": [
@@ -1377,7 +1379,7 @@
13771379
"output_type": "stream",
13781380
"text": [
13791381
"Polynomial Expression: 0.0980171403295606*x0\n",
1380-
"Quantum program link: https://platform.classiq.io/circuit/35Yp2wiJAN939cSLF2kJ7ikW9ek\n"
1382+
"Quantum program link: https://platform.classiq.io/circuit/36KvrBu70NXAUMj1I3QbOtV1zgM\n"
13811383
]
13821384
}
13831385
],

applications/automotive/cooling_systems_optimization/cooling_systems_optimization.qmod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ qfunc inplace_prepare_complex_amplitudes_expanded___2(magnitudes: real[], target
4444
}
4545

4646
@disable_perm_check
47-
qperm dummy_qae_expanded___0(qae_phase: qbit[1], reg: qnum<6, False, 0>) {
48-
dummy_data: qbit;
47+
qperm dummy_qae_expanded___0(qae_phase: qbit[1], const reg: qnum<6, False, 0>, output dummy_data: qbit) {
4948
full_qae: qbit[2];
5049
allocate(1, dummy_data);
5150
{qae_phase, dummy_data} -> full_qae;
@@ -554,13 +553,14 @@ qperm dummy_qae_expanded___0(qae_phase: qbit[1], reg: qnum<6, False, 0>) {
554553
full_qae -> {qae_phase, dummy_data};
555554
}
556555

557-
qfunc phase_application_expanded___0(const qae_phase: qbit[1], gamma: real) {
556+
qperm phase_application_expanded___0(const qae_phase: qbit[1], gamma: real) {
558557
phase (0.049 - (0.049 * qae_phase[0]), gamma);
559558
}
560559

561560
qfunc dummy_cost_layer_expanded___0(qae_phase: qbit[1], reg: qbit[6], gamma: real) {
561+
dummy_data: qbit;
562562
within {
563-
dummy_qae_expanded___0(qae_phase, reg);
563+
dummy_qae_expanded___0(qae_phase, reg, dummy_data);
564564
} apply {
565565
phase_application_expanded___0(qae_phase, gamma);
566566
}
@@ -582,6 +582,7 @@ qfunc qaoa_circuit_expanded___0(gammas: real[1], betas: real[1], reg: qbit[6]) {
582582
allocate(1, qae_phase);
583583
hadamard_transform_expanded___0(reg);
584584
qaoa_layer_expanded___0(qae_phase, reg, gammas[0], betas[0]);
585+
drop(qae_phase);
585586
}
586587

587588
qfunc main(gammas: real[1], betas: real[1], output reg: qbit[6]) {

applications/automotive/cooling_systems_optimization/cooling_systems_optimization.synthesis_options.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
"preferences": {
77
"custom_hardware_settings": {
88
"basis_gates": [
9-
"tdg",
10-
"u1",
11-
"id",
12-
"x",
139
"rz",
14-
"h",
15-
"r",
16-
"y",
1710
"ry",
18-
"u",
19-
"cz",
2011
"cx",
12+
"u",
13+
"s",
2114
"t",
15+
"sx",
16+
"z",
17+
"y",
18+
"id",
19+
"cz",
2220
"cy",
23-
"s",
21+
"tdg",
22+
"r",
2423
"p",
24+
"x",
2525
"sdg",
26+
"u1",
27+
"h",
28+
"rx",
2629
"u2",
27-
"z",
28-
"sxdg",
29-
"sx",
30-
"rx"
30+
"sxdg"
3131
],
3232
"is_symmetric_connectivity": true
3333
},
@@ -36,7 +36,7 @@
3636
"optimization_level": 1,
3737
"output_format": ["qasm"],
3838
"pretty_qasm": true,
39-
"random_seed": 2847864142,
39+
"random_seed": 1135456536,
4040
"synthesize_all_separately": false,
4141
"timeout_seconds": 14400,
4242
"transpilation_option": "none"

applications/automotive/cooling_systems_optimization/matrix_inverse.synthesis_options.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
"preferences": {
77
"custom_hardware_settings": {
88
"basis_gates": [
9-
"tdg",
10-
"u1",
11-
"id",
12-
"x",
139
"rz",
14-
"h",
15-
"r",
16-
"y",
1710
"ry",
18-
"u",
19-
"cz",
2011
"cx",
12+
"u",
13+
"s",
2114
"t",
15+
"sx",
16+
"z",
17+
"y",
18+
"id",
19+
"cz",
2220
"cy",
23-
"s",
21+
"tdg",
22+
"r",
2423
"p",
24+
"x",
2525
"sdg",
26+
"u1",
27+
"h",
28+
"rx",
2629
"u2",
27-
"z",
28-
"sxdg",
29-
"sx",
30-
"rx"
30+
"sxdg"
3131
],
3232
"is_symmetric_connectivity": true
3333
},
@@ -36,7 +36,7 @@
3636
"optimization_level": 1,
3737
"output_format": ["qasm"],
3838
"pretty_qasm": true,
39-
"random_seed": 1685164119,
39+
"random_seed": 661480079,
4040
"synthesize_all_separately": false,
4141
"timeout_seconds": 14400,
4242
"transpilation_option": "none"

0 commit comments

Comments
 (0)