Esempio n. 1
0
 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]]))),
     ]
Esempio n. 2
0
 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]])
             ),
         ),
     ]
Esempio n. 3
0
 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)
Esempio n. 4
0
 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]))
Esempio n. 5
0
 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)
Esempio n. 6
0
 def matrix(self):
     return linalg.block_diag(np.diag([1, 1, 1, 1, 1]),
                              np.array([[0, 1], [1, 0]]),
                              np.diag([1]))
Esempio n. 7
0
 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)
Esempio n. 8
0
 def matrix(self):
     return linalg.block_diag(np.diag([1, 1, 1, 1, 1]),
                              np.array([[0, 1], [1, 0]]),
                              np.diag([1]))
Esempio n. 9
0
 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)