|
25 | 25 | 6. Implementation of multi-controlled-Toffoli gates using ancillas to lower the C-NOT count. |
26 | 26 | 7. [Raban] Extend Stateprepration scheme for small Schmidt rank |
27 | 27 | *) |
28 | | -(*ToFix: |
29 | | -1. XYXDec can return a ZYZ output, e.g. for |
30 | | -{{0.7065332001434155` + 0.01331469739672239` I, |
31 | | - 0.4888081996161278` - |
32 | | - 0.5115663201544624` I}, {0.5440477104845266` - |
33 | | - 0.45237776762887333` I, -0.03542548508468498` + |
34 | | - 0.7057701318971897` I}} |
35 | | -This seems to be due to the Simp->True default option; running with Simp->False gives the expected behaviour. |
36 | | -*) |
37 | 28 |
|
38 | 29 | (*Methods to handle and simplify gate sequence*) |
39 | 30 | (*CreateIsometryFromList::usage="CreateIsometryFromList[st,(n)] creates the operator corresponding to the list (optionally, the total number of qubits n can be determined)." |
|
1325 | 1316 | Null,actionQ=1, |
1326 | 1317 | _,actionQ=action |
1327 | 1318 | ]; |
1328 | | -st={{zType,angles[[3]],actionQ},{yType,angles[[2]],actionQ},{zType,angles[[1]],actionQ}}; |
| 1319 | +st={Rz[angles[[3]],actionQ],Ry[angles[[2]],actionQ],Rz[angles[[1]],actionQ]}; |
1329 | 1320 | If[OptionValue[Simp], |
1330 | | -st=SimplifyGateListReverseGateOrder[st] |
| 1321 | +If[Chop[st[[2]][[2]]]==0, |
| 1322 | +st={Rz[angles[[3]]+angles[[1]],actionQ]}; |
| 1323 | +]; |
| 1324 | +st=DeleteCases[st,x_/;Chop[x[[2]]]==0]; |
1331 | 1325 | ]; |
1332 | 1326 | Reverse[st] |
1333 | 1327 | ) |
|
1344 | 1338 | ]; |
1345 | 1339 | st={{xType,angles[[3]],actionQ},{yType,angles[[2]],actionQ},{xType,angles[[1]],actionQ}}; |
1346 | 1340 | If[OptionValue[Simp], |
1347 | | -st=SimplifyGateListReverseGateOrder[st] |
| 1341 | +If[Chop[st[[2]][[2]]]==0, |
| 1342 | +st={Rx[angles[[3]]+angles[[1]],actionQ]}; |
| 1343 | +]; |
| 1344 | +st=DeleteCases[st,x_/;Chop[x[[2]]]==0]; |
1348 | 1345 | ]; |
1349 | 1346 | Reverse[st] |
1350 | 1347 | ) |
|
1359 | 1356 | _,actionQ=action |
1360 | 1357 | ]; |
1361 | 1358 | st={{zType,angles[[3]],actionQ},{xType,angles[[2]],actionQ},{zType,angles[[1]],actionQ}}; |
1362 | | - (*If[OptionValue[Simp], |
1363 | | - st=SimplifyGateListReverseGateOrder[st] |
1364 | | - ];*)(*This simplification makes the decomposition to become a ZYZ instead...*) |
| 1359 | + If[OptionValue[Simp], |
| 1360 | +If[Chop[st[[2]][[2]]]==0, |
| 1361 | +st={Rz[angles[[3]]+angles[[1]],actionQ]}; |
| 1362 | +]; |
| 1363 | +st=DeleteCases[st,x_/;Chop[x[[2]]]==0]; |
| 1364 | +]; |
1365 | 1365 | Reverse[st] |
1366 | 1366 | )] |
1367 | 1367 |
|
|
1374 | 1374 | _,actionQ=action |
1375 | 1375 | ]; |
1376 | 1376 | st={{xType,angles[[3]],actionQ},{zType,angles[[2]],actionQ},{xType,angles[[1]],actionQ}}; |
1377 | | - (*If[OptionValue[Simp], |
1378 | | - st=SimplifyGateListReverseGateOrder[st] |
1379 | | - ];*)(*This simplification makes the decomposition to become a ZYZ instead...*) |
| 1377 | + If[OptionValue[Simp], |
| 1378 | +If[Chop[st[[2]][[2]]]==0, |
| 1379 | +st={Rx[angles[[3]]+angles[[1]],actionQ]}; |
| 1380 | +]; |
| 1381 | +st=DeleteCases[st,x_/;Chop[x[[2]]]==0]; |
| 1382 | +]; |
1380 | 1383 | Reverse[st] |
1381 | 1384 | )] |
1382 | 1385 |
|
|
1389 | 1392 | _,actionQ=action |
1390 | 1393 | ]; |
1391 | 1394 | st={{yType,angles[[3]],actionQ},{xType,angles[[2]],actionQ},{yType,angles[[1]],actionQ}}; |
1392 | | - (*If[OptionValue[Simp], |
1393 | | - st=SimplifyGateListReverseGateOrder[st] |
1394 | | - ];*)(*This simplification makes the decomposition to become a ZYZ instead...*) |
| 1395 | + If[OptionValue[Simp], |
| 1396 | +If[Chop[st[[2]][[2]]]==0, |
| 1397 | +st={Ry[angles[[3]]+angles[[1]],actionQ]}; |
| 1398 | +]; |
| 1399 | +st=DeleteCases[st,x_/;Chop[x[[2]]]==0]; |
| 1400 | +]; |
1395 | 1401 | Reverse[st] |
1396 | 1402 | )] |
1397 | 1403 |
|
|
1404 | 1410 | _,actionQ=action |
1405 | 1411 | ]; |
1406 | 1412 | st={{yType,angles[[3]],actionQ},{zType,angles[[2]],actionQ},{yType,angles[[1]],actionQ}}; |
1407 | | - (*If[OptionValue[Simp], |
1408 | | - st=SimplifyGateListReverseGateOrder[st] |
1409 | | - ];*)(*This simplification makes the decomposition to become a ZYZ instead...*) |
| 1413 | + If[OptionValue[Simp], |
| 1414 | +If[Chop[st[[2]][[2]]]==0, |
| 1415 | +st={Ry[angles[[3]]+angles[[1]],actionQ]}; |
| 1416 | +]; |
| 1417 | +st=DeleteCases[st,x_/;Chop[x[[2]]]==0]; |
| 1418 | +]; |
1410 | 1419 | Reverse[st] |
1411 | 1420 | )] |
1412 | 1421 |
|
|
0 commit comments