示例#1
0
def expT_2order_1D(nbits, dt, hbar, c):
    """
	Simulate exp(-i*dt*T/hbar)
	error = O(dt^2)
	"""
    M = c * np.asmatrix([[1, -1], [-1, 1]])
    expM = qo.Qoperator(1, qo.matpowerh(np.power(np.e, -1j), (dt / hbar) * M))
    expTeven = qo.directopprod(identityop(nbits - 1), expM)
    P = cyperm_op(nbits)
    Pinv = qo.Qoperator(nbits, P.matrix.H)
    U = expTeven.matrix * P.matrix * expTeven.matrix * Pinv.matrix
    return qo.Qoperator(nbits, U)
示例#2
0
def expT_2order_1D(nbits,dt,hbar,c):
	"""
	Simulate exp(-i*dt*T/hbar)
	error = O(dt^2)
	"""
	M = c*np.asmatrix([[1,-1],[-1,1]])
	expM = qo.Qoperator(1,qo.matpowerh(np.power(np.e,-1j), (dt/hbar)*M))
	expTeven = qo.directopprod(identityop(nbits-1),expM)
	P = cyperm_op(nbits)
	Pinv = qo.Qoperator(nbits,P.matrix.H)
	U = expTeven.matrix * P.matrix * expTeven.matrix * Pinv.matrix
	return qo.Qoperator(nbits,U)
示例#3
0
def expH_3order_1D(nbits,dt,hbar,c,expV):
	"""
	Simulate exp(-i*dt*T/hbar)
	error = O(dt^3)
	"""
	M = c*np.asmatrix([[1,-1],[-1,1]])
	expM = qo.Qoperator(1,qo.matpowerh(np.power(np.e,-1j), (0.5*dt/hbar)*M))
	expTeven = qo.directopprod(identityop(nbits-1),expM)
	P = cyperm_op(nbits)
	Pinv = qo.Qoperator(nbits,P.matrix.H)
	U1 = expTeven.matrix * Pinv.matrix * expTeven.matrix * P.matrix
	U2 = P.matrix * expTeven.matrix * Pinv.matrix * expTeven.matrix  #XXX Check correctness of U1 and U2
	U = U1 * expV * U2
	return qo.Qoperator(nbits,U)
示例#4
0
def expH_3order_1D(nbits, dt, hbar, c, expV):
    """
	Simulate exp(-i*dt*T/hbar)
	error = O(dt^3)
	"""
    M = c * np.asmatrix([[1, -1], [-1, 1]])
    expM = qo.Qoperator(
        1, qo.matpowerh(np.power(np.e, -1j), (0.5 * dt / hbar) * M))
    expTeven = qo.directopprod(identityop(nbits - 1), expM)
    P = cyperm_op(nbits)
    Pinv = qo.Qoperator(nbits, P.matrix.H)
    U1 = expTeven.matrix * Pinv.matrix * expTeven.matrix * P.matrix
    U2 = P.matrix * expTeven.matrix * Pinv.matrix * expTeven.matrix  #XXX Check correctness of U1 and U2
    U = U1 * expV * U2
    return qo.Qoperator(nbits, U)
示例#5
0
def expH_2order_2D(nxbits, nybits, dt, hbar, c, expV):
    """
	Simulate exp(-i*dt*H/hbar)
	error = O(dt^2)
	"""
    nbits = nxbits + nybits
    M = c * np.asmatrix([[1, -1], [-1, 1]])
    expM = qo.Qoperator(1, qo.matpowerh(np.power(np.e, -1j), (dt / hbar) * M))
    expTeven = qo.directopprod(identityop(nbits - 1), expM)
    P = cyperm_op(nxbits)
    P1 = qo.directopprod(identityop(nybits), P)
    P1inv = qo.Qoperator(nbits, P1.matrix.H)
    expTodd = qo.Qoperator(nbits, P1inv.matrix * expTeven.matrix * P1.matrix)
    #TODO Find a linear algebra realization of the switching opeartor
    S = switchop(nxbits, nybits)
    expTup = qo.Qoperator(nbits, S.matrix.H * expTeven.matrix * S.matrix)
    expTdown = qo.Qoperator(nbits, S.matrix.H * expTodd.matrix * S.matrix)
    U1 = expTeven.matrix * expTodd.matrix * expTup.matrix * expTdown.matrix
    U = U1 * expV
    return qo.Qoperator(nbits, U)
示例#6
0
def expH_2order_2D(nxbits,nybits,dt,hbar,c,expV):
	"""
	Simulate exp(-i*dt*H/hbar)
	error = O(dt^2)
	"""
	nbits = nxbits + nybits
	M = c*np.asmatrix([[1,-1],[-1,1]])
	expM = qo.Qoperator(1,qo.matpowerh(np.power(np.e,-1j), (dt/hbar)*M))
	expTeven = qo.directopprod(identityop(nbits-1),expM)
	P = cyperm_op(nxbits)
	P1 = qo.directopprod(identityop(nybits),P)
	P1inv = qo.Qoperator(nbits,P1.matrix.H)
	expTodd = qo.Qoperator(nbits,P1inv.matrix * expTeven.matrix * P1.matrix)
	#TODO Find a linear algebra realization of the switching opeartor
	S = switchop(nxbits,nybits)
	expTup =   qo.Qoperator(nbits,S.matrix.H * expTeven.matrix * S.matrix)
	expTdown = qo.Qoperator(nbits,S.matrix.H * expTodd.matrix * S.matrix)
	U1 = expTeven.matrix * expTodd.matrix * expTup.matrix * expTdown.matrix
	U = U1 * expV 
	return qo.Qoperator(nbits, U)