def determine_grid(self): #key = [self.inputs['dim'], self.inputs['kmax'], self.inputs['lmax'], self.inputs['mmax'], self.inputs['nmax']] key = list(self.inputs.values()) tab1 = bootstrap.ConformalBlockTable(*key) tab2 = bootstrap.ConvolvedBlockTable(tab1) # Instantiate a Grid object with appropriate input values. grid = Grid(*key, [], []) for sig in self.sig_values: for eps in self.eps_values: sdp = bootstrap.SDP(sig, tab2) sdp.set_bound(0, float(self.gap)) sdp.add_point(0, eps) result = sdp.iterate() if result: grid.allowed_points.append((sig, eps)) else: grid.disallowed_points.append((sig, eps)) # Now append this grid object to the IsingGap table. # Note we will need to implement a look up table to retrieve desired data. self.table.append(grid)
def iterate_k_max(k_range): bootstrap.cutoff = 1e-10 dim = 3 l_max = 15 n_max = 4 m_max = 2 for k in k_range: tab1 = bootstrap.ConformalBlockTable(dim, k_max, l_max, m_max, n_max) tab2 = bootstrap.ConvolvedBlockTable(tab1) plot_grid(dim, tab2, sig_set, eps_set)
def iterate_parameter(self, par, par_range): if type(par_range)==int: par_range=[par_range] start_time=time.time() start_cpu=time.clock() for x in par_range: self.inputs[par]=x #Might make more sense to move tab1 and tab2 calculation to plot_grid()? tab1=bootstrap.ConformalBlockTable(self.inputs['dim'],self.inputs['kmax'],self.inputs['lmax'],self.inputs['mmax'],self.inputs['nmax']) tab2=bootstrap.ConvolvedBlockTable(tab1) self.plot_grid(par,x,tab2) end_time=time.time() end_cpu=time.clock() run_time=time.strftime("%H:%M:%S",time.gmtime(end_time-start_time)) cpu_time=time.strftime("%H:%M:%S",time.gmtime(end_cpu-start_cpu)) print("Run time "+run_time, "CPU time "+cpu_time)
def determine_grid(self, key): #if self.get_grid_index(key) != -1: start_time=time.time() start_cpu=time.clock() tab1 = bootstrap.ConformalBlockTable(self.dim, *key) tab2 = bootstrap.ConvolvedBlockTable(tab1) # Instantiate a Grid object with appropriate input values. # grid=Grid(*key, [], []) grid = Grid(*(key + [[], [], 0, 0])) for sig in self.sig_values: for eps in self.eps_values: sdp = bootstrap.SDP(sig, tab2) # SDPB will naturally try to parallelize across 4 cores / slots. # To prevent this, we set its 'maxThreads' option to 1. # See 'common.py' for the list of SDPB option strings, as well as their default values. sdp.set_option("maxThreads", 1) sdp.set_bound(0, float(self.gap)) sdp.add_point(0, eps) result = sdp.iterate() if result: grid.allowed_points.append((sig, eps)) else: grid.disallowed_points.append((sig, eps)) # Now append this grid object to the IsingGap table. # Note we will need to implement a look up table to retrieve desired data. end_time=time.time() end_cpu=time.clock() run_time=end_time-start_time cpu_time=end_cpu-start_cpu run_time = datetime.timedelta(seconds = int(end_time - start_time)) cpu_time = datetime.timedelta(seconds = int(end_cpu - start_cpu)) grid.run_time = run_time grid.cpu_time = cpu_time self.table.append(grid) self.save_grid(grid, self.name)
print(os.getpid()) row_lists = [[[0.518], [1.397]]] row = row_lists[0] key = [10, 10, 1, 3] bootstrap.prec = 500 bootstrap.cutoff = 0 reference_sdp = None for i in range(len(row[0])): sig = row[0][i] eps = row[1][i] global start_time start_time = time.time() global start_cpu start_cpu = time.clock() g_tab1 = bootstrap.ConformalBlockTable(3, *key) g_tab2 = bootstrap.ConformalBlockTable( 3, *(key + [eps - sig, sig - eps, "odd_spins = True"])) g_tab3 = bootstrap.ConformalBlockTable( 3, *(key + [sig - eps, sig - eps, "odd_spins = True"])) f_tab1a = bootstrap.ConvolvedBlockTable(g_tab1) f_tab1s = bootstrap.ConvolvedBlockTable(g_tab1, symmetric=True) f_tab2a = bootstrap.ConvolvedBlockTable(g_tab2) f_tab2s = bootstrap.ConvolvedBlockTable(g_tab2, symmetric=True) f_tab3 = bootstrap.ConvolvedBlockTable(g_tab3) tab_list = [f_tab1a, f_tab1s, f_tab2a, f_tab2s, f_tab3] global now global now_clock global CB_time global CB_cpu now = time.time()
def determine_points(self, key): # Define two 'lattice vectors', v1, and v2. v1 moves us along a diagonal. v2 moves up a diagonal. v1 = [self.sig_step, self.eps_step] v2 = [self.eps_step] reference_sdp = None if type(self.sig_range) != list: self.sig_range = [self.sig_range, self.sig_range] if type(self.eps_range) != list: self.eps_range = [self.eps_range, self.eps_range] # Constant sig-eps lines: eps = sig - c. # Choose a starting point for each line. (0.5179, 1.4110). # g_tab1 and g_tab3 don't change on a given line of constant delta{sig,eps}. sig_values = np.arange(self.sig_range[0], self.sig_range[1] + self.sig_step, self.sig_step).tolist() for eps in np.arange(self.eps_range[0], self.eps_range[1] + self.eps_step, self.eps_step).tolist(): # sig_values = [] eps_values = [] # For each value of x along this line: for sig in sig_values: # sig_values.append(sig) eps_values.append(eps + (sig - self.sig_range[0])) # Could initiate all blocks prior to loop here using sig_values[0]. # However, want to capture the timing of this within the first point? blocks_initiated = False for i in range(len(sig_values)): sig = sig_values[i] eps = eps_values[i] global start_time start_time = time.time() global start_cpu start_cpu = time.clock() # Generate three conformal block tables, two of which depend on the dimension differences. # They need only be calculated once for any given diagonal. They remain constant along this line. # Uses the function above to return the 5 ConvolvedConformalBlocks we need. # The ConvolvedConformalBlock objects inherits the dimension differences from ConformalBlockTable. # We set odd_spins = True for odd those ConvolvedConformalBlocks appearing in odd-sector-odd-spins. # We set symmetric = True where required. if blocks_initiated == False: g_tab1 = bootstrap.ConformalBlockTable(self.dim, *key) g_tab2 = bootstrap.ConformalBlockTable( self.dim, *(key + [eps - sig, sig - eps, "odd_spins = True"])) g_tab3 = bootstrap.ConformalBlockTable( self.dim, *(key + [sig - eps, sig - eps, "odd_spins = True"])) tab_list = self.convolved_table_list( g_tab1, g_tab2, g_tab3) for tab in [g_tab1, g_tab2, g_tab3]: tab.dump("tab_" + str(tab.delta_12) + "_" + str(tab.delta_34)) del tab blocks_initiated = True global now global now_clock global CB_time global CB_cpu now = time.time() now_clock = time.clock() CB_time = datetime.timedelta(seconds=int(now - start_time)) CB_cpu = datetime.timedelta(seconds=int(now_clock - start_cpu)) print( "The calculation of the required conformal blocks has successfully completed." ) print("Time taken: " + str(CB_time)) print("CPU_time: " + str(CB_cpu)) # N.B vec3 & vec2 are 'raw' quads, which will be converted to 1x1 matrices automatically. # Third vector: 0, 0, 1 * table4 with one of each dimension, -1 * table2 with only pair[0] dimensions, 1 * table3 with only pair[0] dimensions vec3 = [[0, 0, 0, 0], [0, 0, 0, 0], [1, 4, 1, 0], [-1, 2, 0, 0], [1, 3, 0, 0]] # Second vector: 0, 0, 1 * table4 with one of each dimension, 1 * table2 with only pair[0] dimensions, -1 * table3 with only pair[0] dimensions vec2 = [[0, 0, 0, 0], [0, 0, 0, 0], [1, 4, 1, 0], [1, 2, 0, 0], [-1, 3, 0, 0]] # The first vector has five components as well but they are matrices of quads, not just the quads themselves. m1 = [[[1, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0]]] m2 = [[[0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [1, 0, 1, 1]]] m3 = [[[0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0]]] m4 = [[[0, 0, 0, 0], [0.5, 0, 0, 1]], [[0.5, 0, 0, 1], [0, 0, 0, 0]]] m5 = [[[0, 1, 0, 0], [0.5, 1, 0, 1]], [[0.5, 1, 0, 1], [0, 1, 0, 0]]] vec1 = [m1, m2, m3, m4, m5] # The first rep must be the singlet even channel, where the unit operator resides. # After this, the order doesn't matter. # Spins for these again go even, even, odd. # The Z2 even sector has only even spins, Z2 odd sector runs over even and odd spins. info = [[vec1, 0, "z2-even-l-even"], [vec2, 0, "z2-odd-l-even"], [vec3, 1, "z2-odd-l-odd"]] # We instantiate the SDP object, inputting our vectorial sum info. # dim_list, convolved_block_table_list, vector_types (how they combine to compose sum rule). # We use the first calculated SDP object as a prototype for all the rest. # This is because some bounds remain unchanged, no need to recalculate basis. # Basis is independent of external scaling dimensions, cares only of the bounds on particular operators. sdp = bootstrap.SDP([sig, eps], tab_list, vector_types=info) if reference_sdp == None: sdp = bootstrap.SDP([sig, eps], tab_list, vector_types=info) reference_sdp = sdp else: sdp = bootstrap.SDP([sig, eps], tab_list, vector_types=info, prototype=reference_sdp) # We assume the continuum in both Z2 odd / even sectors begins at the dimension=3. sdp.set_bound([0, "z2-even-l-even"], self.dim) sdp.set_bound([0, "z2-odd-l-even"], self.dim) # Except for the two lowest dimension scalar operators in each sector. sdp.add_point([0, "z2-even-l-even"], eps) sdp.add_point([0, "z2-odd-l-even"], sig) # We expect these calculations to be computationally intensive. # We set maxThreads=16 to parallelise SDPB for all runs. # See 'common.py' for the list of SDPB option strings, as well as their default values. sdp.set_option("maxThreads", 16) sdp.set_option("dualErrorThreshold", 1e-15) # Run the SDP to determine if the current operator spectrum is permissable. print("Testing point " + "(" + sig.__str__() + ", " + eps.__str__() + ")...") result = sdp.iterate() end_time = time.time() end_cpu = time.clock() global sdp_time global sdp_cpu sdp_time = datetime.timedelta(seconds=int(end_time - bootstrap.now2)) sdp_cpu = datetime.timedelta(seconds=int(end_cpu - bootstrap.now2_clock)) run_time = datetime.timedelta(seconds=int(end_time - start_time)) cpu_time = datetime.timedelta(seconds=int(end_cpu - start_cpu)) print("The SDP has finished running.") print("Time taken: " + str(sdp_time)) print("CPU_time: " + str(sdp_cpu)) print( "See point file for more information. Check the times are consistent" ) point = Point(*([sig, eps] + key + [ result, run_time, cpu_time, CB_time, CB_cpu, bootstrap.xml_time, bootstrap.xml_cpu, sdp_time, sdp_cpu ])) self.point_table.append(point) point.save(self.point_file)
def determine_row(self, key, row): # Will be called with a given row_lists[i] # row = row_lists[row_index] reference_sdp = None blocks_initiated = False for i in range(len(row[0])): sig = row[0][i] eps = row[1][i] start = time.time() start_cpu = time.clock() # Generate three conformal block tables, two of which depend on the dimension differences. # They need only be calculated once for any given diagonal. They remain constant along this line. # Uses the function above to return the 5 ConvolvedConformalBlocks we need. # The ConvolvedConformalBlock objects inherits the dimension differences from ConformalBlockTable. # We set odd_spins = True for odd those ConvolvedConformalBlocks appearing in odd-sector-odd-spins. # We set symmetric = True where required. if blocks_initiated == False: g_tab1 = bootstrap.ConformalBlockTable(self.dim, *key) g_tab2 = bootstrap.ConformalBlockTable( self.dim, *(key + [eps - sig, sig - eps, "odd_spins = True"])) g_tab3 = bootstrap.ConformalBlockTable( self.dim, *(key + [sig - eps, sig - eps, "odd_spins = True"])) tab_list = self.convolved_table_list(g_tab1, g_tab2, g_tab3) for tab in [g_tab1, g_tab2, g_tab3]: tab.dump("tab_" + str(tab.delta_12) + "_" + str(tab.delta_34)) del tab blocks_initiated = True max_dimension = 0 for tab in tab_list: max_dimension = max(max_dimension, len(tab.table[0].vector)) print("kmax should be around " + max_dimension.__str__() + ".") print("It is: " + key[0].__str__() + ".") #N.B NEED TO AMMEND THIS CALCULATION FOR THE NO OF COMPONENTS!!!!! components = (4 * len(tab_list[0].table[0].vector)) + ( 1 * len(tab_list[1].table[0].vector)) bootstrap.cb_end = time.time() bootstrap.cb_end_cpu = time.clock() cb_time = datetime.timedelta(seconds=int(bootstrap.cb_end - start)) cb_cpu = datetime.timedelta(seconds=int(bootstrap.cb_end_cpu - start_cpu)) print( "The calculation of the required conformal blocks has successfully completed." ) print("Time taken: " + str(cb_time)) print("CPU_time: " + str(cb_cpu)) # We instantiate the SDP object, inputting our vectorial sum info. # dim_list, convolved_block_table_list, vector_types (how they combine to compose sum rule). # We use the first calculated SDP object as a prototype for all the rest. # This is because some bounds remain unchanged, no need to recalculate basis. # Basis is independent of external scaling dimensions, cares only of the bounds on particular operators. # sdp = bootstrap.SDP([sig, eps], tab_list, vector_types = info) if reference_sdp == None: sdp = bootstrap.SDP([sig, eps], tab_list, vector_types=self.info) reference_sdp = sdp else: sdp = bootstrap.SDP([sig, eps], tab_list, vector_types=self.info, prototype=reference_sdp) # We assume the continuum in both Z2 odd / even sectors begins at the dimension=3. sdp.set_bound([0, "z2-even-l-even"], self.dim) sdp.set_bound([0, "z2-odd-l-even"], self.dim) # Except for the two lowest dimension scalar operators in each sector. sdp.add_point([0, "z2-even-l-even"], eps) sdp.add_point([0, "z2-odd-l-even"], sig) # We expect these calculations to be computationally intensive. # We set maxThreads=16 to parallelise SDPB for all runs. # See 'common.py' for the list of SDPB option strings, as well as their default values. sdp.set_option("maxThreads", 16) sdp.set_option("dualErrorThreshold", 1e-15) sdp.set_option("maxIterations", 1000) # Run the SDP to determine if the current operator spectrum is permissable. print("Testing point " + "(" + sig.__str__() + ", " + eps.__str__() + ")" + " with " + components.__str__() + " components.") result = sdp.iterate() end = time.time() end_cpu = time.clock() sdp_time = datetime.timedelta(seconds=int(end - bootstrap.xml_end)) sdp_cpu = datetime.timedelta(seconds=int(end_cpu - bootstrap.xml_end_cpu)) run_time = datetime.timedelta(seconds=int(end - start)) cpu_time = datetime.timedelta(seconds=int(end_cpu - start_cpu)) print("The SDP has finished running.") print("Time taken: " + str(sdp_time)) print("CPU_time: " + str(sdp_cpu)) print( "See point file for more information. Check the times are consistent." ) point = Point(*([sig, eps] + key + [ components, max_dimension, result, run_time, cpu_time, cb_time, cb_cpu, bootstrap.xml_time, bootstrap.xml_cpu, sdp_time, sdp_cpu ])) self.point_table.append(point) point.save(self.point_file)
k_range = np.arange(40, 61, 1).tolist() l_range = np.arange(40, 61, 1).tolist() #keys = [] #for k in k_range: # for l in l_range: # keys.append([k, l, 5, 7]) # for n in np.arange(2,16,1): #key = [n**2, n**2, n-2, n] #key = keys[index] print("Computing conformal blocks for k=" + key[0].__str__() + ", l=" + key[1].__str__() + ", m=5, n=7.") start = time.time() start_cpu = time.clock() g_tab1 = bootstrap.ConformalBlockTable(3, *(key + [0, 0, "odd_spins = True"])) g_tab2 = bootstrap.ConformalBlockTable(3, *(key + [phi - sing, phi - sing, "odd_spins = True"])) g_tab3 = bootstrap.ConformalBlockTable(3, *(key + [sing - phi, phi - sing, "odd_spins = True"])) f_tab1a = bootstrap.ConvolvedBlockTable(g_tab1) f_tab1s = bootstrap.ConvolvedBlockTable(g_tab1, symmetric = True) f_tab2a = bootstrap.ConvolvedBlockTable(g_tab2) f_tab3a = bootstrap.ConvolvedBlockTable(g_tab3) f_tab3s = bootstrap.ConvolvedBlockTable(g_tab3, symmetric = True) tab_list = [f_tab1a, f_tab1s, f_tab2a, f_tab3a, f_tab3s] for tab in [g_tab1, g_tab2, g_tab3]: # tab.dump("tab_" + str(tab.delta_12) + "_" + str(tab.delta_34)) del tab
l_max = 15 n_max = 4 m_max = 2 def find_bounds(table1, table2, lower, upper, tol, channel): dim_phi = 0.5 x = [] y = [] while dim_phi < 0.6: sdp = bootstrap.SDP(dim_phi, table2) result = sdp.bisect(lower, upper, tol, channel) x.append(dim_phi) y.append(result) dim_phi += 0.002 plt.plot(x, y) tab1 = bootstrap.ConformalBlockTable(dim, k_max, l_max, m_max, n_max) tab2 = bootstrap.ConvolvedBlockTable(tab1) l = 0.9 u = 1.7 t = 0.01 c = 0 find_bounds(tab1, tab2, l, u, t, c) plt.xlabel('$\Delta_{\sigma}$') plt.ylabel('$\Delta_{\epsilon}$') plt.show()
def determine_line_spins(key): for r in range(len(rows)): sig = eval_mpfr(rows[r][0][0], bootstrap.prec) eps = eval_mpfr(rows[r][1][0], bootstrap.prec) start = time.time() start_cpu = time.clock() g_tab1 = bootstrap.ConformalBlockTable(3, *key) g_tab2 = bootstrap.ConformalBlockTable( 3, *(key + [eps - sig, sig - eps, "odd_spins = True"])) g_tab3 = bootstrap.ConformalBlockTable( 3, *(key + [sig - eps, sig - eps, "odd_spins = True"])) tab_list = mixed.convolved_table_list(g_tab1, g_tab2, g_tab3) dimension = (4 * len(tab_list[0].table[0].vector)) + ( 1 * len(tab_list[1].table[0].vector)) max_dimension = 0 for tab in tab_list: max_dimension = max(max_dimension, len(tab.table[0].vector)) print("Testing point " + "(" + sig.__str__() + "," + eps.__str__() + ").") print("Number of components (dim of PolynomialVectorMatrices) : " + dimension.__str__() + ".") print( "Kmax should be around (max dimension of convolved block tables): " + max_dimension.__str__() + ".") print("It is: " + key[0].__str__() + ".") cb_end = time.time() cb_end_cpu = time.clock() cb_time = datetime.timedelta(seconds=int(cb_end - start)) cb_cpu = datetime.timedelta(seconds=int(cb_end_cpu - start_cpu)) print( "The calculation of the required conformal blocks has successfully completed." ) print("Time taken: " + str(cb_time)) print("CPU_time: " + str(cb_cpu)) sdp = SDP([sig, eps], tab_list, vector_types=mixed.info) table_before = len(sdp.table) sdp.bounds = [0.0] * len(sdp.table) sdp.options = [] sdp.basis = [0] * len(sdp.table) bad_indices = [] for l in range(0, len(sdp.table)): spin = sdp.table[l][0][0].label[0] sdp.bounds[l] = [spin, unitarity_bound(sdp.dim, spin)] poles = sdp.table[l][0][0].poles delta_min = mpmath.mpf(sdp.bounds[l][1].__str__()) bands = [] matrix = [] degree = 0 size = len(sdp.table[l]) for r in range(0, size): for s in range(0, size): polynomial_vector = sdp.table[l][r][s].vector for n in range(0, len(polynomial_vector)): expression = polynomial_vector[n].expand() degree = max(degree, len(coefficients(expression)) - 1) for d in range(0, 2 * (degree // 2) + 1): result = integral(d, delta_min, poles) bands.append(result) for r in range(0, (degree // 2) + 1): new_entries = [] for s in range(0, (degree // 2) + 1): new_entries.append(bands[r + s]) matrix.append(new_entries) matrix = mpmath.matrix(matrix) try: matrix = mpmath.cholesky(matrix, tol=mpmath.mpf(chol_tol)) except ValueError: bad_indices.append(l) continue else: matrix = mpmath.inverse(matrix) sdp.basis[l] = [spin, matrix] bad_spins = [] for l in bad_indices: spin = sdp.table[l][0][0].label[0] if spin not in bad_spins: bad_spins.append(spin) sdp.bounds = [ couple[1] for couple in sdp.bounds if couple[0] not in bad_spins ] sdp.table = [ polyvecmatrix for polyvecmatrix in sdp.table if polyvecmatrix[0][0].label[0] not in bad_spins ] sdp.basis = [ entry[1] for entry in sdp.basis if isinstance(entry, (list, )) and entry[0] not in bad_spins and isinstance(entry[1], mpmath.matrix) ] table_after = len(sdp.table) good_spins = [] for l in range(len(sdp.table)): spin = sdp.table[l][0][0].label[0] if spin not in good_spins: good_spins.append(spin) good_spins.sort() bad_spins.sort() point = Point(*([sig, eps] + key + [ dimension, max_dimension, table_before, table_after, good_spins, bad_spins, cb_time, cb_cpu, ])) #self.point_table.append(point) point.save(mixed.point_file)
# Concentrates on external scalars of 0.518, close to the 3D Ising value. dim_phi = 0.518 cprint("Finding basic bound at external dimension " + str(dim_phi) + "...") # Spatial dimension. dim = 3 # Dictates the number of poles to keep and therefore the accuracy of a conformal block. k_max = 20 # Says that conformal blocks for spin-0 up to and including spin-14 should be computed. l_max = 14 # Conformal blocks are functions of (a, b) and as many derivatives of each should be kept for strong bounds. # This says to keep derivatives up to fourth order in b. n_max = 4 # For a given n, this states how many a derivatives should be included beyond 2 * (n - n_max). m_max = 2 # Generates the table. table1 = bootstrap.ConformalBlockTable(dim, k_max, l_max, m_max, n_max) # Computes the convolution. table2 = bootstrap.ConvolvedBlockTable(table1) # Sets up a semidefinite program that we can use to study this. sdp = bootstrap.SDP(dim_phi, table2) # We think it is perfectly find for all internal scalars coupling to our external one to have dimension above 0.7. lower = 0.7 # Conversely, we think it is a problem for crossing symmetry if they all have dimension above 1.7. upper = 1.7 # The boundary between these regions will be found within an error of 0.01. tol = 0.01 # The 0.7 and 1.7 are our guesses for scalars, not some other type of operator. channel = 0 # Calls SDPB to compute the bound. result = sdp.bisect(lower, upper, tol, channel) cprint(
mixed = MixedCorrelator() bootstrap.prec = 2000 mixed.point_file = key.__str__() bootstrap.chol_tol = 1e-300 reference_sdp = None for i in range(len(row_lists[row_index])): sig = row_lists[row_index][0][i] eps = row_lists[row_index][1][i] global start_time start_time = time.time() global start_cpu start_cpu = time.clock() g_tab1 = bootstrap.ConformalBlockTable(0, 0, 0, 0, 0, name="tab_0_0") g_tab2 = bootstrap.ConformalBlockTable(0, 0, 0, 0, 0, name="tab_0.894_-0.894") g_tab3 = bootstrap.ConformalBlockTable(0, 0, 0, 0, 0, name="tab_-0.894_-0.894") f_tab1a = bootstrap.ConvolvedBlockTable(g_tab1) f_tab1s = bootstrap.ConvolvedBlockTable(g_tab1, symmetric=True) f_tab2a = bootstrap.ConvolvedBlockTable(g_tab2)
def determine_row(self, key, row): # Will be called with a given row_lists[i] # Use generate_rows() method to build row_lists. # row = row_lists[row_index] reference_sdp = None blocks_initiated = False for i in range(len(row[0])): phi = eval_mpfr(row[0][i], bootstrap.prec) sing = eval_mpfr(row[1][i], bootstrap.prec) # phi_sing = eval_mpfr(phi - sing, bootstrap.prec) # sing_phi = eval_mpfr(sing - phi, bootstrap.prec) start = time.time() start_cpu = time.clock() if blocks_initiated == False: g_tab1 = bootstrap.ConformalBlockTable( self.dim, *(key + [0, 0, "odd_spins = True"])) g_tab2 = bootstrap.ConformalBlockTable( self.dim, *(key + [phi - sing, phi - sing, "odd_spins = True"])) g_tab3 = bootstrap.ConformalBlockTable( self.dim, *(key + [sing - phi, phi - sing, "odd_spins = True"])) f_tab1a = bootstrap.ConvolvedBlockTable(g_tab1) f_tab1s = bootstrap.ConvolvedBlockTable(g_tab1, symmetric=True) f_tab2a = bootstrap.ConvolvedBlockTable(g_tab2) f_tab3a = bootstrap.ConvolvedBlockTable(g_tab3) f_tab3s = bootstrap.ConvolvedBlockTable(g_tab3, symmetric=True) tab_list = [f_tab1a, f_tab1s, f_tab2a, f_tab3a, f_tab3s] for tab in [g_tab1, g_tab2, g_tab3]: # tab.dump("tab_" + str(tab.delta_12) + "_" + str(tab.delta_34)) del tab blocks_initiated = True max_dimension = 0 for tab in tab_list: max_dimension = max(max_dimension, len(tab.table[0].vector)) print("kmax should be around " + max_dimension.__str__() + ".") dimension = (5 * len(f_tab1a.table[0].vector)) + ( 2 * len(f_tab1s.table[0].vector)) bootstrap.cb_end = time.time() bootstrap.cb_end_cpu = time.clock() cb_time = datetime.timedelta(seconds=int(bootstrap.cb_end - start)) cb_cpu = datetime.timedelta(seconds=int(bootstrap.cb_end_cpu - start_cpu)) print( "The calculation of the required conformal blocks has successfully completed." ) print("Time taken: " + str(cb_time)) print("CPU_time: " + str(cb_cpu)) if reference_sdp == None: sdp = bootstrap.SDP([phi, sing], tab_list, vector_types=self.info) reference_sdp = sdp else: sdp = bootstrap.SDP([phi, sing], tab_list, vector_types=self.info, prototype=reference_sdp) # We assume the continuum in both even vector and even singlet sectors begins at the dimension=3. sdp.set_bound([0, 0], self.dim) sdp.set_bound([0, 3], self.dim) # Except for the two lowest dimension scalar operators in each sector. sdp.add_point([0, 0], sing) sdp.add_point([0, 3], phi) sdp.set_option("maxThreads", 16) sdp.set_option("dualErrorThreshold", 1e-15) sdp.set_option("maxIterations", 1000) # Run the SDP to determine if the current operator spectrum is permissable. print("Testing point " + "(" + phi.__str__() + ", " + sing.__str__() + ")" + " with " + dimension.__str__() + " components.") result = sdp.iterate() end = time.time() end_cpu = time.clock() sdp_time = datetime.timedelta(seconds=int(end - bootstrap.xml_end)) sdp_cpu = datetime.timedelta(seconds=int(end_cpu - bootstrap.xml_end_cpu)) run_time = datetime.timedelta(seconds=int(end - start)) cpu_time = datetime.timedelta(seconds=int(end_cpu - start_cpu)) print("The SDP has finished running.") print("Time taken: " + str(sdp_time)) print("CPU_time: " + str(sdp_cpu)) print( "See point file for more information. Check the times are consistent." ) point = Point(*([phi, sing] + key + [ components, max_dimension, result, run_time, cpu_time, cb_time, cb_cpu, bootstrap.xml_time, bootstrap.xml_cpu, sdp_time, sdp_cpu ])) self.point_table.append(point) point.save(self.point_file)