Module: qualtran#

The top-level Qualtran module.

Many fundamental objects for expressing quantum programs can be imported from this top-level namespace like qualtran.Bloq, qualtran.Register, and the various quantum data types (qualtran.QBit, qualtran.QUInt, …).

The standard library of quantum algorithms must be imported from the qualtran.bloqs submodule. A variety of analysis protocols are available in submodules as well like qualtran.resource_counting, qualtran.drawing, qualtran.simulation, and others.

Modules#

cirq_interop: Bi-directional interop between Qualtran & Cirq.

drawing: Draw and visualize bloqs.

linalg: Linear algebra routines for building bloqs.

resource_counting: Analysis routines for computing costs and resource counts.

serialization: Functions for protobuf serialization of bloqs.

simulation: Simulators for quantum programs.

surface_code: Physical cost models for surface code architectures.

symbolics: Utilities for simultaneous support for Sympy symbolic objects and concrete values.

testing: Functions for testing bloqs.

Classes#

class Bloq: Bloq is the primary abstract base class for all operations.

class DecomposeTypeError: Raised if a decomposition does not make sense in this context.

class DecomposeNotImplementedError: Raised if a decomposition is not yet provided.

class BloqError: A value error raised when CompositeBloq conditions are violated.

class CompositeBloq: A bloq defined by a collection of sub-bloqs and dataflows between them

class BloqBuilder: A builder class for constructing a CompositeBloq.

class DidNotFlattenAnythingError: An exception raised if flatten_once() did not find anything to flatten.

class QCDType: The abstract interface for quantum/classical quantum computing data types.

class CDType: The abstract interface for classical data types.

class QDType: The abstract interface for quantum data types.

class QAny: Opaque bag-of-qubits type.

class QBit: A single qubit. The smallest addressable unit of quantum data.

class CBit: A single classical bit. The smallest addressable unit of classical data.

class QInt: Signed Integer of a given width bitsize.

class QIntOnesComp: Signed Integer of a given width bitsize.

class QUInt: Unsigned integer of a given width bitsize which wraps around upon overflow.

class BQUInt: Unsigned integer whose values are bounded within a range.

class QFxp: Fixed point type to represent real numbers.

class QMontgomeryUInt: Montgomery form of an unsigned integer of a given width bitsize which wraps around upon overflow.

class QGF: Galois Field type to represent elements of a finite field.

class QGFPoly: Univariate Polynomials with coefficients in a Galois Field GF(\(p^m\)).

class QDTypeCheckingSeverity: The level of type checking to enforce

class Register: A register serves as the input/output quantum data specifications in a bloq’s Signature.

class Signature: An ordered sequence of Registers that follow the rules for a bloq signature.

class Side: Denote LEFT, RIGHT, or THRU registers.

class BloqInstance: A unique instance of a Bloq within a CompositeBloq.

class Connection: A connection between two Soquets.

class DanglingT: The type of the singleton objects LeftDangle and RightDangle.

class Soquet: One half of a connection.

class GateWithRegisters: cirq.Gates extension with support for composite gates acting on multiple qubit registers.

class Adjoint: The standard adjoint of subbloq.

class Controlled: A controlled version of subbloq.

class CtrlSpec: A specification for how to control a bloq.

class AddControlledT: The signature for the add_controlled callback part of ctrl_system.

class BloqExample: An instantiation of a bloq and its metadata.

class BloqDocSpec: A collection of bloq examples and specifications for documenting a bloq class.

Functions#

bloq_example(...): Decorator to turn a function into a BloqExample.

check_dtypes_consistent(...): Check if two types are consistent given our current definition on consistent types.

make_ctrl_system_with_correct_metabloq(...): The default fallback for `Bloq.make_ctrl_system.

Type Aliases#

ConnectionT

LeftDangle

Instance of qualtran.DanglingT

RightDangle

Instance of qualtran.DanglingT