triangs_fine = pc_fine.triangulations_list() triangs_fine_reg = pc_fine_reg.triangulations_list() return [len(triangs_fine), len(triangs_fine_reg)] ################################################################################# #Main body try: #docsfile=sys.argv[1]; #basecoll=sys.argv[2]; #dbindexes=sys.argv[3:]; #with open(docsfile,'r') as docstream: # for line in docstream: for line in iter(sys.stdin.readline, ''): maxconedoc = json.loads(line.rstrip("\n")) nform = mat2py(maxconedoc['NORMALFORM']) facetverts = [x for x in nform if not all([y == 0 for y in x])] facet = LatticePolytope(facetverts) facetpts = [list(x) for x in facet.boundary_points()] try: with time_limit(3600): facetntriang_fine, facetntriang_fine_reg = n_FSRT_facet_from_resolved_verts( facetpts) except TimeoutException("Timed out!"): pass else: facetntriang = n_FSRT_facet_from_resolved_verts(facetpts) print( "+MAXCONE." + json.dumps({'NORMALFORM': py2mat(nform)}, separators=(',', ':')) + ">" + json.dumps(
def favorable(ndivsJ, h11): "Check if the polytope is favorable." return (h11 == ndivsJ) ################################################################################# #Main body if rank == 0: try: #IO Definitions polydoc = json.loads(sys.argv[1]) #Read in pertinent fields from JSON polyid = polydoc['POLYID'] nverts = mat2py(polydoc['NVERTS']) h11 = polydoc['H11'] h21 = polydoc['H21'] #Compute initial information corresponding to polytope lp = Polyhedron(vertices=nverts) sorted_dverts = [ vector(x) for x in sorted([ vector([y / gcd(x) for y in x]) for x in lp.polar().vertices() ]) ] dlp = Polyhedron(vertices=sorted_dverts) dverts = [list(x) for x in sorted_dverts] cws = LP2CWS(sorted_dverts) max_cones = [ Cone([x.vector() for x in list(lp.Hrepresentation(i).incident())]) for i in range(lp.n_Hrepresentation())
else: return [NL,[],False,False,False]; else: return [NL,"unfav",False,False,False]; ################################################################################# #Main body if rank==0: try: #IO Definitions geomdoc=json.loads(sys.argv[1]); #Read in pertinent fields from JSON polyid=geomdoc['POLYID']; geomn=geomdoc['GEOMN']; h11=geomdoc['H11']; dresverts=mat2py(geomdoc['DRESVERTS']); fgp=geomdoc['FUNDGP']; fav=geomdoc['FAV']; JtoDmat=mat2py(geomdoc['JTOD']); packagepath=subprocess.Popen("echo \"${SLURMONGO_ROOT}\" | head -c -1",shell=True,stdout=subprocess.PIPE,preexec_fn=default_sigpipe).communicate()[0]; statepath=packagepath+"/state"; mongourifile=statepath+"/mongouri"; with open(mongourifile,"r") as mongouristream: mongouri=mongouristream.readline().rstrip("\n"); mongoclient=mongojoin.MongoClient(mongouri+"?authMechanism=SCRAM-SHA-1"); dbname=mongouri.split("/")[-1]; db=mongoclient[dbname]; triangdata=mongojoin.collectionfind(db,'TRIANG',{'H11':h11,'POLYID':polyid,'GEOMN':geomn},{'_id':0,'MORIMATP':1,'ITENSXD':1},formatresult='expression'); mongoclient.close();
]) for k in range(len(DtoJmat)) ] g_kahler_rows = mongojoin.transpose_list(g_kahler_cols) return [g_mori_rows, g_kahler_rows] ################################################################################# #Main body if rank == 0: try: #IO Definitions polydoc = json.loads(sys.argv[1]) #Read in pertinent fields from JSON polyid = polydoc['POLYID'] h11 = polydoc['H11'] dresverts = mat2py(polydoc['DRESVERTS']) rescws = mat2py(polydoc['RESCWS']) DtoJmat = mat2py(polydoc['DTOJ']) packagepath = subprocess.Popen( "echo \"${SLURMONGO_ROOT}\" | head -c -1", shell=True, stdout=subprocess.PIPE, preexec_fn=default_sigpipe).communicate()[0] statepath = packagepath + "/state" mongourifile = statepath + "/mongouri" with open(mongourifile, "r") as mongouristream: mongouri = mongouristream.readline().rstrip("\n") mongoclient = mongojoin.MongoClient(mongouri + "?authMechanism=SCRAM-SHA-1")
eX = sage_eval(str_c3XJ) return [ ipolyAJ, itensAJ, ipolyXJ, itensXJ, c2XD, c3XD, c2XJ, c3XJ, c2Xnums, eX ] ################################################################################# #Main body try: #IO Definitions polytriangdoc = json.loads(sys.argv[1]) #Read in pertinent fields from JSON polyid = polytriangdoc['POLYID'] alltriangn = allpolytriangdoc['ALLTRIANGN'] h11 = polytriangdoc['H11'] dresverts = mat2py(polytriangdoc['DRESVERTS']) rescws = mat2py(polytriangdoc['RESCWS']) DtoJmat = mat2py(polytriangdoc['DTOJ']) triang = mat2py(polytriangdoc['TRIANG']) #Set the number of basis divisors ndivsJ = matrix(rescws).rank() #Create the pseudo-Chow polynomial ring C = PolynomialRing(QQ, names=['t'] + ['D' + str(i + 1) for i in range(len(dresverts))] + ['J' + str(i + 1) for i in range(ndivsJ)]) DD = list(C.gens()[1:-ndivsJ]) JJ = list(C.gens()[-ndivsJ:]) #Define the divisor basis basis = [[JJ[j], sum([DtoJmat[j][i] * DD[i] for i in range(len(DD))])]
#!/shared/apps/sage-7.4/local/bin/sage -python from sage.all_cmdline import * import sys, json, itertools from mongojoin.tools import deldup from mongojoin.parse import mathematicalist2pythonlist as mat2py for line in iter(sys.stdin.readline, ''): involdoc = json.loads(line) #sys.stdout.write("#" + line) #sys.stdout.flush() polyid = involdoc['POLYID'] geomn = involdoc['GEOMN'] triangn = involdoc['TRIANGN'] involn = involdoc['INVOLN'] rescws = mat2py(involdoc['RESCWS']) symcyterms = involdoc['SYMCYPOLY'] gens = "(" + ",".join(["x" + str(i + 1) for i in range(len(rescws))]) + ")" var(gens.replace("(", "").replace(")", "").replace(",", " ")) srideal = eval(involdoc['SRIDEAL'].replace("{", "[[").replace("}", "]]").replace(",", "],[").replace("*", ",").replace("D", "x")) supersrsectors = deldup([set(x) for x in list(itertools.product(*srideal))]) srsectors = [str([y-1 for y in supersrsectors[i]]).replace("[", "").replace("]", "").replace(" ", "") for i in range(len(supersrsectors)) if not any([supersrsectors[i].issuperset(x) for x in supersrsectors[:i] + supersrsectors[i + 1:]])] singular.option("noredefine") symcypoly = "+".join([str(int(ZZ.random_element(-2*len(symcyterms), 2*len(symcyterms)))) + "*" + x for x in symcyterms]) singular.eval("ring r=1500450271," + gens + ",dp; ideal P=" + symcypoly + ";") maxdim1 = max([int(singular.eval("ideal SR=" + x + "; ideal I=SR,P,jacob(P); int(dim(groebner(I)));")) for x in srsectors]) symcypoly = "+".join([str(int(ZZ.random_element(-2*len(symcyterms), 2*len(symcyterms)))) + "*" + x for x in symcyterms])
for j in range(len(g_mori_cols)) ]) for k in range(len(DtoJmat)) ] g_kahler_rows = mongojoin.transpose_list(g_kahler_cols) return [g_mori_rows, g_kahler_rows] ################################################################################# #Main body try: #IO Definitions polydoc = json.loads(sys.argv[1]) #Read in pertinent fields from JSON polyid = polydoc['POLYID'] h11 = polydoc['H11'] DtoJmat = mat2py(polydoc['DTOJ']) packagepath = subprocess.Popen("echo \"${SLURMONGO_ROOT}\" | head -c -1", shell=True, stdout=subprocess.PIPE, preexec_fn=default_sigpipe).communicate()[0] statepath = packagepath + "/state" mongourifile = statepath + "/mongouri" with open(mongourifile, "r") as mongouristream: mongouri = mongouristream.readline().rstrip("\n") mongoclient = mongojoin.MongoClient(mongouri + "?authMechanism=SCRAM-SHA-1") dbname = mongouri.split("/")[-1] db = mongoclient[dbname] triangdocs = mongojoin.collectionfind(db,