wy_qcos.transpiler.cmss.compiler.openqasm3 package

Submodules

wy_qcos.transpiler.cmss.compiler.openqasm3.convertor module

wy_qcos.transpiler.cmss.compiler.openqasm3.data module

wy_qcos.transpiler.cmss.compiler.openqasm3.exceptions module

wy_qcos.transpiler.cmss.compiler.openqasm3.expression module

wy_qcos.transpiler.cmss.compiler.openqasm3.parser module

wy_qcos.transpiler.cmss.compiler.openqasm3.state module

wy_qcos.transpiler.cmss.compiler.openqasm3.types module

class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Type

基类:ABC

An internal representation of the OpenQASM 3 type system values.

Or at least that parts of it that Terra has some sort of support for. The reference AST does not have a nice unified object to use here; there is ClassicalType but no quantum equivalent (since it's implicit).

This class is just a typing base, and should never be instantiated. Its subclasses will be, though.

abstract pretty()

A pretty string representation of the type, useful for debugging.

返回类型:

str

final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Error

基类:Type

A zero type that represents an error during type checking.

pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Never

基类:Type

The bottom type.

There are no valid values of this type, as it can never be instantiated. This is used during inference in cases where multiple types must combined into their join, but some of the elements have missing values, such as a range that has a start but no stop value.

pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.BitArray(size)

基类:Type

An array of bits.

This roughly corresponds to Terra's class:ClassicalRegister.

参数:

size (int)

size
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.QubitArray(size)

基类:Type

An array of qubits.

This roughly corresponds to Terra's class:QuantumRegister.

参数:

size (int)

size
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Bit

基类:Type

A single bit.

pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Bool(const)

基类:Type

A Boolean value.

参数:

const (bool)

const
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Qubit

基类:Type

A single qubit.

pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.HardwareQubit

基类:Type

A hardware qubit.

pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Int(const=False, size=None)

基类:Type

An integer value.

This is generally only encountered as a constant and so is represented by a Python integer, but can also be the type of the class:Parameter used to represent for-loop variables.

参数:
  • const (bool)

  • size (int | None)

const
size
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Uint(const=False, size=None)

基类:Type

An unsigned integer value.

参数:
  • const (bool)

  • size (int | None)

const
size
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Float(const=False, size=None)

基类:Type

A floating-point type.

Terra can use this either in a constant form as a Python float, or as a class:Parameter.

参数:
  • const (bool)

  • size (int | None)

const
size
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Angle(const=False, size=None)

基类:Type

An angle type.

OpenQASM 3 makes a large distinction between angle and float (the OpenQASM angle is integer-like), but Terra currently treats them as interchangeable. This might change in the future.

参数:
  • const (bool)

  • size (int | None)

const
size
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Duration(const)

基类:Type

A duration.

Right now, this is only recognised in constant form, which is represented within class:.ValueResolver as a 2-tuple of a float and its unit.

参数:

const (bool)

const
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Range(base)

基类:Type

A range selector.

The inner type is the join of the types of the start and end values.

参数:

base (Type)

base
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Sequence(base)

基类:Type

A general sequence of values.

This is represented internally as a list or tuple of the contained type.

参数:

base (Type)

base
pretty()
final class wy_qcos.transpiler.cmss.compiler.openqasm3.types.Gate(n_classical, n_quantum)

基类:Type

The type of a gate.

Since the classical parameters of gates have a fixed type in OpenQASM 3, this just stores the counts of the classical and quantum arguments.

参数:
  • n_classical (int)

  • n_quantum (int)

n_classical
n_quantum
pretty()

Module contents