cirq_superstaq.evaluation ========================= .. py:module:: cirq_superstaq.evaluation Functions --------- .. autoapisummary:: cirq_superstaq.evaluation.expressible_with_single_qubit_gates cirq_superstaq.evaluation.interaction_graph cirq_superstaq.evaluation.is_blocking cirq_superstaq.evaluation.is_clifford cirq_superstaq.evaluation.is_known_diagonal cirq_superstaq.evaluation.operations_to_unitary cirq_superstaq.evaluation.paramval_to_float Module Contents --------------- .. py:function:: expressible_with_single_qubit_gates(op: cirq.Operation) -> bool Checks if an operation can be decomposed into operations on at most one qubit. :param op: The operation to check. :returns: Whether or not `op` is a single-qubit gate, or can be deconstructed into single-qubit gates. .. py:function:: interaction_graph(circuit: cirq.AbstractCircuit) -> networkx.Graph Constructs a graph representing the qubits and interactions in `circuit`. Only two-qubit interactions are considered; gates on three or more qubits are ignored. :param circuit: The circuit for which to construct the interaction graph. :returns: A graph containing all qubits in `circuit`, with edges between each pair which interact with a (non-separable) two-qubit gate. .. py:function:: is_blocking(op: cirq.Operation) -> bool Checks if gate is a barrier or has no unitary representation. :param op: Gate to be checked. :returns: A boolean value representing whether the gate is a blocking gate. .. py:function:: is_clifford(circuit: cirq.Circuit) -> bool Checks if circuit is Clifford, or can be simulated with a stabilizer simulator. :param circuit: Circuit to be checked. :returns: A boolean value representing whether `circuit` contains only Clifford gates. .. py:function:: is_known_diagonal(gate: cirq.Gate | None, rtol: float = 1e-05, atol: float = 1e-08) -> bool Checks if gate is represented by a diagonal matrix. If the given gate is a controlled gate, it checks if the uncontrolled version of the gate is diagonal. :param gate: Gate to be checked. :param rtol: Relative tolerance when checking. :param atol: Absolute tolerance when checking. :returns: A boolean value representing whether `gate` is diagonal or not. .. py:function:: operations_to_unitary(ops: collections.abc.Iterable[cirq.Operation], qubits: collections.abc.Sequence[cirq.Qid]) -> numpy.typing.NDArray[numpy.complex128] Compute the unitary effect of a series of operations. This function is equivalent to `cirq.Circuit(ops).unitary(qubits)`, but significantly faster because it avoids instantiating the circuit. :param ops: The sequence of operations from which to compute a unitary. :param qubits: The way qubits should be ordered in the unitary matrix. Must contain all qubits present in `ops`. If larger, the resulting unitary will be expanded as if an identity was applied to the extra qubits. :returns: The unitary matrix computed from the product of the unitary effects of each operation. :raises ValueError: If the resulting matrix could not be computed (likely due to a nonunitary operation being passed as part of `ops`). .. py:function:: paramval_to_float(param: cirq.TParamVal) -> float Converts a value of type `cirq.TParamVal` (`float | sympy.Expr`) to float. :param param: The `cirq.TParamVal` to convert. :returns: A float representing the converted param. :raises general_superstaq.SuperstaqException: If input parameter is not a type capable of being converted to float.