Пример #1
0
    def _define_fixed_operators(self):
        N1 = self.N1
        N2 = self.N2

        self.I = tensor([ops.identity(N1), ops.identity(N2)])
        self.a1 = tensor([ops.destroy(N1), ops.identity(N2)])
        self.a1_dag = tensor([ops.create(N1), ops.identity(N2)])
        self.a2 = tensor([ops.identity(N1), ops.destroy(N2)])
        self.a2_dag = tensor([ops.identity(N1), ops.create(N2)])
        self.q1 = tensor([ops.position(N1), ops.identity(N2)])
        self.p1 = tensor([ops.momentum(N1), ops.identity(N2)])
        self.n1 = tensor([ops.num(N1), ops.identity(N2)])
        self.q2 = tensor([ops.identity(N1), ops.position(N2)])
        self.p2 = tensor([ops.identity(N1), ops.momentum(N2)])
        self.n2 = tensor([ops.identity(N1), ops.num(N2)])
        self.parity1 = tensor([ops.parity(N1), ops.identity(N2)])
        self.parity2 = tensor([ops.identity(N1), ops.parity(N2)])

        tensor_with = [None, ops.identity(N2)]
        self.translate1 = ops.TranslationOperator(N1, tensor_with=tensor_with)
        self.displace1 = lambda a: self.translate1(sqrt(2) * a)
        self.rotate1 = ops.RotationOperator(N1, tensor_with=tensor_with)

        tensor_with = [ops.identity(N1), None]
        self.translate2 = ops.TranslationOperator(N2, tensor_with=tensor_with)
        self.displace2 = lambda a: self.translate2(sqrt(2) * a)
        self.rotate2 = ops.RotationOperator(N2, tensor_with=tensor_with)
Пример #2
0
    def _define_fixed_operators(self):
        N = self.N
        self.I = ops.identity(N)
        self.a = ops.destroy(N)
        self.a_dag = ops.create(N)
        self.q = ops.position(N)
        self.p = ops.momentum(N)
        self.n = ops.num(N)
        self.parity = ops.parity(N)
        self.phase = ops.Phase()

        self.rotate = ops.RotationOperator(N)
        self.translate = ops.TranslationOperator(N)
        self.displace = lambda a: self.translate(sqrt(2) * a)
        self.SNAP = ops.SNAP(N)
Пример #3
0
    def _define_fixed_operators(self):
        N = self.N
        N_large = self._N_large
        self.I = tensor([ops.identity(2), ops.identity(N)])
        self.a = tensor([ops.identity(2), ops.destroy(N)])
        self.a_dag = tensor([ops.identity(2), ops.create(N)])
        self.q = tensor([ops.identity(2), ops.position(N)])
        self.p = tensor([ops.identity(2), ops.momentum(N)])
        self.n = tensor([ops.identity(2), ops.num(N)])
        self.parity = tensor([ops.identity(2), ops.parity(N)])

        self.sx = tensor([ops.sigma_x(), ops.identity(N)])
        self.sy = tensor([ops.sigma_y(), ops.identity(N)])
        self.sz = tensor([ops.sigma_z(), ops.identity(N)])
        self.sm = tensor([ops.sigma_m(), ops.identity(N)])

        tensor_with = [ops.identity(2), None]
        self.phase = ops.Phase()
        self.translate = ops.TranslationOperator(N, tensor_with=tensor_with)
        self.displace = lambda a: self.translate(sqrt(2) * a)
        self.rotate = ops.RotationOperator(N, tensor_with=tensor_with)

        # displacement operators with larger intermediate hilbert space used for tomography
        self.translate_large = lambda a: tensor(
            [ops.identity(2), ops.TranslationOperator(N_large)(a)[:, :N, :N]]
        )
        self.displace_large = lambda a: self.translate_large(sqrt(2) * a)
        self.displaced_parity_large = lambda a: tf.linalg.matmul(
            tf.linalg.matmul(self.displace_large(a), self.parity),
            self.displace_large(-a),
        )

        tensor_with = [None, ops.identity(N)]
        self.rotate_qb_xy = ops.QubitRotationXY(tensor_with=tensor_with)
        self.rotate_qb_z = ops.QubitRotationZ(tensor_with=tensor_with)
        self.rxp = self.rotate_qb_xy(tf.constant(pi / 2), tf.constant(0))
        self.rxm = self.rotate_qb_xy(tf.constant(-pi / 2), tf.constant(0))

        # qubit sigma_z measurement projector
        self.P = {i: tensor([ops.projector(i, 2), ops.identity(N)]) for i in [0, 1]}

        self.sx_selective = tensor([ops.sigma_x(), ops.projector(0, N)]) + tensor(
            [ops.identity(2), ops.identity(N) - ops.projector(0, N)]
        )
Пример #4
0
    def _define_fixed_operators(self):
        N = self.N
        self.I = tensor([ops.identity(2), ops.identity(N)])
        self.a = tensor([ops.identity(2), ops.destroy(N)])
        self.a_dag = tensor([ops.identity(2), ops.create(N)])
        self.q = tensor([ops.identity(2), ops.position(N)])
        self.p = tensor([ops.identity(2), ops.momentum(N)])
        self.n = tensor([ops.identity(2), ops.num(N)])
        self.parity = tensor([ops.identity(2), ops.parity(N)])

        self.sx = tensor([ops.sigma_x(), ops.identity(N)])
        self.sy = tensor([ops.sigma_y(), ops.identity(N)])
        self.sz = tensor([ops.sigma_z(), ops.identity(N)])
        self.sm = tensor([ops.sigma_m(), ops.identity(N)])
        self.hadamard = tensor([ops.hadamard(), ops.identity(N)])

        tensor_with = [ops.identity(2), None]
        self.phase = ops.Phase()
        self.translate = ops.TranslationOperator(N, tensor_with=tensor_with)
        self.displace = lambda a: self.translate(sqrt(2) * a)
        self.rotate = ops.RotationOperator(N, tensor_with=tensor_with)

        self.SNAP = ops.SNAP(N, tensor_with=tensor_with)
        self.SNAP_miscalibrated = ops.SNAPv3(N, chi=1e6, pulse_len=3.4e-6)

        tensor_with = [None, ops.identity(N)]
        self.rotate_qb_xy = ops.QubitRotationXY(tensor_with=tensor_with)
        self.rotate_qb_z = ops.QubitRotationZ(tensor_with=tensor_with)
        self.rxp = self.rotate_qb_xy(tf.constant(pi / 2), tf.constant(0))
        self.rxm = self.rotate_qb_xy(tf.constant(-pi / 2), tf.constant(0))

        # qubit sigma_z measurement projector
        self.P = {
            i: tensor([ops.projector(i, 2),
                       ops.identity(N)])
            for i in [0, 1]
        }

        self.sx_selective = tensor([ops.sigma_x(), ops.projector(0, N)]) + \
            tensor([ops.identity(2), ops.identity(N)-ops.projector(0, N)])
Пример #5
0
 def test_momentum(self):
     a = qt.destroy(self.N)
     a_dag = qt.create(self.N)
     p = 1j * (a_dag - a) / np.sqrt(2)
     npt.assert_array_equal(momentum(self.N),
                            tf.cast(p.full(), dtype=tf.complex64))
Пример #6
0
                   method='Nelder-Mead',
                   options=dict(maxiter=300))
    Ej, Ec, freq_a, V = res.x
else:
    Ec = 188598981
    Ej = 21608836632
    freq_a = 4481053074
    V = 23249563

# create operators in the joint Hilbert space
H0, H = Hamiltonian(Ej, Ec, freq_a, V)
U = ops.HamiltonianEvolutionOperator(H)
U0 = ops.HamiltonianEvolutionOperator(H0)
D = ops.DisplacementOperator(N_cav, tensor_with=[ops.identity(L), None])
q = tensor([ops.identity(L), ops.position(N_cav)])
p = tensor([ops.identity(L), ops.momentum(N_cav)])

SIMULATE_TIME_EVOLUTION = False
# simulate rotation of the displaced state
# Because H=const, this can be done with large steps in time
if SIMULATE_TIME_EVOLUTION:
    dt = 10e-9
    STEPS = 100
    times = tf.range(STEPS, dtype=tf.float32) * dt

    alpha = 20
    vac = Kronecker_product([basis(0, L), basis(0, N_cav)])
    psi0 = tf.linalg.matvec(D(alpha), vac)
    psi, psi_int = psi0, psi0
    U_dt, U0_dt = U(dt), U0(dt)
    U0_t = ops.identity(L * N_cav)
 def __init__(self):
     self.p = momentum(100)
     self.q = position(100)
     super().__init__()