def _eigen_components(self): return [ (0, linalg.block_diag(np.diag([1, 1, 1, 1, 1, 1]), np.array([[0.5, 0.5], [0.5, 0.5]]))), (1, linalg.block_diag(np.diag([0, 0, 0, 0, 0, 0]), np.array([[0.5, -0.5], [-0.5, 0.5]]))), ]
def _eigen_components(self) -> List[Tuple[float, np.ndarray]]: return [ (0, linalg.block_diag(np.diag([1, 1, 1, 1, 1, 1]), np.array([[0.5, 0.5], [0.5, 0.5]]))), ( 1, linalg.block_diag( np.diag([0, 0, 0, 0, 0, 0]), np.array([[0.5, -0.5], [-0.5, 0.5]]) ), ), ]
def _unitary_(self) -> Union[np.ndarray, NotImplementedType]: sub_matrix = protocols.unitary(self.sub_gate, None) if sub_matrix is None: return NotImplemented return linalg.block_diag( np.eye(pow(2, self.num_qubits()) - sub_matrix.shape[0]), sub_matrix)
def _unitary_(self) -> np.ndarray: return linalg.block_diag(np.diag([1, 1, 1, 1, 1]), np.array([[0, 1], [1, 0]]), np.diag([1]))
def _unitary_(self) -> Union[np.ndarray, type(NotImplemented)]: sub_matrix = protocols.unitary(self.sub_gate, None) if sub_matrix is None: return NotImplemented return linalg.block_diag(np.eye(sub_matrix.shape[0]), sub_matrix)
def matrix(self): return linalg.block_diag(np.diag([1, 1, 1, 1, 1]), np.array([[0, 1], [1, 0]]), np.diag([1]))
def matrix(self) -> np.ndarray: cast_sub_gate = self._cast_sub_gate(gate_features.KnownMatrixGate) sub_matrix = cast_sub_gate.matrix() return linalg.block_diag(np.eye(sub_matrix.shape[0]), sub_matrix)
def matrix(self) -> np.ndarray: cast_sub_gate = self._cast_sub_gate(gate_features.KnownMatrix) sub_matrix = cast_sub_gate.matrix() return linalg.block_diag(np.eye(sub_matrix.shape[0]), sub_matrix)