程序代写 Quantum Programming Languages: Cirq, Qiskit, QASM

Quantum Programming Languages: Cirq, Qiskit, QASM
Feb 1, 2022

Quantum Programming, by Outline Languages: Cirq, Qiskit, QASM; 100 minutes; Feb 1, 2022

Copyright By PowCoder代写 加微信 powcoder

Hook: The next round of quantum programming homework is in Cirq. Cirq is a mix of Python and of calls to operations on a quantum machine. The homework is to program and run well-known algorithms. We will compile Cirq to QASM, which can be imported into Qiskit and run on an IBM quantum computer.
Purpose: Persuade you that you can get this to work.
1. We will cover Cirq¡¯s view of qubits, circuits, and new gates.
2. We will cover such advanced topics as parameterization, noise, and optimization. 3. We will cover how to compile Cirq to QASM and import into Qiskit.
Transition to Body: Let us begin with the basics.
Main Point 1: We will cover Cirq¡¯s view of qubits, circuits, and new gates.
[Cirq has multiple ways of building circuits]
[Cirq has syntax for running a simulation once or multiple times]
[We can define a new gate as a class: how it works and how to display and decompose it]
Transition to MP2: Now let us talk about advanced aspects of Cirq.
Main Point 2: We will cover such advanced topics as parameterization, noise, and optimization. [Paraterization uses symbolic values that are resolved at run time]
[Cirq supports a noise model that makes a simulator mimic a quantum computer]
[Cirq supports optimization-on-demand]
Transition to MP3: How do we run Cirq on a quantum computer?
Main Point 3: We will cover how to compile Cirq to QASM and import into Qiskit. [We can compile Cirq to QASM]
[QASM is for quantum what C is for classical: a universal assembly language] [We can import QASM into Qiskit]
Transition to Close: So there you have it.
Review: Cirq has a syntax for circuits that is verbose yet also flexible. Additionally, Cirq has advanced features that support both programming of large circuits and simulating in a way that mimics running on a quantum computer.
Strong finish: Cirq is developed and supported by a sizable team at Google. Cirq runs on a variety of quantum computers some of which are significantly different from Google¡¯s quantum computers, which use superconducting qubits.
Call to action: Do you like Cirq or Qiskit better? 2

Detailed presentation
Hook: The next round of quantum programming homework is in Cirq. Cirq is a mix of Python and of calls to operations on a quantum machine. The homework is to program and run well-known algorithms. We will compile Cirq to QASM, which can be imported into Qiskit and run on an IBM quantum computer.
Purpose: Persuade you that you can get this to work.
1. We will cover Cirq¡¯s view of qubits, circuits, and new gates.
2. We will cover such advanced topics as parameterization, noise, and optimization. 3. We will cover how to compile Cirq to QASM and import into Qiskit.
Transition to Body: Let us begin with the basics.
Main Point 1: We will cover Cirq¡¯s view of qubits, circuits, and new gates.
[Cirq has multiple ways of building circuits]
One way is first write a list of uses of gates and then map the list to a circuit. Another way is to use Python generators and yield statements.
[Cirq has syntax for running a simulation once or multiple times]
The basic expression for running a simulation of a circuit is simulator.run(circuit). This can be enhanced with syntax for repeating the simulation.
We can access both internal data structures and the final results of a simulation. We might do that for the purposes of debugging and for doing statistics on the output.
[We can define a new gate as a class: how it works and how to display and decompose it] We can define a class of gates that inherits from an existing class of gates. We have to define how it works and how to display it in a diagram. Specifically, we must define the method _unitary_ that defines how the gate works. We must also define the method __str__ that defines how to display the gate in a diagram. We can also specify how to decompose it into a product of gates. Cirq does rather little to figure out whether a given gate can be compiled to a native gate set. Instead, for each new gate, the programmer must give a specification of how to do such a translation. This is done by defining the method _decompose_. Cirq does no check of whether the decomposition is correct.
Transition to MP2: Now let us talk about advanced aspects of Cirq.
Main Point 2: We will cover such advanced topics as parameterization, noise, and optimization.
[Paraterization uses symbolic values that are resolved at run time]
As often seen in programming, we may want to parameterize a circuit by a value that we can supply every time we run the circuit. This can be done in Cirq via use of symbolic values.
[Cirq supports a noise model that makes a simulator mimic a quantum computer] 3

Any quantum computer has noise, which means that gates and measurements are less than fully reliable. In contrast, simulators tend to execute gates and measurements in a fully reliable manner. In Cirq, we can make a simulation be more like running on quantum computer by adding noise. This is done by adding what Cirq calls a noise model. For example, one can add noise for each operation or one can add noise in every moment of a simulation.
[Cirq supports optimization-on-demand] The default of Cirq is to do no optimization of a circuit. However, the programmer can specify optimization on demand, via
XZOptimizer().optimize_circuit(circuit)
Transition to MP3: How do we run Cirq on a quantum computer?
Main Point 3: We will cover how to compile Cirq to QASM and import into Qiskit.
[We can compile Cirq to QASM]
[QASM is for quantum what C is for classical: a universal assembly language] [We can import QASM into Qiskit]
Transition to Close: So there you have it.
Review: Cirq has a syntax for circuits that is verbose yet also flexible. Additionally, Cirq has advanced features that support both programming of large circuits and simulating in a way that mimics running on a quantum computer.
Strong finish: Cirq is developed and supported by a sizable team at Google. Cirq runs on a variety of quantum computers some of which are significantly different from Google¡¯s quantum computers, which use superconducting qubits.
Call to action: Do you like Cirq or Qiskit better?

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com