QuantumRegister module

class QuantumRegister

Implements the QuantumRegister class. Use this class to define the extent of the quantum registers needed for the computation.

QuantumRegister(self, size, name='')

Creates a named quantum register of the required size.

Example:
>>> qr = QuantumRegister(5, "q")
Args:
size (int):

The number of qubits in the quantum register.

name (Optional[str]):

The name of the quantum register. If no name is provided, the default name of “q_” will be used.

Returns:

QuantumRegister

Raises:
RunTimeError:

If no more qubits can be created.

size(self)

Returns the number of qubits in the quantum register.

Args:

None

Returns:

int

Raises:

None

name(self)

Returns the name of the quantum register.

Args:

None

Returns:

str

Raises:

None

prefix()

Returns the prefix character of the quantum register.

Args:

None

Returns:

char

Raises:

None