6.4. initialization#

class SetBits(name, numberBits)[source]#

Bases: QuantumOperation

This operations allows to set the values of classical bits.

For instance, the operation `setBits("values", 3)` sets three classical bits to the values with the name `values`.

Note that the definition of `values` depends on the chosen backend and must be defined with the function `setValue` of the backend.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. A `Sequence` object is returned with this operation as only component in the list of operations.

Returns:

Sequence – An object of the class```Sequence``` is returned with this operation and the appropriate classical targets in it.

Return type:

geqo.core.quantum_circuits.Sequence

getInverse()[source]#

Calling this method raises an exception because this operation has no inverse.

getNumberClassicalBits()[source]#

Return the number of classical bits that are used by this operation.

Returns:

numberBits – This operation acts on the specified number of classical bits.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

0 – This operation only acts on classical bits.

Return type:

int

hasDecomposition()[source]#
Returns:

False – A BasicGate is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

False – This is not a unitary operation.

Return type:

Bool

class SetDensityMatrix(name, numberQubits)[source]#

Bases: QuantumOperation

This class allows to set the density matrix of one or more qubits. Before the state is set, the affected qubits are traced out, leading to a mixed state in general.

For instance, the operation `SetDensityMatrix("ρ", 2)` sets two qubits to the density matrix with the name `ρ`.

Note that the definition of the corresponding density matrix depends on the chosen backend and must be defined with the function `setValue` of the backend.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. A `Sequence` object is returned with this operation as only component in the list of operations.

Returns:

Sequence – An object of the class```Sequence``` is returned with this operation and the appropriate quantum targets in it.

Return type:

geqo.core.quantum_circuits.Sequence

getInverse()[source]#

Calling this method raises an exception because this operation has no inverse.

getNumberClassicalBits()[source]#

Return the number of classical bits that are used by this operation.

Returns:

0 – This operation only acts on quantum bits.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

numberQubits – This operation only acts on the specified number of qubits.

Return type:

int

hasDecomposition()[source]#
Returns:

False – A BasicGate is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

False – This is not a unitary operation.

Return type:

Bool

class SetQubits(name, numberQubits)[source]#

Bases: QuantumOperation

This operations allows to set the values of qubits.

For instance, the operation `setQubits("values", 3)` sets three qubits to either |0> or |1> with the name `values`.

Note that the definition of `values` depends on the chosen backend and must be defined with the function `setValue` of the backend.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. A `Sequence` object is returned with this operation as only component in the list of operations.

Returns:

Sequence – An object of the class```Sequence``` is returned with this operation and the appropriate quantum targets in it.

Return type:

geqo.core.quantum_circuits.Sequence

getInverse()[source]#

Calling this method raises an exception because this operation has no inverse.

getNumberClassicalBits()[source]#

Return the number of classical bits that are used by this operation.

Returns:

0 – This operation only acts on quantum bits.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

numberQubits – This operation only acts on the specified number of qubits.

Return type:

int

hasDecomposition()[source]#
Returns:

False – A BasicGate is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

False – This is not a unitary operation.

Return type:

Bool