How to use the qutip.sigmax function in qutip

To help you get started, we’ve selected a few qutip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qucontrol / krotov / tests / test_objectives.py View on Github external
def objective_with_c_ops():
    u1 = lambda t, args: 1.0
    u2 = lambda t, args: 1.0
    a1 = np.random.random(100) + 1j * np.random.random(100)
    a2 = np.random.random(100) + 1j * np.random.random(100)
    H = [
        tensor(sigmaz(), identity(2)) + tensor(identity(2), sigmaz()),
        [tensor(sigmax(), identity(2)), u1],
        [tensor(identity(2), sigmax()), u2],
    ]
    C1 = [[tensor(identity(2), sigmap()), a1]]
    C2 = [[tensor(sigmap(), identity(2)), a2]]
    ket00 = ket((0, 0))
    ket11 = ket((1, 1))
    obj = krotov.Objective(
        initial_state=ket00, target=ket11, H=H, c_ops=[C1, C2]
    )
    return obj
github qucontrol / krotov / tests / test_objectives.py View on Github external
def two_qubit_liouvillian():
    H = [
        tensor(sigmaz(), identity(2)) + tensor(identity(2), sigmaz()),
        [tensor(sigmax(), identity(2)), lambda t, args: 1.0],
        [tensor(identity(2), sigmax()), lambda t, args: 1.0],
    ]
    c_ops = [tensor(sigmam(), identity(2)), tensor(identity(2), sigmam())]
    return krotov.objectives.liouvillian(H, c_ops)
github SoftwareQuTech / SimulaQron / tests / auto / pythonLib / test_single_qubit.py View on Github external
def prep_H_qutip():
    q = qutip.basis(2)
    X = 1 / np.sqrt(2) * (qutip.sigmax() + qutip.sigmaz())
    return X * q
github qucontrol / krotov / tests / test_mu.py View on Github external
"""Test the calculation of μ if the same control appears more than once"""
    objectives, pulses, pulses_mapping = tls_control_system
    # distinction between controls and pulses doesn't matter here, we're only
    # considering linear controls and don't plug in any time_index
    i_objective = 0
    mu = krotov.mu.derivative_wrt_pulse(
        objectives,
        i_objective,
        pulses,
        pulses_mapping,
        i_pulse=0,
        time_index=0,
    )
    # 0.5 * (σ₊ + σ₋) = σₓ
    for state in (ket('0'), ket('1')):
        assert (mu(state) - (sigmax())(state)).norm('max') == 0
        assert (mu(state)).dims == state.dims
github crazy4pi314 / learn-qc-with-python-and-qsharp / ch04 / simulator.py View on Github external
def x(self) -> None:
        self.parent._apply(qt.sigmax(), [self.qubit_id])
github crazy4pi314 / learn-qc-with-python-and-qsharp / ch05 / simulator.py View on Github external
def x(self) -> None:
        self.parent._apply(qt.sigmax(), [self.qubit_id])                 # <2>
github qutip / qutip / qutip / piqs.py View on Github external
Returns
    -------
    spin_operators: list or :class: qutip.Qobj
        A list of `qutip.Qobj` operators - [sx, sy, sz] or the
        requested operator.
    """
    # 1. Define N TLS spin-1/2 matrices in the uncoupled basis
    N = int(N)
    sx = [0 for i in range(N)]
    sy = [0 for i in range(N)]
    sz = [0 for i in range(N)]
    sp = [0 for i in range(N)]
    sm = [0 for i in range(N)]

    sx[0] = 0.5 * sigmax()
    sy[0] = 0.5 * sigmay()
    sz[0] = 0.5 * sigmaz()
    sp[0] = sigmap()
    sm[0] = sigmam()

    # 2. Place operators in total Hilbert space
    for k in range(N - 1):
        sx[0] = tensor(sx[0], identity(2))
        sy[0] = tensor(sy[0], identity(2))
        sz[0] = tensor(sz[0], identity(2))
        sp[0] = tensor(sp[0], identity(2))
        sm[0] = tensor(sm[0], identity(2))

    # 3. Cyclic sequence to create all N operators
    a = [i for i in range(N)]
    b = [[a[i - i2] for i in range(N)] for i2 in range(N)]