Register#
qualtran.Register
View source on GitHub
|
A register serves as the input/output quantum data specifications in a bloq’s Signature.
qualtran.Register(
name,
dtype,
shape=attr_dict['_shape'].default,
side=attr_dict['side'].default
)
Each register has a name and a quantum data type. A collection of Register objects are used
to define a bloq’s signature, see the Signature class.
Attributes
nameThe string name of the register. This name is used to ‘wire up’ quantum inputs by name, analogous to Python’s keyword-arguments.
dtypeThe quantum data type of the register, for example
QBit(),QUInt(n),QAny(n), or any of the data types provided in the top-levelqualtrannamespace.shapeAn optional tuple of integer dimensions to declare a multidimensional register. The total number of bits is the product of entries in this tuple times
bitsize.sideWhether this is a left, right, or thru register. See the documentation for
Sidefor more information.bitsizeshape_symbolic
Methods#
is_symbolic
is_symbolic() -> bool
all_idxs
all_idxs() -> Iterable[Tuple[int, ...]]
Iterate over all possible indices of a multidimensional register.
total_bits
total_bits() -> int
The total number of bits in this register.
This is the product of bitsize and each of the dimensions in shape.
total_qubits
total_qubits() -> int
The total number of qubits in this register.
This is the product of the register’s data type’s number of qubits
and each of the dimensions in shape.
total_cbits
total_cbits() -> int
The total number of classical bits in this register.
This is the product of the register’s data type’s number of classical bits
and each of the dimensions in shape.
adjoint
adjoint() -> 'Register'
Return the ‘adjoint’ of this register by switching RIGHT and LEFT registers.
__ne__
__ne__(
other
)
Check equality and either forward a NotImplemented or return the result negated.
__eq__
__eq__(
other
)
Method generated by attrs for class Register.
View source on GitHub