Circuit.insert_gate

Circuit.insert_gate(cycle_index, gate, location, params=[])[source]

Insert the gate object in the circuit on the qudits in location.

After this, if cycle was in range, you can expect: all([self[cycle_index, idx].gate == gate for idx in location])

Parameters:
  • cycle_index (int) – The cycle to insert the gate.

  • gate (Gate) – The gate to insert.

  • location (CircuitLocationLike) – Apply the gate to this set of qudits.

  • params (RealVector) – The gate’s parameters.

Raises:
  • IndexError – If the specified cycle doesn’t exist.

  • ValueError – If gate cannot be placed on the circuit due to either an invalid location or gate radix mismatch.

See also

insert()