@@ -397,15 +397,17 @@ def _error_if_degenerated_(self):
397
397
"for correcting this." )
398
398
399
399
@cached_method
400
- def regenerated (self , minimize = True ):
400
+ def regenerated (self , ** kwds ):
401
401
r"""
402
402
Return a `k`-regular sequence that satisfies
403
403
`\mu[0] \mathit{right} = \mathit{right}`.
404
404
405
405
INPUT:
406
406
407
- - ``minimize`` -- (default: ``True``) a boolean. If set, then
408
- :meth:`minimized` is called after the operation.
407
+ - ``minimize`` -- (default: ``None``) a boolean or ``None``.
408
+ If ``True``, then :meth:`~RecognizableSeries.minimized` is called after the operation,
409
+ if ``False``, then not. If this argument is ``None``, then
410
+ the default specified by the parent's ``minimize_results`` is used.
409
411
410
412
OUTPUT:
411
413
@@ -451,19 +453,43 @@ def regenerated(self, minimize=True):
451
453
)
452
454
sage: H.is_degenerated()
453
455
False
456
+ """
457
+ if not self .is_degenerated ():
458
+ return self
459
+ return self ._regenerated_ (** kwds )
454
460
455
- ::
461
+ @minimize_result
462
+ def _regenerated_ (self ):
463
+ r"""
464
+ Return a `k`-regular sequence that satisfies
465
+ `\mu[0] \mathit{right} = \mathit{right}`.
466
+
467
+ Compared to :meth:`regenerated`, this method skips some initial checks
468
+ whether the sequence is degenerated or not.
469
+
470
+ See also :meth:`regenerated`.
471
+
472
+ INPUT:
473
+
474
+ - ``minimize`` -- (default: ``None``) a boolean or ``None``.
475
+ If ``True``, then :meth:`~RecognizableSeries.minimized` is called after the operation,
476
+ if ``False``, then not. If this argument is ``None``, then
477
+ the default specified by the parent's ``minimize_results`` is used.
456
478
479
+ OUTPUT:
480
+
481
+ A :class:`kRegularSequence`
482
+
483
+ TESTS::
484
+
485
+ sage: Seq2 = kRegularSequenceSpace(2, ZZ)
457
486
sage: C = Seq2((Matrix([[2, 0], [2, 1]]), Matrix([[0, 1], [-2, 3]])),
458
487
....: vector([1, 0]), vector([0, 1]))
459
488
sage: C.is_degenerated()
460
489
False
461
- sage: C.regenerated() is C
490
+ sage: C.regenerated() is C # indirect doctest
462
491
True
463
492
"""
464
- if not self .is_degenerated ():
465
- return self
466
-
467
493
from sage .matrix .special import zero_matrix , identity_matrix
468
494
from sage .modules .free_module_element import vector
469
495
@@ -478,16 +504,11 @@ def regenerated(self, minimize=True):
478
504
mu .update ((r , Z .augment (Z ).stack (self .mu [r ].augment (self .mu [r ])))
479
505
for r in itA )
480
506
481
- result = P .element_class (
507
+ return P .element_class (
482
508
P , mu ,
483
509
vector (2 * tuple (self .left )),
484
510
vector (tuple (self .right ) + dim * (0 ,)))
485
511
486
- if minimize :
487
- return result .minimized ()
488
- else :
489
- return result
490
-
491
512
def transposed (self , allow_degenerated_sequence = False ):
492
513
r"""
493
514
Return the transposed sequence.
0 commit comments