You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, random_element on a FreeModule constructs a basis, even if we know the basis is trivial. The attached patch fixes this for FreeModule_ambient and subclasses.
Before:
sage: K = FreeModule(ZZ, 2000)
sage: get_memory_usage()
118.60546875
sage: %time _ = K.random_element()
CPU times: user 1.45 s, sys: 0.12 s, total: 1.57 s
Wall time: 1.57 s
sage: get_memory_usage()
225.56640625
After:
sage: K = FreeModule(ZZ, 2000)
sage: get_memory_usage()
118.60546875
sage: %time _ = K.random_element()
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
sage: get_memory_usage()
118.60546875
sage: timeit('K.random_element()')
125 loops, best of 3: 2.32 ms per loop
Currently, random_element on a
FreeModule
constructs a basis, even if we know the basis is trivial. The attached patch fixes this forFreeModule_ambient
and subclasses.Before:
After:
A 600-fold speedup.
Component: linear algebra
Issue created by migration from https://trac.sagemath.org/ticket/3652
The text was updated successfully, but these errors were encountered: