Program.defgate

Program.defgate(name, matrix, parameters=None)[source]

Define a new static gate.

Note

The matrix elements along each axis are ordered by bitstring. For two qubits the order is 00, 01, 10, 11, where the the bits are ordered in reverse by the qubit index, i.e., for qubits 0 and 1 the bitstring 01 indicates that qubit 0 is in the state 1. See also the related documentation section in the QVM Overview.

Parameters:
  • name (string) – The name of the gate.
  • matrix (array-like) – List of lists or Numpy 2d array.
  • parameters (list) – list of parameters that are used in this gate
Returns:

The Program instance.

Return type:

Program