From 83aaff2fdb596a470b4f5189df99a71a496e47e8 Mon Sep 17 00:00:00 2001 From: basilegithub Date: Thu, 6 Nov 2025 21:49:37 +0100 Subject: [PATCH] Cleaned up code --- src/NFS.py | 2 -- src/block_lanczos.py | 4 ++-- src/compute_solutions.py | 4 ++-- src/polynomial_functions.py | 2 +- src/wiedemann.py | 1 + 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/NFS.py b/src/NFS.py index 682295c..39f933a 100644 --- a/src/NFS.py +++ b/src/NFS.py @@ -2,8 +2,6 @@ ## import libraries -ZQDFEGSRHTDR = 35279032783773322923326661023 - import math, os from datetime import datetime import log diff --git a/src/block_lanczos.py b/src/block_lanczos.py index da67b0d..d507bd5 100644 --- a/src/block_lanczos.py +++ b/src/block_lanczos.py @@ -33,7 +33,7 @@ def block(T, N): else: for k in range(j, N): if (M[k] >> N - j - 1)&1 != 0: - M[k] ,M[j] = M[j], M[k] + M[k], M[j] = M[j], M[k] break if (M[j] >> N - j - 1)&1 == 0: @@ -110,7 +110,7 @@ def block_lanczos(B, nb_relations, BLOCK_SIZE, LOG_PATH): solutions.append(Z[i]) if len(solutions) == 0: - solutions = block_lanczos(B,nb_relations,BLOCK_SIZE<<1,LOG_PATH) + solutions = block_lanczos(B, nb_relations, BLOCK_SIZE<<1, LOG_PATH) return solutions diff --git a/src/compute_solutions.py b/src/compute_solutions.py index b8432d0..24c5f76 100644 --- a/src/compute_solutions.py +++ b/src/compute_solutions.py @@ -26,7 +26,7 @@ def create_solution(pairs, null_space, n, len_primes, primes, f_x, m0, m1, inert f_norm += x*x*tmp tmp *= leading f_norm = int(math.sqrt(f_norm))+1 - fd = int(pow(len(f_x)-1,1.5))+1 + fd = int(pow(len(f_x)-1, 1.5))+1 S = 0 x = f_prime_eval @@ -97,7 +97,7 @@ def create_solution_couveignes(pairs, null_space, n, len_primes, primes, f_x, f_ #goal = 2*max([abs(c) for c in coeffs]) - fd = int(pow(d,1.5))+1 + fd = int(pow(d, 1.5))+1 coeff_bound = [fd*pow(f_norm, d-i)*pow(2*u*f_norm, S>>1) for i in range(len(f_x)-1)] goal = max(coeff_bound) diff --git a/src/polynomial_functions.py b/src/polynomial_functions.py index 2aa71f2..dcd8ef8 100644 --- a/src/polynomial_functions.py +++ b/src/polynomial_functions.py @@ -121,7 +121,7 @@ def find_roots_poly(f, p): if g[-1] == 0: r.append(0) del g[-1] - return r+roots(g, p) + return r + roots(g, p) def roots(g, p): if len(g) == 1: return [] diff --git a/src/wiedemann.py b/src/wiedemann.py index 575e56b..4f173ce 100644 --- a/src/wiedemann.py +++ b/src/wiedemann.py @@ -107,6 +107,7 @@ def wiedemann(A, n, BLOCK_SIZE, mini_poly_estim): # We will find the generator for each scalar sequence, and compute the lcm of generator and current estimate of minimal polynomial tmp2 = block sequence = [0]*BLOCK_SIZE + for i in range(2*n-1): tmp = sparse_dot_prod(lbd, tmp2) for j in range(BLOCK_SIZE):