Esempio n. 1
0
 def perp_grad_space_basis(self, p=None):
     p = self.p if p is None else p
     if p > 1:
         phi = self.basis(p=p - 1)
         return sp.BlockMatrix([phi[2] * phi, -phi[1] * phi])
     else:
         return sp.ZeroMatrix(2, 1)
Esempio n. 2
0
 def sym_grad_vector_basis(self, p=None):
     phi = self.basis(p=p)
     zero = sp.ZeroMatrix(1, phi.cols)
     A00 = sp.BlockMatrix([[phi.diff(self.x), zero]])
     A11 = sp.BlockMatrix([[zero, phi.diff(self.y)]])
     A01 = sp.BlockMatrix([[phi.diff(self.y) / 2, phi.diff(self.x) / 2]])
     return A00, A11, A01
Esempio n. 3
0
def density_density_entangler_propagator(α, β, Λ, δ):
    """
    β is the interaction strength: β \int n(x) n(y) exp(-Λ|x-y|) dx dy
    """
    ϵ = sympy.symbols('e')
    b = sympy.Matrix(np.array([[0, 1], [0, 0]]))
    bd = b.T
    n = bd * b
    A = sympy.Identity(6) * (1 - ϵ * Λ)
    B = np.concatenate([
        np.sqrt(1j * α) * sympy.sqrt(ϵ) * bd,
        np.sqrt(-1j * α) * sympy.sqrt(ϵ) * b,
        np.sqrt(2 * β) * n
    ],
                       axis=0)
    C = np.concatenate([
        np.sqrt(1j * α) * sympy.sqrt(ϵ) * bd,
        np.sqrt(-1j * α) * sympy.sqrt(ϵ) * b,
        np.sqrt(2 * β) * n
    ],
                       axis=1)
    D = sympy.ZeroMatrix(2, 2)
    tmp1 = np.concatenate([sympy.Identity(2) + δ * D, np.sqrt(δ) * C], axis=1)
    tmp2 = np.concatenate([np.sqrt(δ) * B, A], axis=1)
    tmp = np.concatenate([tmp1, tmp2], axis=0)
    cmpo = np.transpose(np.reshape(tmp, (4, 2, 4, 2)),
                        (0, 2, 1, 3))  #(M, M, dout, din)
    Gammas = [[None, None], [None, None]]
    for d1, d2 in itertools.product([0, 1], [0, 1]):
        M = cmpo.shape[0]
        tmp = np.zeros((M, M), dtype=np.complex128)
        if d1 != d2:
            cmpo_tmp = cmpo[:, :, d1, d2]
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].coeff('sqrt(e)'))
        elif (d1 == 0) and (d2 == 0):
            cmpo_tmp = cmpo[:, :, d1, d2] - sympy.Identity(M)
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].coeff('e'))

        elif (d1 == 1) and (d2 == 1):
            cmpo_tmp = cmpo[:, :, d1, d2] - sympy.Identity(M)
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].subs([('e', 0),
                                                             ('sqrt(e)', 0)]))

        Gammas[d1][d2] = tmp
    return Gammas
Esempio n. 4
0
def free_boson_entangler_propagator(α, Λ, δ):
    """
    Generate the mpo representation of the entangling evolution for a free scalar, massless boson
    the implemented operator is  -1j*alpha/2\int dx dy exp(-Lambda*abs(x-y))*(psi(x)psi(y)-psidag(x)psidag(y))
    for alpha =Lambda/4, this gives the cMERA evolution operator for the free Boson theory with a UV-cutoff=Lambda; 
    The MPO is obtained from Gammas as 
    11 + dx * Gamma[0][0], sqrt(dx) Gamma[0][1]
    sqrt(dx) Gamma[1][0], 11 + Gamma[1][1]
    
    Parameters:
    -----------------
    alpha:    float or None
              the strength of the entangler; if None, alpha=cutoff/4
    Lambda:   float
              UV cutoff (see description above)
    delta:    float or complex
              time step of the entangling evolution; use np.real(delta) == 0, np.imag(delta) > 0 for lorentzian evolution

    Returns:
    -----------------
    Gamma: list of length 2 of list of length 2 of np.ndarray: 
           the cMPO matrices of the entangling propagator, in column major ordering
           The index convention is: 
           Gamma[a][b]:   a is the outgoing physical index, b is the incoming physical index
                          e.g. index a is contracted with the MPS:
                          Q_out = kron(11,Gamma[0][0])+kron(Q_in,11)+kron(R_in,Gamma[0][1])
                          R_out = kron(11,Gamma[1][0])+kron(R_in, 11 + Gamma[1][1])

    """
    ϵ = sympy.symbols('e')
    b = sympy.Matrix(np.array([[0, 1], [0, 0]]))
    bd = b.T
    n = bd * b
    A = sympy.Identity(4) * (1 - ϵ * Λ)
    B = np.concatenate([
        np.sqrt(1j * α) * sympy.sqrt(ϵ) * bd,
        np.sqrt(-1j * α) * sympy.sqrt(ϵ) * b
    ],
                       axis=0)
    C = np.concatenate([
        np.sqrt(1j * α) * sympy.sqrt(ϵ) * bd,
        np.sqrt(-1j * α) * sympy.sqrt(ϵ) * b
    ],
                       axis=1)
    D = sympy.ZeroMatrix(2, 2)
    tmp1 = np.concatenate([sympy.Identity(2) + δ * D, np.sqrt(δ) * C], axis=1)
    tmp2 = np.concatenate([np.sqrt(δ) * B, A], axis=1)
    tmp = np.concatenate([tmp1, tmp2], axis=0)
    cmpo = np.transpose(np.reshape(tmp, (3, 2, 3, 2)),
                        (0, 2, 1, 3))  #(M, M, dout, din)
    Gammas = [[None, None], [None, None]]
    for d1, d2 in itertools.product([0, 1], [0, 1]):
        M = cmpo.shape[0]
        tmp = np.zeros((M, M), dtype=np.complex128)
        if d1 != d2:
            cmpo_tmp = cmpo[:, :, d1, d2]
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].coeff('sqrt(e)'))
        elif (d1 == 0) and (d2 == 0):
            cmpo_tmp = cmpo[:, :, d1, d2] - sympy.Identity(M)
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].coeff('e'))

        elif (d1 == 1) and (d2 == 1):
            cmpo_tmp = cmpo[:, :, d1, d2] - sympy.Identity(M)
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].subs([('e', 0),
                                                             ('sqrt(e)', 0)]))

        Gammas[d1][d2] = tmp
    return Gammas
Esempio n. 5
0
def o1_o2_o3_o4_gammas(o1, o2, o3, o4, γ, Λ, δ):
    """
    γ is the interaction strength: γ \int_{w<x<y<z} ϕ(w)π(x)π(y)π(z) exp(-Λ|w-z|) dw dx dy dz
    """
    ϵ = sympy.symbols('e')
    A = np.concatenate([
        np.concatenate([
            sympy.Identity(2) *
            (1 - ϵ * Λ), γ * sympy.sqrt(ϵ) * sympy.Matrix(o2),
            sympy.ZeroMatrix(2, 2)
        ],
                       axis=1),
        np.concatenate([
            sympy.ZeroMatrix(2, 2),
            sympy.Identity(2) *
            (1 - ϵ * Λ), γ * sympy.sqrt(ϵ) * sympy.Matrix(o3)
        ],
                       axis=1),
        np.concatenate([
            sympy.ZeroMatrix(2, 2),
            sympy.ZeroMatrix(2, 2),
            sympy.Identity(2) * (1 - ϵ * Λ)
        ],
                       axis=1)
    ],
                       axis=0)
    B = np.concatenate([
        sympy.ZeroMatrix(2, 2),
        sympy.ZeroMatrix(2, 2), γ * sympy.sqrt(ϵ) * sympy.Matrix(o4)
    ],
                       axis=0)
    C = np.concatenate([
        γ * sympy.sqrt(ϵ) * sympy.Matrix(o1),
        sympy.ZeroMatrix(2, 2),
        sympy.ZeroMatrix(2, 2)
    ],
                       axis=1)
    D = sympy.ZeroMatrix(2, 2)
    tmp1 = np.concatenate([sympy.Identity(2) + δ * D, np.sqrt(δ) * C], axis=1)
    tmp2 = np.concatenate([np.sqrt(δ) * B, A], axis=1)
    tmp = np.concatenate([tmp1, tmp2], axis=0)
    cmpo = np.transpose(np.reshape(tmp, (4, 2, 4, 2)),
                        (0, 2, 1, 3))  #(M, M, dout, din)
    Gammas = [[None, None], [None, None]]
    for d1, d2 in itertools.product([0, 1], [0, 1]):
        M = cmpo.shape[0]
        tmp = np.zeros((M, M), dtype=np.complex128)
        if d1 != d2:
            cmpo_tmp = cmpo[:, :, d1, d2]
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].coeff('sqrt(e)'))
        elif (d1 == 0) and (d2 == 0):
            cmpo_tmp = cmpo[:, :, d1, d2] - sympy.Identity(M)
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].coeff('e'))

        elif (d1 == 1) and (d2 == 1):
            cmpo_tmp = cmpo[:, :, d1, d2] - sympy.Identity(M)
            for a1, a2 in itertools.product(range(M), range(M)):
                tmp[a1, a2] = complex(cmpo_tmp[a1, a2].subs([('e', 0),
                                                             ('sqrt(e)', 0)]))

        Gammas[d1][d2] = tmp
    return Gammas
Esempio n. 6
0
 def vector_basis(self, p=None):
     phi = self.basis(p=p)
     zero = sp.ZeroMatrix(1, phi.cols)
     return sp.BlockMatrix([[phi, zero], [zero, phi]])