True-Q Fundamentals
This section provides an overview of True-Q™’s basic building blocks and an introduction to True-Q™’s circuit description language.
We use the following high-level classes to define circuits, their components, and their results:
Operation
: a quantum operation such as a gateCycle
: a clock cycle of a circuit containing quantum operationsCircuit
: a list of cycles and other metadataResults
: stores the results when a quantum circuit is run on hardware or a simulator
Using these, the circuit above can be implemented as follows:
import trueq as tq
cycle1 = {0: tq.Gate.h, 1: tq.Gate.h, 2: tq.Gate.h}
cycle2 = {(0, 1): tq.Gate.cz}
cycle3 = {(0, 2): tq.Gate.cz}
cycle4 = {1: tq.Gate.h, 2: tq.Gate.h}
circuit = tq.Circuit([cycle1, cycle2, cycle3, cycle4])
circuit.measure_all()
circuit.draw()
And we can populate the Results
by using our built-in
Simulator
:
sim = tq.Simulator()
sim.run(circuit, n_shots=100)
circuit.results.plot()
The following pages cover all these basic building blocks in more detail. The
Simulator
is covered in Running Circuits.
- Example: Quantum Circuits in True-Q™
A hands-on example that explains the basic circuit elements
- Circuit Components
Reviews the fundamental True-Q™ classes for circuit construction
- Example: Quantum Circuits with Qudits
An example showing how True-Q™ circuits can be constructed for qudits
- Advanced Qudit Framework
Provides a formal introduction into the qudit formalism and mathematical background
- Keys: Storing and Filtering Metadata
Gives an overview of the object
Key
that is used to store and filter metadata associated with circuits and estimates.
- Circuit Collections
Gives an overview of the tools True-Q™ contains for storing, filtering, and manipulating collections of quantum circuits.
- Parsing Estimate Collections
Gives an overview of how to effectively parse and extract information from the fitting routines of True-Q™.
- Example: Recording Results
Shows how to work with the
Results
class.
- Example: Saving and Loading Objects to Disk
Shows how to save/load True-Q™ objects to/from disk.
Footnotes