cirq_superstaq.evaluation
Functions
Checks if an operation can be decomposed into operations on at most one qubit. |
|
|
Constructs a graph representing the qubits and interactions in circuit. |
|
Checks if gate is a barrier or has no unitary representation. |
|
Checks if circuit is Clifford, or can be simulated with a stabilizer simulator. |
|
Checks if gate is represented by a diagonal matrix. |
Compute the unitary effect of a series of operations. |
|
|
Converts a value of type cirq.TParamVal (float | sympy.Expr) to float. |
Module Contents
- cirq_superstaq.evaluation.expressible_with_single_qubit_gates(op: cirq.Operation) bool
Checks if an operation can be decomposed into operations on at most one qubit.
- Parameters:
op – The operation to check.
- Returns:
Whether or not op is a single-qubit gate, or can be deconstructed into single-qubit gates.
- cirq_superstaq.evaluation.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.
- Parameters:
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.
- cirq_superstaq.evaluation.is_blocking(op: cirq.Operation) bool
Checks if gate is a barrier or has no unitary representation.
- Parameters:
op – Gate to be checked.
- Returns:
A boolean value representing whether the gate is a blocking gate.
- cirq_superstaq.evaluation.is_clifford(circuit: cirq.Circuit) bool
Checks if circuit is Clifford, or can be simulated with a stabilizer simulator.
- Parameters:
circuit – Circuit to be checked.
- Returns:
A boolean value representing whether circuit contains only Clifford gates.
- cirq_superstaq.evaluation.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.
- Parameters:
gate – Gate to be checked.
rtol – Relative tolerance when checking.
atol – Absolute tolerance when checking.
- Returns:
A boolean value representing whether gate is diagonal or not.
- cirq_superstaq.evaluation.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.
- Parameters:
ops – The sequence of operations from which to compute a unitary.
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).
- cirq_superstaq.evaluation.paramval_to_float(param: cirq.TParamVal) float
Converts a value of type cirq.TParamVal (float | sympy.Expr) to float.
- Parameters:
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.