psi[0, 0, 0, 0, 0, 1, 0, 0, 0, 0] = 1. psi[0, 0, 0, 0, 0, 0, 1, 0, 0, 0] = 1. psi[0, 0, 0, 0, 0, 0, 0, 1, 0, 0] = 1. psi[0, 0, 0, 0, 0, 0, 0, 0, 1, 0] = 1.j psi[0, 0, 0, 0, 0, 0, 0, 0, 0, 1] = 1. wf = wf.wavefunction() wf.addwf(psi, n, alphabet) #wf.random_wavefunction(n, alphabet) z = np.array([[1, 0], [0, -1]]) x = np.array([[0, 1], [1, 0]]) expectation_wf = [] for i in range(n): expectation_wf.append(wf.SingleSpinMeasurement(i, z)) expectation_mps = np.zeros((n, t_max), dtype=complex) expectation_graph = np.zeros((n, t_max), dtype=complex) correlations_mps = np.zeros((n, t_max), dtype=complex) correlations_graph = np.zeros((n, t_max), dtype=complex) model = mps.MPS('OPEN') s = time.time() model.wavefunction2mps(wf.tensor, k) e = time.time() print('wf 2 mps time is:', e - s) for t in range(t_max): s = time.time() graph = denfg.Graph()
import DEnFG as denfg k = 6 n = 4 alphabet = 2 t_max = 20 error = 1e-6 psi = np.array([[[[1., 1.], [2., 0.5 + 3.j]], [[4., 8.j], [-1.j, 2.]]], [[[4., 1.j], [2., 1.j]], [[3.j, 4.], [2., 1.j]]]]) #psi = np.array([[[[1., 0.], [0., 0.j]], [[0., 0.j], [0.j, 0.]]], [[[1.j, 0.j], [0., 0.j]], [[0.j, 0.], [0., 0.j]]]]) wf = wf.wavefunction() wf.addwf(psi, n, alphabet) z = np.array([[1, 0], [0, -1]]) expectation_z0_wf = wf.SingleSpinMeasurement(0, z) expectation_z1_wf = wf.SingleSpinMeasurement(1, z) expectation_z2_wf = wf.SingleSpinMeasurement(2, z) expectation_z3_wf = wf.SingleSpinMeasurement(3, z) expectation_z0_mps = [] expectation_z1_mps = [] expectation_z2_mps = [] expectation_z3_mps = [] expectation_z0_graph = [] expectation_z1_graph = [] expectation_z2_graph = [] expectation_z3_graph = []
psi = np.array([[[[[[-0.5, 0.], [0., 0.j]], [[0., 0.j], [0.j, 0.]]], [[[0., 0.j], [0., 0.j]], [[0.j, 0.], [0., 0.j]]]], [[[[1.j, 0.], [0., 0.j]], [[0., 0.j], [0.j, 0.]]], [[[0., 0.j], [0., 0.j]], [[0.j, 0.], [0., 0.j]]]]], [[[[[0.2j, 0.], [0., 0.j]], [[0., 0.j], [0.j, 0.]]], [[[0., 0.j], [-0.5, 0.j]], [[0.j, 0.], [0., 0.j]]]], [[[[1., 0.], [0., 0.j]], [[0., 0.j], [0.j, 0.]]], [[[0., 0.j], [0., 0.j]], [[0.j, 0.], [0., 0.]]]]]]) ''' error1 = [] error2 = [] wf = wf.wavefunction() wf.random_wavefunction(n, alphabet) expectation_wf = [] z = np.array([[1, 0], [0, -1]]) for i in range(n - 1): b = wf.SingleSpinMeasurement(i, z) expectation_wf.append(b[0, 0]) for i in range(1, k): print(i) #wf.addwf(psi, n, alphabet) #wf.random_wavefunction(n, alphabet) expectation_mps1 = np.zeros(n - 1, dtype=complex) expectation_mps2 = np.zeros(n - 1, dtype=complex) model1 = mps.MPS('OPEN') s = time.time() model1.wavefunction2mps(wf.tensor, i) e = time.time() print(e - s, ' 1')