Channels

Mixed States and Quantum Channels

class quantumflow.Density(tensor: TensorLike, qubits: Qubits = None, memory: Dict[quantumflow.cbits.Addr, Any] = None)

A density matrix representation of a mixed quantum state

asdensity() → qf.Density

Returns self

asoperator() → BKTensor

Return the density matrix as a square array

normalize() → qf.Density

Normalize state

partial_trace(qubits: Qubits) → qf.Density

Return the partial trace over the specified qubits

permute(qubits: Qubits) → qf.Density

Return a copy of this state with qubit labels permuted

probabilities() → BKTensor

Returns: The state probabilities

relabel(qubits: Qubits) → qf.Density

Return a copy of this state with new qubits

trace() → BKTensor

Return the trace of this density operator

class quantumflow.Channel(tensor: TensorLike, qubits: Union[int, Qubits], params: Dict[str, Any] = None, name: str = None)

A quantum channel

H

Return the Hermitian conjugate of this quantum operation.

For unitary Gates (and Circuits composed of the same) the Hermitian conjugate returns the inverse Gate (or Circuit)

aschannel() → qf.Channel

Convert this quantum operation to a channel (if possible)

asgate() → qf.Gate

Convert this quantum operation to a gate (if possible)

chi() → BKTensor

Return the chi (or process) matrix representation of this superoperator

choi() → BKTensor

Return the Choi matrix representation of this super operator

evolve(rho: qf.Density) → qf.Density

Apply the action of this channel upon a density

name

Return the name of this operation

partial_trace(qubits: Qubits) → qf.Channel

Return the partial trace over the specified qubits

permute(qubits: Qubits) → qf.Channel

Return a copy of this channel with qubits in new order

qubit_nb

Return the total number of qubits

qubits

Return the qubits that this operation acts upon

relabel(qubits: Qubits) → qf.Channel

Return a copy of this channel with new qubits

run(ket: qf.State) → qf.State

Apply the action of this operation upon a pure state

sharp

Return the ‘sharp’ transpose of the superoperator.

The transpose \(S^\#\) switches the two covariant (bra) indices of the superoperator. (Which in our representation are the 2nd and 3rd super-indices)

If \(S^\#\) is Hermitian, then \(S\) is a Hermitian-map (i.e. transforms Hermitian operators to hJrmitian operators)

Flattening the \(S^\#\) superoperator to a matrix gives the Choi matrix representation. (See channel.choi())

tensor

Return the tensor representation of the channel’s superoperator

trace() → BKTensor

Return the trace of this super operator

class quantumflow.Kraus(operators: Sequence[qf.Gate], weights: Sequence[float] = None)

A Kraus representation of a quantum channel

H

Return the complex conjugate of this Kraus operation

aschannel() → qf.Channel

Returns: Action of Kraus operators as a superoperator Channel

asgate() → qf.Gate

Not possible in general. (But see UnitaryMixture)

Raises: TypeError

evolve(rho: qf.Density) → qf.Density

Apply the action of this Kraus quantum operation upon a density

qubits

Returns – List of qubits acted upon by this Kraus operation

The list of qubits is ordered if the qubits labels can be sorted, else the the order is indeterminate.

Raises:TypeError – If qubits cannot be sorted into unique order.
run(ket: qf.State) → qf.State

Apply the action of this Kraus quantum operation upon a state

class quantumflow.UnitaryMixture(operators: Sequence[qf.Gate], weights: Sequence[float] = None)

A Kraus channel which is a convex mixture of unitary dynamics.

asgate() → qf.Gate

Return one of the composite Kraus operators at random with the appropriate weights

run(ket: qf.State) → qf.State

Apply the action of this Kraus quantum operation upon a state

Actions on Channels

quantumflow.join_channels(*channels) → qf.Channel

Join two channels acting on different qubits into a single channel acting on all qubits

quantumflow.channel_to_kraus(chan: qf.Channel) → quantumflow.channels.Kraus

Convert a channel superoperator into a Kraus operator representation of the same channel.

quantumflow.kraus_iscomplete(kraus: quantumflow.channels.Kraus) → bool

Returns True if the collection of (weighted) Kraus operators are complete. (Which is necessary for a CPTP map to preserve trace)

Standard channels

class quantumflow.Dephasing(prob: float, q0: Qubit)

A Kraus representation of a phase-damping quantum channel

Parameters:
  • prob – The one-step damping probability.
  • q0 – The qubit on which to act.
class quantumflow.Damping(prob: float, q0: Qubit)

A Kraus representation of an amplitude-damping (spontaneous emission) channel on one qubit

Parameters:
  • prob – The one-step damping probability.
  • q0 – The qubit on which to act.
class quantumflow.Depolarizing(prob: float, q0: Qubit)

A Kraus representation of a depolarizing channel on 1-qubit.

Parameters:
  • prob – The one-step depolarizing probability.
  • q0 – The qubit on which to act.