Skip to content

Commit ecb3663

Browse files
committed
Trac #21325 review comment 17: simpler (more readable) construction of block matrix
1 parent 33d4dae commit ecb3663

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/sage/combinat/k_regular_sequence.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,16 @@ def partial_sums(self, include_n=False):
656656
sage: P = E.partial_sums(minimize=False)
657657
sage: P.linear_representation()
658658
((1, 0, -1, 0),
659-
Finite family {0: [ 0 1 0 0]
660-
[ 0 2 0 -1]
661-
[ 0 0 0 1]
662-
[ 0 0 0 1],
663-
1: [0 1 0 0]
664-
[0 2 0 0]
665-
[0 0 0 0]
666-
[0 0 0 1]},
659+
Finite family {0: [ 0 1| 0 0]
660+
[ 0 2| 0 -1]
661+
[-----+-----]
662+
[ 0 0| 0 1]
663+
[ 0 0| 0 1],
664+
1: [0 1|0 0]
665+
[0 2|0 0]
666+
[---+---]
667+
[0 0|0 0]
668+
[0 0|0 1]},
667669
(1, 1, 1, 1))
668670
"""
669671
from sage.matrix.constructor import Matrix
@@ -678,11 +680,10 @@ def partial_sums(self, include_n=False):
678680
B = {r: sum(self.mu[a] for a in A[r:]) for r in A}
679681
Z = zero_matrix(dim)
680682
B[k] = Z
681-
W = B[0].stack(Z)
682683

683684
result = P.element_class(
684685
P,
685-
{r: W.augment((-B[r+1]).stack(self.mu[r])) for r in A},
686+
{r: Matrix.block([[B[0], -B[r+1]], [Z, self.mu[r]]]) for r in A},
686687
vector(tuple(self.left) +
687688
(dim*(0,) if include_n else tuple(-self.left))),
688689
vector(2*tuple(self.right)))

0 commit comments

Comments
 (0)