Signature#

qualtran.Signature

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

Bloq.signature is a property of all bloqs, and should be an object of this type. It is analogous to a function signature in traditional computing where we specify the names and types of the expected inputs and outputs.

Each LEFT (including thru) register must have a unique name. Each RIGHT (including thru) register must have a unique name.

registers

The registers comprising the signature.

Methods#

build

View source

Construct a Signature comprised of simple thru registers given the register bitsizes.

Args

registers

keyword arguments mapping register name to bitsize. All registers will be 0-dimensional and THRU.

build_from_dtypes

View source

Construct a Signature comprised of simple thru registers given the register dtypes.

Args

registers

keyword arguments mapping register name to QDType. All registers will be 0-dimensional and THRU.

lefts

View source

Iterable over all registers that appear on the LEFT as input.

rights

View source

Iterable over all registers that appear on the RIGHT as output.

get_left

View source

Get a left register by name.

get_right

View source

Get a right register by name.

groups

View source

Iterate over register groups by name.

Registers with shared names (but differing side attributes) can be implicitly grouped.

adjoint

View source

Swap all RIGHT and LEFT registers in this collection.

n_qubits

View source

The number of qubits in the signature.

If the signature has LEFT and RIGHT registers, the number of qubits in the signature is taken to be the greater of the number of left or right qubits. A bloq with this signature uses at least this many qubits.

Classical registers are ignored.

n_cbits

View source

The number of classical bits in the signature.

If the signature has LEFT and RIGHT registers, the number of classical bits in the signature is taken to be the greater of the number of left or right cbits. A bloq with this signature uses at least this many classical bits.

n_bits

View source

The number of quantum + classical bits in the signature.

If the signature has LEFT and RIGHT registers, the number of bits in the signature is taken to be the greater of the number of left or right bits. A bloq with this signature uses at least this many quantum + classical bits.

See Also

__getitem__

View source

__contains__

View source

__iter__

View source

__len__

View source

__eq__

View source

Return self==value.