def __init__(self, qubit_map: Optional[Dict[ops.Qid, int]] = None, *args, **kwargs): """ Args: qubit_map: A map from the Qubits in the Circuit to the the index of this qubit for a canonical ordering. This canonical ordering is used to define the state (see the state_vector() method). """ super().__init__(*args, **kwargs) # type: ignore self._qubit_map = qubit_map or {} qid_shape = simulator._qubit_map_to_shape(self._qubit_map) self._qid_shape = None if qubit_map is None else qid_shape
def __init__(self, qubit_map: Optional[Mapping['cirq.Qid', int]] = None, *args, **kwargs): """Inits StateVectorMixin. Args: qubit_map: A map from the Qubits in the Circuit to the the index of this qubit for a canonical ordering. This canonical ordering is used to define the state (see the state_vector() method). *args: Passed on to the class that this is mixed in with. **kwargs: Passed on to the class that this is mixed in with. """ # Reason for 'type: ignore': https://github.com/python/mypy/issues/5887 super().__init__(*args, **kwargs) # type: ignore self._qubit_map = qubit_map or {} qid_shape = simulator._qubit_map_to_shape(self._qubit_map) self._qid_shape = None if qubit_map is None else qid_shape
def __init__(self, density_matrix: np.ndarray, measurements: Dict[str, np.ndarray], qubit_map: Dict[ops.Qid, int], dtype: Type[np.number] = np.complex64): """DensityMatrixStepResult. Args: density_matrix: The density matrix at this step. Can be mutated. measurements: The measurements for this step of the simulation. qubit_map: A map from qid to index used to define the ordering of the basis in density_matrix. dtype: The numpy dtype for the density matrix. """ super().__init__(measurements) self._density_matrix = density_matrix self._qubit_map = qubit_map self._dtype = dtype self._qid_shape = simulator._qubit_map_to_shape(qubit_map)
def __init__(self, density_matrix: np.ndarray, qubit_map: Dict[ops.Qid, int]): self.density_matrix = density_matrix self.qubit_map = qubit_map self._qid_shape = simulator._qubit_map_to_shape(qubit_map)
def __init__(self, state_vector: np.ndarray, qubit_map: Dict[ops.Qid, int]) -> None: self.state_vector = state_vector self.qubit_map = qubit_map self._qid_shape = simulator._qubit_map_to_shape(qubit_map)