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

sage.categories: Add # optional for modularization; reformat doctests #35422

Merged
merged 24 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
70acfc7
sage.categories: Add # optional; doctest cosmetics
mkoeppe Apr 2, 2023
1a22510
Fixups
mkoeppe Apr 3, 2023
0398033
sage.categories: More # optional
mkoeppe Apr 7, 2023
831c754
sage.categories: Align # optional
mkoeppe Apr 7, 2023
4de54cf
Fixups
mkoeppe Apr 7, 2023
7cb61c9
sage.categories: Fix/realign some # optional
mkoeppe Apr 16, 2023
e3c01e5
Update src/sage/categories/additive_magmas.py
mkoeppe Apr 16, 2023
02cabdf
Update src/sage/categories/coxeter_groups.py
mkoeppe Apr 16, 2023
b593f50
Update src/sage/categories/finitely_generated_lambda_bracket_algebras.py
mkoeppe Apr 16, 2023
f985b6c
src/sage/categories/finite_dimensional_nilpotent_lie_algebras_with_ba…
mkoeppe Apr 16, 2023
3d52da4
src/sage/categories: Re-align # optional
mkoeppe Apr 16, 2023
d1dd594
Update src/sage/categories/lambda_bracket_algebras_with_basis.py
mkoeppe Apr 16, 2023
7d114f9
Update src/sage/categories/lambda_bracket_algebras_with_basis.py
mkoeppe Apr 16, 2023
2d0fb65
src/sage/categories: Re-align # optional
mkoeppe Apr 16, 2023
897e21a
src/sage/categories: Re-align # optional
mkoeppe Apr 16, 2023
f911b14
src/sage/categories: Re-align # optional
mkoeppe Apr 16, 2023
1595829
Update src/sage/categories/category.py
mkoeppe Apr 16, 2023
260b83b
src/sage/categories: Re-align # optional
mkoeppe Apr 16, 2023
21952a1
Fixup
mkoeppe Apr 16, 2023
59ab512
Merge tag '10.0.rc0' into sage_categories_reformat_doctests
mkoeppe Apr 23, 2023
67b892b
sage.categories: More # optional
mkoeppe Apr 25, 2023
dda9fb7
src/sage/categories/vector_spaces.py: Fix # optional
mkoeppe Apr 27, 2023
4a7c0c2
Merge remote-tracking branch 'upstream/develop' into sage_categories_…
mkoeppe May 15, 2023
e02b79e
src/sage/categories/additive_magmas: Remove trailing whitespace
mkoeppe May 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 38 additions & 29 deletions src/sage/categories/action.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ A group action `G \times S \rightarrow S` is a functor from `G` to Sets.
sage: import gc
sage: _ = gc.collect()
sage: A
<repr(<sage.categories.action.Action at 0x...>) failed: RuntimeError: This action acted on a set that became garbage collected>
<repr(<sage.categories.action.Action at 0x...>) failed:
RuntimeError: This action acted on a set that became garbage collected>
To avoid garbage collection of the underlying set, it is sufficient to
create a strong reference to it before the action is created.
Expand Down Expand Up @@ -265,15 +266,17 @@ cdef class Action(Functor):
sage: R = (ZZ['x'])['y']
sage: A = R.get_action(P,operator.mul,True)
sage: A # indirect doctest
Right scalar multiplication by Univariate Polynomial Ring in x over
Rational Field on Univariate Polynomial Ring in y over Univariate
Polynomial Ring in x over Integer Ring
Right scalar multiplication
by Univariate Polynomial Ring in x over Rational Field
on Univariate Polynomial Ring in y over
Univariate Polynomial Ring in x over Integer Ring
In this example, the underlying set is the ring ``R``. This is the same
as the left domain, which is different from the codomain of the action::
sage: A.codomain()
Univariate Polynomial Ring in y over Univariate Polynomial Ring in x over Rational Field
Univariate Polynomial Ring in y
over Univariate Polynomial Ring in x over Rational Field
sage: A.codomain() == R
False
sage: A.left_domain() is R
Expand All @@ -294,7 +297,8 @@ cdef class Action(Functor):
sage: import gc
sage: _ = gc.collect()
sage: A
<repr(<sage.categories.action.Action at 0x...>) failed: RuntimeError: This action acted on a set that became garbage collected>
<repr(<sage.categories.action.Action at 0x...>) failed:
RuntimeError: This action acted on a set that became garbage collected>
"""
S = self.US()
if S is None:
Expand Down Expand Up @@ -329,24 +333,28 @@ cdef class InverseAction(Action):
EXAMPLES::
sage: V = QQ^3
sage: v = V((1, 2, 3))
sage: V = QQ^3 # optional - sage.modules
sage: v = V((1, 2, 3)) # optional - sage.modules
sage: cm = get_coercion_model()
sage: a = cm.get_action(V, QQ, operator.mul)
sage: a
Right scalar multiplication by Rational Field on Vector space of dimension 3 over Rational Field
sage: ~a
Right inverse action by Rational Field on Vector space of dimension 3 over Rational Field
sage: (~a)(v, 1/3)
sage: a = cm.get_action(V, QQ, operator.mul) # optional - sage.modules
sage: a # optional - sage.modules
Right scalar multiplication by Rational Field
on Vector space of dimension 3 over Rational Field
sage: ~a # optional - sage.modules
Right inverse action by Rational Field
on Vector space of dimension 3 over Rational Field
sage: (~a)(v, 1/3) # optional - sage.modules
(3, 6, 9)
sage: b = cm.get_action(QQ, V, operator.mul)
sage: b
Left scalar multiplication by Rational Field on Vector space of dimension 3 over Rational Field
sage: ~b
Left inverse action by Rational Field on Vector space of dimension 3 over Rational Field
sage: (~b)(1/3, v)
sage: b = cm.get_action(QQ, V, operator.mul) # optional - sage.modules
sage: b # optional - sage.modules
Left scalar multiplication by Rational Field
on Vector space of dimension 3 over Rational Field
sage: ~b # optional - sage.modules
Left inverse action by Rational Field
on Vector space of dimension 3 over Rational Field
sage: (~b)(1/3, v) # optional - sage.modules
(3, 6, 9)
sage: c = cm.get_action(ZZ, list, operator.mul)
Expand Down Expand Up @@ -390,11 +398,11 @@ cdef class InverseAction(Action):
Check that this action can be pickled (:trac:`29031`)::
sage: V = QQ^3
sage: v = V((1, 2, 3))
sage: cm = get_coercion_model()
sage: a = cm.get_action(V, QQ, operator.mul)
sage: loads(dumps(~a)) is not None
sage: V = QQ^3 # optional - sage.modules
sage: v = V((1, 2, 3)) # optional - sage.modules
sage: cm = get_coercion_model() # optional - sage.modules
sage: a = cm.get_action(V, QQ, operator.mul) # optional - sage.modules
sage: loads(dumps(~a)) is not None # optional - sage.modules
True
"""
return (type(self), (self._action,))
Expand Down Expand Up @@ -434,8 +442,9 @@ cdef class PrecomposedAction(Action):
sage: c,x = v[0]
sage: y = x.modular_symbol_rep()
sage: coercion_model.get_action(QQ, parent(y), op=operator.mul)
Left scalar multiplication by Rational Field on Abelian Group of all Formal Finite Sums over Rational Field
with precomposition on right by Coercion map:
Left scalar multiplication by Rational Field
on Abelian Group of all Formal Finite Sums over Rational Field
with precomposition on right by Coercion map:
From: Abelian Group of all Formal Finite Sums over Integer Ring
To: Abelian Group of all Formal Finite Sums over Rational Field
"""
Expand Down Expand Up @@ -542,8 +551,8 @@ cdef class ActionEndomorphism(Morphism):
sage: A = ZZ['x'].get_action(QQ, self_on_left=False, op=operator.mul)
sage: A
Left scalar multiplication by Rational Field on Univariate Polynomial
Ring in x over Integer Ring
Left scalar multiplication by Rational Field
on Univariate Polynomial Ring in x over Integer Ring
sage: A(1/2)
Action of 1/2 on Univariate Polynomial Ring in x over Integer Ring
under Left scalar multiplication by Rational Field on Univariate
Expand Down
Loading