Skip to content

Commit 1b118be

Browse files
committed
simplify code by removing variables
1 parent 29238d9 commit 1b118be

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/sage/combinat/k_regular_sequence.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,34 +1307,29 @@ def find_linear_combination(t_L, r_L, lines):
13071307
to_branch = []
13081308
lines = []
13091309

1310-
def include(line):
1311-
to_branch.append(line)
1312-
lines.append(line)
1313-
t, r = line
1310+
def include(t, r):
1311+
to_branch.append((t, r))
1312+
lines.append((t, r))
13141313
logger.info('including f_{%s*m+%s}', k**t, r)
13151314

13161315
if left is None:
1317-
line_L = (0, 0) # entries (t, r) --> k**t * m + r
1318-
include(line_L)
1316+
include(0, 0) # entries (t, r) --> k**t * m + r
13191317
assert len(lines) == 1
13201318
left = vector(len(seq(0))*(zero,) + (one,))
13211319

13221320
while to_branch:
1323-
line_R = to_branch.pop(0)
1324-
t_R, r_R = line_R
1321+
t_R, r_R = to_branch.pop(0)
13251322
if t_R >= max_exponent:
13261323
raise RuntimeError(f'aborting as exponents would be larger '
13271324
f'than max_exponent={max_exponent}')
13281325

13291326
t_L = t_R + 1
13301327
for s_L in srange(k):
13311328
r_L = k**t_R * s_L + r_R
1332-
line_L = t_L, r_L
1333-
13341329
try:
13351330
solution = find_linear_combination(t_L, r_L, lines)
13361331
except NoLinearCombination:
1337-
include(line_L)
1332+
include(t_L, r_L) # entries (t, r) --> k**t * m + r
13381333
solution = (len(lines)-1)*(zero,) + (one,)
13391334
logger.debug('M_%s: f_{%s*m+%s} = %s * X_m',
13401335
s_L, k**t_L, r_L, solution)

0 commit comments

Comments
 (0)