Skip to content

noise/kraus.py

class GAD

Generalized amplitude damping (GAD) Kraus operators for a d-level system.

Provides Kraus operators {Ak,Rk} parameterized by environment excitation probability p and damping parameter Y.

A

Construct the GAD lowering Kraus operator Ak.

This operator maps population from |r to |rk with weights determined by (Y,p).

py
def A(order: int, d: int, Y: float, p: float) -> Error [static]
Implementation
python
def A(order: int, d: int, Y: float, p: float=0.0) -> Error:
    k = order
    assert isinstance(k, int) and k >= 0, 'k must be int>=0'
    assert isinstance(d, int) and d > 0, 'd must be int>0'
    obj = np.zeros((d, d), dtype=C128)
    for r in range(k, d):
        a, b = ((r - k) / 2, k / 2)
        obj[r - k][r] = nCr(r, k) * (1 - Y) ** a * Y ** b
    return Error(d, np.sqrt(1 - p) * obj, f'A{k}', {'Y': Y, 'k': k, 'p': p})

R

Construct the GAD raising Kraus operator Rk.

This operator maps population from |r to |r+k with weights determined by (Y,p).

py
def R(k: int, d: int, Y: float, p: float) -> Error [static]
Implementation
python
def R(k: int, d: int, Y: float, p: float=0.0) -> Error:
    obj = np.zeros((d, d), dtype=C128)
    for r in range(d - k):
        a, b = ((d - r - k - 1) / 2, k / 2)
        obj[r + k][r] = nCr(d - r - 1, k) * (1 - Y) ** a * Y ** b
    return Error(d, np.sqrt(p) * obj, f'R{k}', {'Y': Y, 'k': k, 'p': p})

class Pauli

Single-qubit Pauli error operators as Kraus operators.

Each method returns pσ for σ{X,Y,Z} and an identity term 1piI.

X

Return the bit-flip Kraus operator pX.

py
def X(p: float) -> Error [static]
Implementation
python
def X(p: float) -> Error:
    x = np.sqrt(p) * np.array([[0, 1], [1, 0]], dtype=C128)
    return Error(2, x, 'X', {'p': p})

Y

Return the phase+bit-flip Kraus operator pY.

py
def Y(p: float) -> Error [static]
Implementation
python
def Y(p: float) -> Error:
    y = np.sqrt(p) * np.array([[0, -1j], [1j, 0]], dtype=C128)
    return Error(2, y, 'Y', {'p': p})

Z

Return the phase-flip Kraus operator pZ.

py
def Z(p: float) -> Error [static]
Implementation
python
def Z(p: float) -> Error:
    z = np.sqrt(p) * np.array([[1, 0], [0, -1]], dtype=C128)
    return Error(2, z, 'Z', {'p': p})

I

Return the identity Kraus operator 1ipiI.

py
def I(ps: List[float]) -> Error [static]
Implementation
python
def I(ps: List[float]) -> Error:
    p = np.sqrt(1 - np.sum(ps))
    i = p * np.array([[1, 0], [0, 1]], dtype=C128)
    return Error(2, i, 'I', {'p': p})