Skip to content

ideal_qubit

IdealQubit.

IdealQubit

Bases: Device

Ideal qubit Device.

Source code in jaxquantum/devices/superconducting/ideal_qubit.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@struct.dataclass
class IdealQubit(Device):
    """
    Ideal qubit Device.
    """

    @classmethod
    def param_validation(cls, N, N_pre_diag, params, hamiltonian, basis):
        """This can be overridden by subclasses."""
        assert basis == BasisTypes.fock, (
            "IdealQubit is a two-level system defined in the Fock basis."
        )
        assert hamiltonian == HamiltonianTypes.full, (
            "IdealQubit requires a full Hamiltonian."
        )
        assert N == N_pre_diag == 2, "IdealQubit is a two-level system."
        assert "ω" in params, "IdealQubit requires a frequency parameter 'ω'."

    def common_ops(self):
        """Written in the linear basis."""
        ops = {}

        assert self.N_pre_diag == 2
        assert self.N == 2

        N = self.N_pre_diag
        ops["id"] = identity(N)
        ops["sigmaz"] = sigmaz()
        ops["sigmax"] = sigmax()
        ops["sigmay"] = sigmay()
        ops["sigmam"] = sigmam()
        ops["sigmap"] = sigmap()

        return ops

    def get_linear_ω(self):
        """Get frequency of linear terms."""
        return self.params["ω"]

    def get_H_linear(self):
        """Return linear terms in H."""
        w = self.get_linear_ω()
        return (w / 2) * self.linear_ops["sigma_z"]

    def get_H_full(self):
        """Return full H in linear basis."""
        return self.get_H_linear()

common_ops()

Written in the linear basis.

Source code in jaxquantum/devices/superconducting/ideal_qubit.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def common_ops(self):
    """Written in the linear basis."""
    ops = {}

    assert self.N_pre_diag == 2
    assert self.N == 2

    N = self.N_pre_diag
    ops["id"] = identity(N)
    ops["sigmaz"] = sigmaz()
    ops["sigmax"] = sigmax()
    ops["sigmay"] = sigmay()
    ops["sigmam"] = sigmam()
    ops["sigmap"] = sigmap()

    return ops

get_H_full()

Return full H in linear basis.

Source code in jaxquantum/devices/superconducting/ideal_qubit.py
57
58
59
def get_H_full(self):
    """Return full H in linear basis."""
    return self.get_H_linear()

get_H_linear()

Return linear terms in H.

Source code in jaxquantum/devices/superconducting/ideal_qubit.py
52
53
54
55
def get_H_linear(self):
    """Return linear terms in H."""
    w = self.get_linear_ω()
    return (w / 2) * self.linear_ops["sigma_z"]

get_linear_ω()

Get frequency of linear terms.

Source code in jaxquantum/devices/superconducting/ideal_qubit.py
48
49
50
def get_linear_ω(self):
    """Get frequency of linear terms."""
    return self.params["ω"]

param_validation(N, N_pre_diag, params, hamiltonian, basis) classmethod

This can be overridden by subclasses.

Source code in jaxquantum/devices/superconducting/ideal_qubit.py
19
20
21
22
23
24
25
26
27
28
29
@classmethod
def param_validation(cls, N, N_pre_diag, params, hamiltonian, basis):
    """This can be overridden by subclasses."""
    assert basis == BasisTypes.fock, (
        "IdealQubit is a two-level system defined in the Fock basis."
    )
    assert hamiltonian == HamiltonianTypes.full, (
        "IdealQubit requires a full Hamiltonian."
    )
    assert N == N_pre_diag == 2, "IdealQubit is a two-level system."
    assert "ω" in params, "IdealQubit requires a frequency parameter 'ω'."