ket.gateset

Native gate set decompositions for Ket.

Summary

Classes

RzGPiGPi2MS

Gate set using MS and GPi for CNOT decomposition.

RzRxISWAP

Gate set using iSWAP for CNOT decomposition.

RzSXCZ

Gate set using CZ for CNOT decomposition.

RzSXECR

Gate set using ECR for CNOT decomposition.

RzSXXRzz

Gate set using Rzz for CNOT decomposition.

Classes

class RzGPiGPi2MS[source]

Bases: NativeGateSet

Gate set using MS and GPi for CNOT decomposition.

translate(matrix: list[list[complex]], target: int) → list[source]

Translate a single-qubit gate into native gate instructions.

The gate is described by its 2x2 unitary matrix as a list of two rows of complex amplitudes:

[[u00, u01],
 [u10, u11]]
Parameters:
  • matrix – The 2x2 unitary matrix as complex values.

  • target – Index of the target qubit.

Returns:

A list of native gate objects (serialisable to JSON) that implement the given unitary on target.

cnot(control: int, target: int) → list[source]

Produce native instructions implementing a CNOT gate.

Parameters:
  • control – Index of the control qubit.

  • target – Index of the target qubit.

Returns:

A list of native gate objects that implement CNOT.

class RzRxISWAP[source]

Bases: NativeGateSet

Gate set using iSWAP for CNOT decomposition.

translate(matrix: list[list[complex]], target: int) → list[source]

Translate a single-qubit gate into native gate instructions.

The gate is described by its 2x2 unitary matrix as a list of two rows of complex amplitudes:

[[u00, u01],
 [u10, u11]]
Parameters:
  • matrix – The 2x2 unitary matrix as complex values.

  • target – Index of the target qubit.

Returns:

A list of native gate objects (serialisable to JSON) that implement the given unitary on target.

cnot(control: int, target: int) → list[source]

Produce native instructions implementing a CNOT gate.

Parameters:
  • control – Index of the control qubit.

  • target – Index of the target qubit.

Returns:

A list of native gate objects that implement CNOT.

class RzSXCZ[source]

Bases: NativeGateSet

Gate set using CZ for CNOT decomposition.

translate(matrix: list[list[complex]], target: int) → list[source]

Translate a single-qubit gate into native gate instructions.

The gate is described by its 2x2 unitary matrix as a list of two rows of complex amplitudes:

[[u00, u01],
 [u10, u11]]
Parameters:
  • matrix – The 2x2 unitary matrix as complex values.

  • target – Index of the target qubit.

Returns:

A list of native gate objects (serialisable to JSON) that implement the given unitary on target.

cnot(control: int, target: int) → list[source]

Produce native instructions implementing a CNOT gate.

Parameters:
  • control – Index of the control qubit.

  • target – Index of the target qubit.

Returns:

A list of native gate objects that implement CNOT.

class RzSXECR[source]

Bases: NativeGateSet

Gate set using ECR for CNOT decomposition.

translate(matrix: list[list[complex]], target: int) → list[source]

Translate a single-qubit gate into native gate instructions.

The gate is described by its 2x2 unitary matrix as a list of two rows of complex amplitudes:

[[u00, u01],
 [u10, u11]]
Parameters:
  • matrix – The 2x2 unitary matrix as complex values.

  • target – Index of the target qubit.

Returns:

A list of native gate objects (serialisable to JSON) that implement the given unitary on target.

cnot(control: int, target: int) → list[source]

Produce native instructions implementing a CNOT gate.

Parameters:
  • control – Index of the control qubit.

  • target – Index of the target qubit.

Returns:

A list of native gate objects that implement CNOT.

class RzSXXRzz[source]

Bases: NativeGateSet

Gate set using Rzz for CNOT decomposition.

translate(matrix: list[list[complex]], target: int) → list[source]

Translate a single-qubit gate into native gate instructions.

The gate is described by its 2x2 unitary matrix as a list of two rows of complex amplitudes:

[[u00, u01],
 [u10, u11]]
Parameters:
  • matrix – The 2x2 unitary matrix as complex values.

  • target – Index of the target qubit.

Returns:

A list of native gate objects (serialisable to JSON) that implement the given unitary on target.

cnot(control: int, target: int) → list[source]

Produce native instructions implementing a CNOT gate.

Parameters:
  • control – Index of the control qubit.

  • target – Index of the target qubit.

Returns:

A list of native gate objects that implement CNOT.