def _custom_density_matrix_call(self, state): state = K._density_matrix_half_call(self, state) matrix = K.conj(K.matrices.Y) shape = state.shape state = K.reshape(state, (K.np.prod(shape), )) original_targets = tuple(self.target_qubits) self._target_qubits = self.cache.target_qubits_dm self._nqubits *= 2 self.gate_op = K.op.apply_gate self._custom_op_matrix = K.conj(K.matrices.Y) state = K.state_vector_matrix_call(self, state) self._custom_op_matrix = K.matrices.Y self.gate_op = K.op.apply_y self._nqubits //= 2 self._target_qubits = original_targets return K.reshape(state, shape)
def _custom_density_matrix_call(self, state): state = K._density_matrix_half_call(self, state) matrix = K.conj(K.matrices.Y) shape = state.shape state = K.reshape(state, (K.np.prod(shape), )) original_targets = tuple(self.target_qubits) self._target_qubits = self.cache.target_qubits_dm self._nqubits *= 2 self.name = "Unitary" # change name temporarily so that ``apply_gate`` op is used self._custom_op_matrix = K.conj(K.matrices.Y) state = K.state_vector_matrix_call(self, state) self._custom_op_matrix = K.matrices.Y self.name = "y" self._nqubits //= 2 self._target_qubits = original_targets return K.reshape(state, shape)
def _density_matrix_half_call(self, state): self._set_nqubits(state) return K._density_matrix_half_call(self, state)