def kalmanson_fan(n): fn = "kalmanson_fan_%i" % n try: return db(fn) except IOError: f = Fan(Set(kalmanson_cones(n))) f.db(fn) return f
def __call__(self, *args): fn = ("%s" + ("_%i" * len(args))) % ((self.f.__name__, ) + args) try: return db(fn) except IOError: res = self.f(*args) db_save(res, fn) return res
def kalmanson_cones(n): desc = "kalmanson_cones_%i" % n try: return db(desc) except IOError: R = rays(n) ray_sets = Set([Set([permute_matrix(g,M) for M in R]) for g in SymmetricGroup(n)]) p_iter = sage.parallel.use_fork.p_iter_fork(sage.parallel.ncpus.ncpus() * 2,30) P = parallel(p_iter=p_iter) cones = [ret for ((poly,kwd),ret) in P(make_cone)(ray_sets.list())] db_save(Set(cones), desc) return cones