Skip to content

Commit

Permalink
Use only one db call rather than one per level
Browse files Browse the repository at this point in the history
  • Loading branch information
roed314 committed Oct 27, 2024
1 parent d8ffff1 commit ec4c379
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lmfdb/classical_modular_forms/web_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ def make_oldspace_data(newspace_label, char_conductor, prim_orbit_index):
level = int(newspace_label.split('.')[0])
weight = int(newspace_label.split('.')[1])
sub_level_list = [sub_level for sub_level in divisors(level) if (sub_level % char_conductor == 0) and sub_level != level]
sub_chars = list(db.char_dirichlet.search({'modulus':{'$in':sub_level_list}, 'conductor':char_conductor, 'primitive_orbit':prim_orbit_index}))
sub_chars = {char['modulus'] : char for char in sub_chars}
sub_chars = {char['modulus'] : char for char in db.char_dirichlet.search({'modulus':{'$in':sub_level_list}, 'conductor':char_conductor, 'primitive_orbit':prim_orbit_index})}
if weight == 1:
newspace_dims = {rec['level']: rec['dim'] for rec in db.mf_newspaces.search({'weight': weight, '$or': [{'level': sub_level, 'char_orbit_index': sub_chars[sub_level]['orbit']} for sub_level in sub_level_list]}, ['level', 'dim'])}
oldspaces = []
for sub_level in sub_level_list:
entry = {}
Expand All @@ -305,7 +306,7 @@ def make_oldspace_data(newspace_label, char_conductor, prim_orbit_index):
entry['sub_mult'] = number_of_divisors(level/sub_level)
# only include subspaces with positive dimension (computed on the fly unless with weight is 1)
if weight == 1:
if db.mf_newspaces.lucky({'level':sub_level,'weight':weight,'char_orbit_index':entry['sub_char_orbit_index']},projection='dim') > 0:
if newspace_dims[sub_level] > 0:
oldspaces.append(entry)
else:
if int(gp('mfdim([%i, %i, znchar(Mod(%i,%i))], 0)' % (sub_level, weight, entry['sub_conrey_index'], sub_level))) > 0:
Expand Down

0 comments on commit ec4c379

Please sign in to comment.