def test_splitcoeff(self): r""" Checking utility: splitcoeff """ self.assertEqual(splitcoeff("1 2"), [[1.0, 2.0]]) self.assertEqual(splitcoeff(" 0 -1.2 \n 3.14 1 "), [[0.0, -1.2], [3.14, 1.0]])
def parseLcalcfile_ver1(self): lines = self.contents.split('\n', 6) self.coefficient_type = int(lines[0]) self.quasidegree = int(lines[4]) lines = self.contents.split('\n', 8 + 2 * self.quasidegree) self.Q_fe = float(lines[5 + 2 * self.quasidegree]) self.sign = pair2complex(lines[6 + 2 * self.quasidegree]) for i in range(self.quasidegree): localdegree = float(lines[5 + 2 * i]) self.kappa_fe.append(localdegree) locallambda = pair2complex(lines[6 + 2 * i]) self.lambda_fe.append(locallambda) if math.fabs(localdegree - 0.5) < 0.00001: self.mu_fe.append(2 * locallambda) elif math.fabs(localdegree - 1) < 0.00001: self.nu_fe.append(locallambda) else: self.nu_fe.append(locallambda) self.langlands = False """ Do poles here later """ self.degree = round(2 * sum(self.kappa_fe)) self.level = round(math.pi ** self.degree * 4 ** len(self.nu_fe) * self.Q_fe ** 2) self.dirichlet_coefficients = splitcoeff(lines[-1]) originalfile = re.match(".*/([^/]+)$", self.url) originalfile = originalfile.group(1) # self.title = "An L-function generated by an Lcalc file: " self.title = "An L-function generated by an Lcalc file: " + originalfile self.credit = "David Farmer, Sally Koutsoliotas and Stefan Lemurell"
def parseLcalcfile_ver1(L, filecontents): """ Extracts informtion from the lcalcfile, version 1 """ lines = filecontents.split('\n', 6) L.coefficient_type = int(lines[0]) # Rishi tells me that for his wrapper # 0 is for general, 1 is for periodic and 2 is for elliptic curves. # Mike seems to only use 0 and 1. # POD L.quasidegree = int(lines[4]) lines = filecontents.split('\n', 8 + 2 * L.quasidegree) L.Q_fe = float(lines[5 + 2 * L.quasidegree]) L.sign = pair2complex(lines[6 + 2 * L.quasidegree]) L.kappa_fe = [] L.lambda_fe = [] L.mu_fe = [] L.nu_fe = [] for i in range(L.quasidegree): localdegree = float(lines[5 + 2 * i]) L.kappa_fe.append(localdegree) locallambda = pair2complex(lines[6 + 2 * i]) L.lambda_fe.append(locallambda) if math.fabs(localdegree - 0.5) < 0.00001: L.mu_fe.append(2 * locallambda) elif math.fabs(localdegree - 1) < 0.00001: L.nu_fe.append(locallambda) else: L.nu_fe.append(locallambda) L.langlands = False """ Do poles here later """ L.degree = int(round(2 * sum(L.kappa_fe))) L.level = int(round(math.pi**float(L.degree) * 4**len(L.nu_fe) * L.Q_fe**2)) # note: math.pi was not compatible with the sage type of degree L.dirichlet_coefficients = splitcoeff(lines[-1])
def parseLcalcfile_ver1(L, filecontents): """ Extracts informtion from the lcalcfile, version 1 """ lines = filecontents.split('\n', 6) L.coefficient_type = int(lines[0]) # Rishi tells me that for his wrapper # 0 is for general, 1 is for periodic and 2 is for elliptic curves. # Mike seems to only use 0 and 1. # POD L.quasidegree = int(lines[4]) lines = filecontents.split('\n', 8 + 2 * L.quasidegree) L.Q_fe = float(lines[5 + 2 * L.quasidegree]) L.sign = pair2complex(lines[6 + 2 * L.quasidegree]) L.kappa_fe = [] L.lambda_fe = [] L.mu_fe = [] L.nu_fe = [] for i in range(L.quasidegree): localdegree = float(lines[5 + 2 * i]) L.kappa_fe.append(localdegree) locallambda = pair2complex(lines[6 + 2 * i]) L.lambda_fe.append(locallambda) if math.fabs(localdegree - 0.5) < 0.00001: L.mu_fe.append(2 * locallambda) elif math.fabs(localdegree - 1) < 0.00001: L.nu_fe.append(locallambda) else: L.nu_fe.append(locallambda) L.langlands = False """ Do poles here later """ L.degree = int(round(2 * sum(L.kappa_fe))) L.level = int(round(math.pi ** float(L.degree) * 4 ** len(L.nu_fe) * L.Q_fe ** 2)) # note: math.pi was not compatible with the sage type of degree L.dirichlet_coefficients = splitcoeff(lines[-1])