mimiqcircuits.operations.magic

Magic-state preparation.

Classes

PrepareMagic

alias of PrepareStateT

PrepareStateT()

Prepare one qubit in the magic state.

class mimiqcircuits.operations.magic.PrepareStateT[source]

Bases: krauschannel

Prepare one qubit in the magic state.

Prepares the magic state \(T\ket{+} = (\ket{0} + e^{i\pi/4}\ket{1})/\sqrt{2}\), whatever the previous state of the qubit.

A magic state is the resource consumed by a \(\pi/8\) Pauli rotation when the rotation is carried out with Pauli product measurements (see pauli_based_computation()). Fault-tolerant architectures produce these states separately, by distillation, so a dedicated operation lets them be counted and scheduled.

The operation is a Kraus channel with operators \(T\ket{+}\bra{0}\) and \(T\ket{+}\bra{1}\), and is equivalent to Reset, GateH, GateT. It cannot be inverted, raised to a power or controlled.

Examples

>>> from mimiqcircuits import *
>>> PrepareStateT()
PrepareStateT
>>> c = Circuit()
>>> c.push(PrepareStateT(), 0)
1-qubit circuit with 1 instruction:
└── PrepareStateT @ q[0]

The decomposition resets the qubit to \(\ket{0}\), then applies H and T:

>>> PrepareStateT().decompose()
1-qubit circuit with 3 instructions:
├── Reset @ q[0]
├── H @ q[0]
└── T @ q[0]

See also

Reset, ResetX, MeasurePauli

inverse()[source]
power(pwr)[source]
control(num_qubits)[source]
iswrapper()[source]
supports_canonical_rewrite()[source]

Whether CanonicalRewrite may decompose this operation.

Default is conservative: unsupported operations must opt in. This keeps “non-terminal” separate from “canonically rewriteable”.

krausoperators()[source]

Returns the Kraus operators associated with the given Kraus channel.

This should be implemented for each specific channel.

Returns:

A list of matrices representing the Kraus operators.

Return type:

list

mimiqcircuits.operations.magic.PrepareMagic

alias of PrepareStateT