mimiqcircuits.classical.setbits

Classes

SetBit0()

Set a classical bit to 0, whatever its value.

SetBit1()

Set a classical bit to 1, whatever its value.

class SetBit0[source]

Bases: AbstractClassical

Set a classical bit to 0, whatever its value.

Acts on one classical bit.

Examples

>>> from mimiqcircuits import *
>>> SetBit0().name
'set0'
>>> # set bit 1 to 0
>>> c = Circuit()
>>> c.push(SetBit0(), 1)
2-bit circuit with 1 instruction:
└── c[1] = 0
inverse()[source]

Return SetBit1().

Setting a bit is not invertible; this pairing only mirrors the opposite operation.

iswrapper()[source]

Whether the operation wraps another operation.

True for composite operations such as Control, Power, Inverse, Parallel or IfStatement, False otherwise.

Returns:

bool

get_operation()[source]

Return the operation that this one wraps, or the operation itself.

Wrappers such as Control or Power return the operation they wrap; other operations return themselves.

Returns:

Operation

class SetBit1[source]

Bases: AbstractClassical

Set a classical bit to 1, whatever its value.

Acts on one classical bit.

Examples

>>> from mimiqcircuits import *
>>> SetBit1().name
'set1'
>>> # set bit 1 to 1
>>> c = Circuit()
>>> c.push(SetBit1(), 1)
2-bit circuit with 1 instruction:
└── c[1] = 1
inverse()[source]

Return SetBit0().

Setting a bit is not invertible; this pairing only mirrors the opposite operation.

iswrapper()[source]

Whether the operation wraps another operation.

True for composite operations such as Control, Power, Inverse, Parallel or IfStatement, False otherwise.

Returns:

bool

get_operation()[source]

Return the operation that this one wraps, or the operation itself.

Wrappers such as Control or Power return the operation they wrap; other operations return themselves.

Returns:

Operation