Esempio n. 1
0
def test_noisy_basis_simple():
    rng = np.random.RandomState(seed=1)
    noisy_basis = NoisyBasis(
        NoisyOperation.from_cirq(ideal=cirq.I, real=rng.rand(4, 4)),
        NoisyOperation.from_cirq(ideal=cirq.X, real=rng.rand(4, 4)),
        NoisyOperation.from_cirq(ideal=cirq.Y, real=rng.rand(4, 4)),
        NoisyOperation.from_cirq(ideal=cirq.Z, real=rng.rand(4, 4)),
    )
    assert len(noisy_basis) == 4
    assert noisy_basis.all_qubits() == {cirq.LineQubit(0)}
Esempio n. 2
0
def test_noisy_basis_simple():
    rng = np.random.RandomState(seed=1)
    noisy_basis = NoisyBasis(
        NoisyOperation.from_cirq(circuit=cirq.I, channel_matrix=rng.rand(4,
                                                                         4)),
        NoisyOperation.from_cirq(circuit=cirq.X, channel_matrix=rng.rand(4,
                                                                         4)),
        NoisyOperation.from_cirq(circuit=cirq.Y, channel_matrix=rng.rand(4,
                                                                         4)),
        NoisyOperation.from_cirq(circuit=cirq.Z, channel_matrix=rng.rand(4,
                                                                         4)),
    )
    assert len(noisy_basis) == 4
    assert noisy_basis.all_qubits() == {cirq.LineQubit(0)}