qat.lang.AQASM.qbool.QBoolArray

class qat.lang.AQASM.qbool.QBoolArray(start=0, length=1, scope=None, qbits_list=None)

Class describing an array of QBool.

This class is not designed to be instantiated by hand, but rather via the .qalloc method of the Program class or the .new_wires method of the QRoutine class.

See documentation of the QClause class for more information.

from qat.lang.AQASM.qbool import QBoolArray
from qat.lang.AQASM import QRoutine

rout = QRoutine()
qbool_array = rout.new_wires(2, QBoolArray)
print(type(qbool_array))
<class 'qat.lang.AQASM.qbool.QBoolArray'>
Parameters
  • start (int) – the starting index of the underlying register

  • length (int) – the length of the underlying register

  • scope (Program/QRoutine) – the scope in which the allocation happened

  • qbit_list (list of int) – optionally a list of indexes of underlying qbits

Instance attributes:
  • index (int): the index of the underlying qbit

  • qbits (list of QBool): a list of quantum booleans

cast(val)

Cast some integer value as a list of bools.

This method is used when casting execution samples to proper python values.

Parameters

val (int) – some integer

Returns

a list of boolean values

Return type

list of bools

evaluate()

Evaluates the register as a boolean expression (i.e does nothing and returns a list of the underlying qubits).

Returns

a list of quantum booleans

Return type

list of QBool

qbits_list()

Returns the list of underlying qubits.

Returns

a list of quantum booleans

Return type

list of QBool