Skip to content

Commit 3c81961

Browse files
authored
Update docs/tutorials/google/start.pynb (#6346)
* Update docs/tutorials/google/start.pynb * address comments
1 parent 9a8298d commit 3c81961

File tree

1 file changed

+58
-15
lines changed

1 file changed

+58
-15
lines changed

Diff for: docs/tutorials/google/start.ipynb

+58-15
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,62 @@
346346
"print(hw_circuit)"
347347
]
348348
},
349+
{
350+
"cell_type": "markdown",
351+
"source": [
352+
"Among these best practices, we will highlight two important ones.\n",
353+
"\n",
354+
"First, if your circuit uses more than one qubit, you can map the circuit onto the grid of the quantum processor in a way that accounts for its topology. You can do this as follows:"
355+
],
356+
"metadata": {
357+
"id": "e-tOIGJD9c9_"
358+
}
359+
},
360+
{
361+
"cell_type": "code",
362+
"source": [
363+
"device_graph = device.metadata.nx_graph\n",
364+
"router = cirq.RouteCQC(device_graph)\n",
365+
"hw_circuit = router(circuit)\n",
366+
"print(hw_circuit)"
367+
],
368+
"metadata": {
369+
"id": "LQh5D_Mx9hvk"
370+
},
371+
"execution_count": null,
372+
"outputs": []
373+
},
374+
{
375+
"cell_type": "markdown",
376+
"source": [
377+
"Second, if your quantum processor is calibrated to do a specific set of gates, you will need to transform your circuit into that gateset. For example, for a CZ gateset, you can do the following."
378+
],
379+
"metadata": {
380+
"id": "3An1Uo6F9vxS"
381+
}
382+
},
383+
{
384+
"cell_type": "code",
385+
"source": [
386+
"gateset = cirq.CZTargetGateset(allow_partial_czs=True)\n",
387+
"transformed_circuit = cirq.optimize_for_target_gateset(hw_circuit, gateset=gateset)\n",
388+
"print(transformed_circuit)"
389+
],
390+
"metadata": {
391+
"id": "muJ-dprf9_HC"
392+
},
393+
"execution_count": null,
394+
"outputs": []
395+
},
396+
{
397+
"cell_type": "markdown",
398+
"source": [
399+
"Other gatesets and considerations are included in the [best practices guide](https://quantumai.google/cirq/google/best_practices)."
400+
],
401+
"metadata": {
402+
"id": "hmIT53Yv5RR1"
403+
}
404+
},
349405
{
350406
"cell_type": "markdown",
351407
"metadata": {
@@ -506,20 +562,7 @@
506562
],
507563
"metadata": {
508564
"colab": {
509-
"provenance": [
510-
{
511-
"file_id": "1LRMd6swNPz1MTIH5h4h0q4Myy_1OrX_z",
512-
"timestamp": 1698983271770
513-
},
514-
{
515-
"file_id": "1uhNB-LrdQP0sGhN8IduD-gIGqVDpEPPx",
516-
"timestamp": 1698857208369
517-
},
518-
{
519-
"file_id": "https://github.com/quantumlib/Cirq/blob/master/docs/tutorials/google/start.ipynb",
520-
"timestamp": 1698798504321
521-
}
522-
]
565+
"provenance": []
523566
},
524567
"kernelspec": {
525568
"display_name": "Python 3",
@@ -528,4 +571,4 @@
528571
},
529572
"nbformat": 4,
530573
"nbformat_minor": 0
531-
}
574+
}

0 commit comments

Comments
 (0)