96
96
97
97
from .recognizable_series import RecognizableSeries
98
98
from .recognizable_series import RecognizableSeriesSpace
99
+ from .recognizable_series import minimize_result
99
100
from sage .misc .cachefunc import cached_method
100
101
101
102
@@ -276,7 +277,8 @@ def __iter__(self):
276
277
from itertools import count
277
278
return iter (self [n ] for n in count ())
278
279
279
- def subsequence (self , a , b , minimize = True ):
280
+ @minimize_result
281
+ def subsequence (self , a , b ):
280
282
r"""
281
283
Return the subsequence with indices `an+b` of this
282
284
`k`-regular sequence.
@@ -291,8 +293,10 @@ def subsequence(self, a, b, minimize=True):
291
293
`b_j \mapsto c_j`. If so, the result will be the sum
292
294
of all `c_j(an+b_j)`.
293
295
294
- - ``minimize`` -- (default: ``True``) a boolean. If set, then
295
- :meth:`minimized` is called after the operation.
296
+ - ``minimize`` -- (default: ``None``) a boolean or ``None``.
297
+ If ``True``, then :meth:`minimized` is called after the operation,
298
+ if ``False``, then not. If this argument is ``None``, then
299
+ the default specified by the parent's ``minimize_results`` is used.
296
300
297
301
OUTPUT:
298
302
@@ -460,10 +464,7 @@ def mu_line(r, i, c):
460
464
if c >= 0 else dim * (zero ,)
461
465
for c in kernel ), tuple ())))
462
466
463
- if minimize :
464
- return result .minimized ()
465
- else :
466
- return result
467
+ return result
467
468
468
469
def backward_differences (self , ** kwds ):
469
470
r"""
@@ -472,8 +473,10 @@ def backward_differences(self, **kwds):
472
473
473
474
INPUT:
474
475
475
- - ``minimize`` -- (default: ``True``) a boolean. If set, then
476
- :meth:`minimized` is called after the operation.
476
+ - ``minimize`` -- (default: ``None``) a boolean or ``None``.
477
+ If ``True``, then :meth:`minimized` is called after the operation,
478
+ if ``False``, then not. If this argument is ``None``, then
479
+ the default specified by the parent's ``minimize_results`` is used.
477
480
478
481
OUTPUT:
479
482
@@ -511,8 +514,10 @@ def forward_differences(self, **kwds):
511
514
512
515
INPUT:
513
516
514
- - ``minimize`` -- (default: ``True``) a boolean. If set, then
515
- :meth:`minimized` is called after the operation.
517
+ - ``minimize`` -- (default: ``None``) a boolean or ``None``.
518
+ If ``True``, then :meth:`minimized` is called after the operation,
519
+ if ``False``, then not. If this argument is ``None``, then
520
+ the default specified by the parent's ``minimize_results`` is used.
516
521
517
522
OUTPUT:
518
523
@@ -539,7 +544,8 @@ def forward_differences(self, **kwds):
539
544
"""
540
545
return self .subsequence (1 , {1 : 1 , 0 : - 1 }, ** kwds )
541
546
542
- def partial_sums (self , include_n = False , minimize = True ):
547
+ @minimize_result
548
+ def partial_sums (self , include_n = False ):
543
549
r"""
544
550
Return the sequence of partial sums of this
545
551
`k`-regular sequence. That is, the `n`th entry of the result
@@ -551,8 +557,10 @@ def partial_sums(self, include_n=False, minimize=True):
551
557
the `n`th entry of the result is the sum of the entries up
552
558
to index `n` (included).
553
559
554
- - ``minimize`` -- (default: ``True``) a boolean. If set, then
555
- :meth:`minimized` is called after the operation.
560
+ - ``minimize`` -- (default: ``None``) a boolean or ``None``.
561
+ If ``True``, then :meth:`minimized` is called after the operation,
562
+ if ``False``, then not. If this argument is ``None``, then
563
+ the default specified by the parent's ``minimize_results`` is used.
556
564
557
565
OUTPUT:
558
566
@@ -620,10 +628,7 @@ def partial_sums(self, include_n=False, minimize=True):
620
628
(dim * (0 ,) if include_n else tuple (- self .left ))),
621
629
vector (2 * tuple (self .right )))
622
630
623
- if minimize :
624
- return result .minimized ()
625
- else :
626
- return result
631
+ return result
627
632
628
633
629
634
class kRegularSequenceSpace (RecognizableSeriesSpace ):
0 commit comments