mimiqcircuits.classical.not_operation

Classes

Not()

Flip a classical bit: 0 → 1 and 1 → 0.

class Not[source]

Bases: AbstractClassical

Flip a classical bit: 0 → 1 and 1 → 0.

Acts on one classical bit. It is its own inverse.

Examples

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

Return Not(): flipping twice restores the bit.

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