def adc_choi(x): kraus = [ np.sqrt(1 - x) * qeye(2), np.sqrt(x) * destroy(2), np.sqrt(x) * fock_dm(2, 0), ] return kraus_to_choi(kraus)
def choi(self): if self._choi is not None: return self._choi elif self._kraus is not None: self._choi = qt.kraus_to_choi(self._kraus) elif self._channel_matrix is not None: self._choi = qt.super_to_choi(self._channel_matrix) return self._choi
def test_sparse_against_dense_adc(self, variable): """ Test sparse versus dense dnorm calculation for a sample of amplitude-damping channels. """ # Choi matrix for identity channel on 1 qubit A = kraus_to_choi([qeye(2)]) B = adc_choi(variable) dense = dnorm(A, B, force_solve=True, sparse=False) sparse = dnorm(A, B, force_solve=True, sparse=True) assert dense == pytest.approx(sparse, abs=1e-7)
def __Cmatrix_old(self, kraus, S, dim): rho = (1/dim)*qt.identity(dim) klist = [rho*S.dag()*k.dag() for k in kraus] return qt.kraus_to_choi(klist)