def convolved_table_list(self, tab1, tab2, tab3): f_tab1a = bootstrap.ConvolvedBlockTable(tab1) f_tab1s = bootstrap.ConvolvedBlockTable(tab1, symmetric=True) f_tab2a = bootstrap.ConvolvedBlockTable(tab2) f_tab2s = bootstrap.ConvolvedBlockTable(tab2, symmetric=True) f_tab3 = bootstrap.ConvolvedBlockTable(tab3) return [f_tab1a, f_tab1s, f_tab2a, f_tab2s, f_tab3]
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)
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() 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."
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()
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( "If crossing symmetry and unitarity hold, the maximum gap we can have for Z2-even scalars is: " + str(result))
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)