Skip to content

Commit a8c3d77

Browse files
author
Release Manager
committed
gh-35685: unify input of matrices and vectors For recognizable series the input is handled differently for matrices and vectors. This easy patch unifies this. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. URL: #35685 Reported by: Daniel Krenn Reviewer(s): Daniel Krenn, Travis Scrimshaw
2 parents a7af729 + a10ce8c commit a8c3d77

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/sage/combinat/k_regular_sequence.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ def __init__(self, parent, mu, left=None, right=None):
150150
151151
:doc:`k-regular sequence <k_regular_sequence>`,
152152
:class:`kRegularSequenceSpace`.
153+
154+
TESTS::
155+
156+
sage: Seq2(([[1, 0], [0, 1]], [[1, 1], [0, 1]]), (1, 0), (0, 1))
157+
2-regular sequence 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, ...
153158
"""
154159
super().__init__(parent=parent, mu=mu, left=left, right=right)
155160

src/sage/combinat/recognizable_series.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ def __init__(self, parent, mu, left, right):
441441
super(RecognizableSeries, self).__init__(parent=parent)
442442

443443
from copy import copy
444+
from sage.matrix.constructor import Matrix
444445
from sage.modules.free_module_element import vector
445446
from sage.sets.family import Family
446447

@@ -456,7 +457,7 @@ def immutable(m):
456457
return m
457458

458459
if isinstance(mu, dict):
459-
mu = dict((a, immutable(M)) for a, M in mu.items())
460+
mu = {a: Matrix(M, immutable=True) for a, M in mu.items()}
460461
mu = Family(mu)
461462

462463
if not mu.is_finite():

0 commit comments

Comments
 (0)