sagemath/sage

Use Vector_symbolic_dense also for symbolic subrings of SR, not just SR

Opened this issue · 11 comments

(split out from #31982)

We change the function sage.modules.free_module.element_class so that it uses the element class Vector_symbolic_dense not only for free modules over the ring SR but also for free modules over subrings of SR such as the symbolic constants ring.

In fact, we dispatch through a new method _free_module_element_class_dense.

CC: @egourgoulhon @mjungmath @tscrim

Component: symbolics

Author: Matthias Koeppe

Branch/Commit: u/mkoeppe/use_vector_symbolic_dense_for_all_symbolic_rings__not_just_sr @ 52396f4

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

New commits:

a1eccc9sage.modules.free_module.element_class: Use Vector_callable_symbolic_dense also for whose modules over rings whose base rings are symbolic rings/subrings
dbfe7acsrc/sage/modules/free_module.py: Update copyright years according to 'git blame -w --date=format:%Y src/sage/modules/free_module.py | sort -k2'
cfd813bsage.modules.free_module.element_class: For rings with SR base ring, delegate to new method _free_module_element_class_dense
278aa2bCallableSymbolicExpressionRing_class: Fix doctest
e33586dVector_symbolic_dense: Fix pickling

Author: Matthias Koeppe

Commit: e33586d

comment:3

What about if we have something like R = SR['t']['x']? Then the base ring of R is SR['t'], which is not SR. How do you want to handle that?

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

52396f4sage.modules.free_module.element_class: Do not handle the case of rings whose base rings are symbolic

Changed commit from e33586d to 52396f4

comment:5

OK, this needs more thought. For now I have reduced the scope of the ticket. Ready for review.

Description changed:

--- 
+++ 
@@ -1,6 +1,6 @@
 (split out from #31982)
 
-We change the function `sage.modules.free_module.element_class` so that it uses the element class `Vector_symbolic_dense` not only for free modules over the ring `SR` but also for free modules over any commutative ring whose base ring is `SR`.
+We change the function `sage.modules.free_module.element_class` so that it uses the element class `Vector_symbolic_dense` not only for free modules over the ring `SR` but also for free modules over subrings of `SR` such as the symbolic constants ring.
 
 In fact, we dispatch through a new method `_free_module_element_class_dense`.
 
comment:7

The pickling error first observed in #31982 unsurprisingly also shows up here:

sage -t --long --random-seed=0 src/sage/algebras/lie_algebras/quotient.py  # 1 doctest failed
sage -t --long --random-seed=0 src/sage/modules/free_module_element.pyx  # 1 doctest failed
comment:8

Setting a new milestone for this ticket based on a cursory review.