|
485 | 485 | }, |
486 | 486 | "source": [ |
487 | 487 | "As mentioned, methods such as `_unitary_` which we have seen are known as \"magic\n", |
488 | | - "methods.\" Much of cirq relies on \"magic methods\", which are methods prefixed with one or\n", |
489 | | - "two underscores and used by cirq's protocols or built-in python methods.\n", |
490 | | - "For instance, python translates `cirq.Z**0.25` into\n", |
| 488 | + "methods.\" Much of Cirq relies on \"magic methods\", which are methods prefixed with one or\n", |
| 489 | + "two underscores and used by Cirq's protocols or built-in Python methods.\n", |
| 490 | + "For instance, Python translates `cirq.Z**0.25` into\n", |
491 | 491 | "`cirq.Z.__pow__(0.25)`. Other uses are specific to cirq and are found in the\n", |
492 | 492 | "protocols subdirectory. They are defined below.\n", |
493 | 493 | "\n", |
|
502 | 502 | "id": "d05fa2e8d1ab" |
503 | 503 | }, |
504 | 504 | "source": [ |
505 | | - "### Standard python magic methods\n", |
| 505 | + "### Standard Python magic methods\n", |
506 | 506 | "\n", |
507 | | - "There are many standard magic methods in python. Here are a few of the most\n", |
508 | | - "important ones used in cirq:\n", |
509 | | - " * `__str__` for user-friendly string output and `__repr__` is the python-friendly string output, meaning that `eval(repr(y))==y` should always be true.\n", |
| 507 | + "There are many standard magic methods in Python. Here are a few of the most\n", |
| 508 | + "important ones used in Cirq:\n", |
| 509 | + " * `__str__` for user-friendly string output and `__repr__` is the Python-friendly string output, meaning that `eval(repr(y))==y` should always be true.\n", |
510 | 510 | " * `__eq__` and `__hash__` which define whether objects are equal or not. You\n", |
511 | 511 | " can also use `cirq.value.value_equality` for objects that have a small list\n", |
512 | 512 | " of sub-values that can be compared for equality.\n", |
|
552 | 552 | "These gates can be understood by the simulator, optimizers, and other code.\n", |
553 | 553 | "3. All that matters is functional equivalence.\n", |
554 | 554 | "Don't worry about staying within or reaching a particular gate set; it's too hard to predict what the caller will want. Gate-set-aware decomposition is useful, but *this is not the protocol that does that*.\n", |
555 | | - "Gate-set-aware decomposition may be added in the future, but doesn't exist within Cirq at the moment.\n", |
| 555 | + "Instead, use features available in the [transformer API](transform.ipynb#compiling_to_nisq_targets_cirqcompilationtargetgateset).\n", |
556 | 556 | "\n", |
557 | 557 | "For example, `cirq.CCZ` decomposes into a series of `cirq.CNOT` and `cirq.T` operations.\n", |
558 | 558 | "This allows code that doesn't understand three-qubit operation to work with `cirq.CCZ`; by decomposing it into operations they do understand.\n", |
|
0 commit comments