Circuit.point

Circuit.point(op, start=(0, 0), end=None)[source]

Return point of the first occurrence of op.

Parameters:
  • op (Operation | Gate) – The operation or gate to find.

  • start (CircuitPointLike) – Circuit point to start searching from. Inclusive. (Default: Beginning of the circuit.)

  • end (CircuitPointLike | None) – Cycle index to stop searching at. Inclusive. (Default: End of the circuit.)

Returns:

The first point that contains op.

Return type:

CircuitPoint

Raises:
  • ValueError – If op is not found.

  • ValueError – If op could not have been placed on the circuit due to either an invalid location or gate radix mismatch.

Examples

>>> from bqskit.ir.gates import HGate, XGate
>>> circuit = Circuit(1)
>>> opH = Operation(HGate(), [0])
>>> circuit.append(opH)
>>> circuit.point(opH)
(0, 0)
>>> opX = Operation(XGate(), [0])
>>> circuit.append(opX)
>>> circuit.point(opX)
(1, 0)