Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up some methods for quasimodular forms ring elements #34778

Closed
DavidAyotte opened this issue Nov 23, 2022 · 14 comments · Fixed by #35004
Closed

Speed up some methods for quasimodular forms ring elements #34778

DavidAyotte opened this issue Nov 23, 2022 · 14 comments · Fixed by #35004

Comments

@DavidAyotte
Copy link
Member

The goal of this ticket is to refactor the following methods:

  • QuasiModularFormsElement.weights_list
  • QuasiModularFormsElement.is_homogeneous
  • QuasiModularFormsElement.weight
  • QuasiModularFormsElement.homogeneous_components

Currently, these methods are implemented using polynomial conversion of graded quasimodular forms ring elements which is relatively expensive and totally unecessary. It is possible to speed up the code simply by using the fact that a graded quasimodular form is a univariate polynomial in E2 (the weight 2 Eisenstein series) over the subring of modular forms.

CC: @videlec

Component: modular forms

Author: David Ayotte

Branch/Commit: u/gh-DavidAyotte/refactor_weight_method_quasimodforms @ 271d87d

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/34778

@DavidAyotte
Copy link
Member Author

@DavidAyotte
Copy link
Member Author

Commit: 8eb423f

@DavidAyotte
Copy link
Member Author

comment:2

Some tests:

sage: QM = QuasiModularForms(1)
sage: E2, E4, E6 = QM.gens()
sage: F = E6^3 + E4^4*E2 + (E4^2*E6)*E2^2 + (E4^3 + E6^2)*E2^3
sage: time(F.weight())
CPU times: user 114 µs, sys: 15 µs, total: 129 µs
Wall time: 133 µs
18
sage: time(F.is_homogeneous())
CPU times: user 109 µs, sys: 14 µs, total: 123 µs
Wall time: 128 µs
True
sage: time(F.homogeneous_components())
CPU times: user 10.5 ms, sys: 31 µs, total: 10.6 ms
Wall time: 10.2 ms
{18: 5 - 1296*q + 1287504*q^2 - 79583040*q^3 - 8643792240*q^4 - 476322048864*q^5 + O(q^6)}
sage: time(F.weights_list())
CPU times: user 2.3 ms, sys: 0 ns, total: 2.3 ms
Wall time: 2.31 ms
[18]

The same tests performed on the current develop branch:

sage: QM = QuasiModularForms(1)
sage: E2, E4, E6 = QM.gens()
sage: F = E6^3 + E4^4*E2 + (E4^2*E6)*E2^2 + (E4^3 + E6^2)*E2^3
sage: time(F.weight())
CPU times: user 190 ms, sys: 0 ns, total: 190 ms
Wall time: 186 ms
18
sage: time(F.is_homogeneous())
CPU times: user 16 ms, sys: 0 ns, total: 16 ms
Wall time: 15.2 ms
True
sage: time(F.homogeneous_components())
CPU times: user 28.6 ms, sys: 428 µs, total: 29 ms
Wall time: 27.6 ms
{18: 5 - 1080*q + 1272024*q^2 - 49729248*q^3 - 8985745800*q^4 - 449504439120*q^5 + O(q^6)}
sage: time(F.weights_list())
CPU times: user 19.4 ms, sys: 504 µs, total: 19.9 ms
Wall time: 19 ms
[18]

New commits:

8eb423fsrc/sage/modular/quasimodform/element.py: refactor weight, homogeneous_components and is_homogeneous

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 23, 2022

Changed commit from 8eb423f to 99b8518

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 23, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

99b8518src/sage/modular/quasimodform/element.py: fix small mistake

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 23, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

da7e598src/sage/modular/quasimodform/element.py: fix doctest

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 23, 2022

Changed commit from 99b8518 to da7e598

@videlec
Copy link
Contributor

videlec commented Nov 26, 2022

comment:5

Maybe

-        return sorted(list(self.homogeneous_components().keys()))
+        return sorted(self.homogeneous_components().keys())

@videlec
Copy link
Contributor

videlec commented Nov 26, 2022

Reviewer: Vincent Delecroix

@videlec
Copy link
Contributor

videlec commented Nov 26, 2022

comment:6

The rest looks good to me.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 26, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

d5c79a7src/sage/modular/quasimodform/element.py: add continue statement in is_homogeneous
271d87dsrc/sage/modular/quasimodform/element.py: apply suggestion

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 26, 2022

Changed commit from da7e598 to 271d87d

@vbraun
Copy link
Member

vbraun commented Dec 3, 2022

comment:10

Merge failure on top of:

015f8720227 Trac #34760: latex of empty SkewPartition is broken

5c23d3eeb96 Trac #34734: Adapt findstat interface to new version of findstat.org

d37bee32ca5 Trac #34714: fast path for factoring monomials over number fields

06e4d048d10 Trac #34698: Fix conversion bug in modular forms rings

59b829a72eb Trac #34690: implement more constructions for Hadamard matrices, e.g. for size 116

a372136c066 Trac #33941: Implement from_integer and to_integer for all finite fields, extending and replacing fetch_int and integer_representation

3b1c9de1201 Trac #33757: commutativity test

34266283ab5 Trac #29360: change_ring() should preserve sparsity of vectors and vector spaces

1f56ce0e9d7 Trac #27652: parent of plethysm

019537d9929 Trac #34693: Further support for matplotlib 3.6

59e9f7b4f01 Trac #34658: Update numpy to 1.23.5, scipy 1.9.3, networkx 2.8.8, meson_python 0.11.0

6d03a671290 Trac #34593: Document and manage temporary directories

454290087ec Trac #33842: Upgrade python to 3.11

f53f07a Trac #34766: GH Actions: Update actions

795383f Trac #34728: change sorting for WeierstrassIsomorphism

2cec793 Trac #33562: Bad error message for weighted adjacency matrix

3670306 Trac #34740: dead hyperlinks in developer manual

9666ae7 Trac #34722: some code cleanup in WeierstrassIsomorphism

f41abf6 Trac #34759: some details in filtered simplicial complexes

dfc299b Trac #34756: Documentation regarding setting up SageMath's Jupyter kernel in an existing installation points to wrong directory

513a7bc Trac #34753: fix all W391 in pyx files

7503e42 Trac #34751: Update sage tutorial

623ea74 Trac #34745: modernize super in algebras/ again

f2fa759 Trac #34741: OS X 13: filter out dylib warning

a4748c3 Trac #34738: tiny details in symbolic min and max

fb213df Trac #34769: use libgap in simplicial_complex

01beb6a Trac #34765: meson: Add spkg-configure.m4

d94c733 Trac #34762: Fix random chain complex doctest

b3398f0 Trac #34761: Remove src/sage/libs/fes.pyx

3c42a39 Trac #34754: Remove module-level imports from sage.plot

0d12058 Trac #34569: Fix some quasimodular forms rings methods for congruence subgroups

84f02af Updated SageMath version to 9.8.beta4

merge was not clean: conflicts in src/sage/modular/quasimodform/element.py

@mkoeppe
Copy link
Contributor

mkoeppe commented Feb 12, 2023

Removed branch from the issue description because it has been replaced by PR #35004

@vbraun vbraun closed this as completed in 0f0a0d4 Feb 24, 2023
@mkoeppe mkoeppe added this to the sage-10.0 milestone Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants