@@ -173,14 +173,13 @@ shuffle = (T, col, row1, row2) -> (
173173 truncatedrow2 := (T#row2)_{col..len2-1}; -- grab row2 entries
174174 L := join ((T#row1)_{col-1..len1-1}, (T#row2)_{0..col-1});
175175 P := permutations L;
176- output := {};
177176 P = apply (P, i-> (for j from 0 to #T-1 list (
178177 if j == row1 then sort join (truncatedrow1, i_{0..len1-col})
179178 else if j == row2 then sort join (i_{len1-col+ 1..#i-1}, truncatedrow2)
180179 else T#j)));
181180 coeff := 0 ;
182181 for i in P do if i == T then coeff = coeff + 1 ;
183- for i in P do if i != T then output = append (output, ( i, -1 / coeff)) ;
182+ output := for i in P list if i != T then ( i, -1 / coeff) else continue ;
184183 return hashTable (plus , output);
185184 )
186185
@@ -198,11 +197,9 @@ towardStandard = T -> (
198197 if H #? T then (
199198 coeff := -(H#T) + 1 ;
200199 remove (H,T);
201- prehash := {};
202- for i in keys H do
203- prehash = append (prehash, (i, H#i / coeff));
200+ prehash := for i in keys H list (i, H#i / coeff);
204201 return hashTable (prehash)
205- )
202+ )
206203 else return new HashTable from H
207204 )
208205
@@ -216,13 +213,8 @@ towardStandard = T -> (
216213-- ZZ k: an index
217214-- Output:
218215-- Subtract one from the kth (in human count, not computer count) row of mu
219- subtractOne = (mu, k) -> (
220- result := {};
221- for i from 0 to #mu-1 when true do
222- if i == k-1 then result = append (result, mu_i - 1 )
223- else result = append (result, mu_i);
224- return result
225- )
216+ subtractOne = (mu, k) ->
217+ for i from 0 to #mu - 1 list (if i == k - 1 then mu_i - 1 else mu_i)
226218
227219-- -----------------------------------------------------------------------------
228220-- Convention infrastructure (added in this overhaul).
@@ -283,13 +275,11 @@ conjPartPM = mu -> toList conjugate (new Partition from trimPartPM mu)
283275-- Returns dual partition
284276dualPart = method ()
285277dualPart(List ) := mu -> (
286- result := {};
287- for i from 1 to mu#0 when true do (
278+ for i from 1 to mu#0 list (
288279 counter := 0 ;
289- for j from 0 to #mu-1 when true do if mu#j >= i then counter = counter + 1 ;
290- result = append (result, counter);
291- );
292- return result;
280+ for j from 0 to #mu - 1 do if mu#j >= i then counter = counter + 1 ;
281+ counter
282+ )
293283 )
294284
295285-- Computes the dimension of S_mu V where V has dimension n and
@@ -316,21 +306,15 @@ standardTableaux = method()
316306standardTableaux(ZZ , List ) := (dim , mu) -> standardTableauxCache#(dim , mu) ??= (
317307 if #mu == 0 then {{}}
318308 else (
319- output := {};
320309 otherrows := standardTableaux(dim , drop (mu, 1 ));
321310 firstrow := rsort compositions (dim , mu#0);
322- for i in firstrow do (
323- temp := {};
324- for j from 0 to #i-1 do
325- for k from 1 to i#j when true do
326- temp = append (temp,j);
327- for j in otherrows do (
328- temp2 := prepend (temp,j);
329- if isStandardPM(temp2) === null then
330- output = append (output, temp2);
331- );
332- );
333- output
311+ flatten for i in firstrow list (
312+ temp := flatten for j from 0 to #i - 1 list toList (i#j : j);
313+ for j in otherrows list (
314+ temp2 := prepend (temp, j);
315+ if isStandardPM(temp2) === null then temp2 else continue
316+ )
317+ )
334318 )
335319 )
336320
@@ -576,7 +560,6 @@ pieriHelper = method()
576560pieriHelper(List , ZZ , PolynomialRing ) := (mu, k, P) -> (
577561 d := numgens P;
578562 X := gens P;
579- output := {};
580563 Sbasis := standardTableaux(d, mu);
581564 Tbasis := standardTableaux(d, subtractOne(mu, k));
582565 mu = prepend (0,mu);
@@ -596,22 +579,19 @@ pieriHelper(List, ZZ, PolynomialRing) := (mu, k, P) -> (
596579 for q from 1 to #J-2 when true do cJ = cJ * (mu_(J_q) - mu_k + k - J_q);
597580 (-1)^#J / cJ
598581 );
599- for s in apply (Sbasis, i->prepend ({},i)) do (
600- row := {};
582+ output := for s in apply (Sbasis, i->prepend ({},i)) list (
601583 H := new HashTable from {};
602584 for jIdx from 0 to #A - 1 do (
603585 J := A#jIdx;
604586 h := hashTable ({(s, hCoefs#jIdx)});
605- for i from 0 to #J-2 when true do (
606- temp := {};
607- for T in keys h do (
608- for b from 0 to #(T_(J_(i+ 1)))-1 when true do (
587+ for i from 0 to #J - 2 do (
588+ temp := flatten for T in keys h list
589+ for b from 0 to #(T_(J_(i+ 1))) - 1 list (
609590 U := new MutableList from T;
610591 U#(J_(i+ 1)) = drop (U#(J_(i+ 1)), {b, b});
611592 U#(J_i) = append (U#(J_i), (T_(J_(i+ 1)))_b);
612- temp = append (temp, ( new List from U, h#T));
593+ ( new List from U, h#T)
613594 );
614- );
615595 h = hashTable (plus , temp);
616596 );
617597 H = merge (H, h, plus );
@@ -625,8 +605,7 @@ pieriHelper(List, ZZ, PolynomialRing) := (mu, k, P) -> (
625605 for i in keys memo#U do
626606 H#i = (H#i ?? 0 ) + coeff * (memo#U)#i * X_((T_0)_0);
627607 );
628- for t in Tbasis do row = append (row, H#t ?? 0 );
629- output = append (output, row);
608+ for t in Tbasis list (H#t ?? 0 )
630609 );
631610 return map (P^(#Tbasis), P^{#Sbasis:-1}, transpose output);
632611 )
@@ -830,23 +809,18 @@ pierip(List, List, PolynomialRing) := (mu, boxes, P) -> (
830809 R := QQ [X];
831810 f := pierizero(mu, boxes, R);
832811 mon := apply (compositions (d, #boxes), i-> (output := 1 ; for j from 0 to #i-1 do output = output * X_j^(i#j); output));
833- result := {};
834812 denom := 1 ;
835- for i from 0 to (rank source f)-1 do (
813+ result := for i from 0 to (rank source f) - 1 list (
836814 row := flatten entries f_{i};
837- newrow := {};
838- for j from 0 to #row-1 do
839- for k in mon do (
840- coeff := coefficient (k, row#j);
841- temp := ceiling (1 / gcd (coeff, 1 ));
842- denom = denom * temp / gcd (denom, temp);
843- newrow = append (newrow, coeff);
844- );
845- result = append (result, newrow);
815+ flatten for j from 0 to #row - 1 list
816+ for k in mon list (
817+ coeff := coefficient (k, row#j);
818+ temp := ceiling (1 / gcd (coeff, 1 ));
819+ denom = denom * temp / gcd (denom, temp);
820+ coeff
821+ )
846822 );
847- result2 := {};
848- for i in result do
849- result2 = append (result2, apply (i, j -> round (j* denom)));
823+ result2 := apply (result, i -> apply (i, j -> round (j * denom)));
850824 intmat := map (ZZ ^((rank target f) * #mon), ZZ ^(rank source f), transpose (result2));
851825 (D, S, T) := smithNormalForm (intmat);
852826 S' := (S^(-1))_{0..(rank source D)-1};
@@ -862,14 +836,13 @@ pierip(List, List, PolynomialRing) := (mu, boxes, P) -> (
862836pureFree = method (Options => {Convention => " Row" })
863837pureFree(List , PolynomialRing ) := opts -> (d, P) -> (
864838 if not isIncreasing(d) then error " The first argument needs to be a strictly increasing list of degrees." ;
865- e := {};
866- for i from 1 to #d-1 do e = append (e, d#i - d#(i-1));
867- counter := -#e + 1 ;
868- for i in e do counter = counter + i;
869- lambda := {counter - e#0};
870- for i from 1 to #e-1 do
871- lambda = append (lambda, lambda#(i-1) - e#i + 1 );
872- lambda = prepend (counter, drop (lambda, 1 ));
839+ e := for i from 1 to #d - 1 list (d#i - d#(i-1));
840+ counter := -#e + 1 + sum e;
841+ -- lambda#0 = counter - e#0; lambda#i = lambda#(i-1) - e#i + 1 for i >= 1.
842+ -- Build the running tail; the head is later replaced with counter.
843+ cur := counter - e#0;
844+ tail := for i from 1 to #e - 1 list (cur = cur - e#i + 1 ; cur);
845+ lambda := prepend (counter, tail);
873846 pieri(lambda, toList (e#0 : 1 ), P, Convention => opts.Convention) ** P^{-d#0}
874847 )
875848
0 commit comments