Skip to content

Commit

Permalink
Remove conflicts in packages now that "sign" is in Core
Browse files Browse the repository at this point in the history
Either remove now-redundant methods or rename "sign" variables to "sgn".
  • Loading branch information
d-torrance committed Jan 20, 2025
1 parent 0a3fff3 commit 2fe9d89
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 50 deletions.
12 changes: 6 additions & 6 deletions M2/Macaulay2/packages/BettiCharacters.m2
Original file line number Diff line number Diff line change
Expand Up @@ -1122,9 +1122,9 @@ Node
the sign character just constructed: the result is the
same as the character of the resolution.
Example
sign = character(R,15,hashTable {(0,{7}) =>
sgn = character(R,15,hashTable {(0,{7}) =>
matrix{{1,-1,-1,1,-1,1,-1,1,1,-1,1,-1,1,-1,1}}})
dual(c,id_QQ)[-5] ** sign === c
dual(c,id_QQ)[-5] ** sgn === c
Text
The second argument in the @TT "dual"@ command is the
restriction of complex conjugation to the field of
Expand Down Expand Up @@ -2842,8 +2842,8 @@ Node
observed by tensoring with the character of the
sign representation concentrated in degree 3.
Example
sign = character(R,3, hashTable { (0,{3}) => matrix{{1,-1,1}} })
dual(a,{1,2,3}) ** sign === a
sgn = character(R,3, hashTable { (0,{3}) => matrix{{1,-1,1}} })
dual(a,{1,2,3}) ** sgn === a

///

Expand Down Expand Up @@ -3064,10 +3064,10 @@ K = freeResolution ideal vars R
S4 = symmetricGroupActors(R)
A = action(K,S4)
c = character A
sign = character(R,5, hashTable { (-4,{-4}) => matrix{{-1,1,1,-1,1}} })
sgn = character(R,5, hashTable { (-4,{-4}) => matrix{{-1,1,1,-1,1}} })
-- check duality of representations in Koszul complex
-- which is true up to a twist by a sign representation
assert(dual(c,id_QQ) == c ** sign)
assert(dual(c,id_QQ) == c ** sgn)
///

end
3 changes: 0 additions & 3 deletions M2/Macaulay2/packages/GradedLieAlgebras.m2
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export {
"mbRing",
"minimalModel",
"normalForm",
"sign",
"Signs",
"weight",
"VectorSpace",
Expand Down Expand Up @@ -2464,8 +2463,6 @@ isignlocal(BasicList,LieAlgebra):=(x,L)->
-- the sign of an element
-- in the Ext-algebra


sign=method()
sign(LieElement) := (x)->(
L:=class x;
-- xx:=normalForm(x);
Expand Down
10 changes: 0 additions & 10 deletions M2/Macaulay2/packages/Parametrization.m2
Original file line number Diff line number Diff line change
Expand Up @@ -702,16 +702,6 @@ return(rslt);
--p=rtpt(1180943,-14640196896);
--p_(0,0)^2+1180943*p_(0,1)^2-14640196896*p_(0,2)^2

sign=method()
sign(ZZ):=(n)->(
if n>0 then return(1);
if n<0 then return(-1);
0)
sign(QQ):=(n)->(
if n>0 then return(1);
if n<0 then return(-1);
0)

-- Jval(ZZ,ZZ,ZZ)
-- computes the index of the argument

Expand Down
12 changes: 6 additions & 6 deletions M2/Macaulay2/packages/Permanents.m2
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ryser Matrix := (M) -> (
for i from 1 to n-1 do(del = append(del,0););--delta is of length n

--take the initial product corresponding to delta all +1's
sign:=1;
sgn:=1;
prod:=1;
for i from 0 to n-1 do(
prod=prod*s#i;
Expand All @@ -60,7 +60,7 @@ ryser Matrix := (M) -> (
curIndex:=0;--which position in the gray code changed
curVal:=0;--what is the new value in the changed position of the gray code
for count from 2 to 2^n do(--start at 2 because we already took the initial product corresponding to delta consisting of all 1's
sign=(-1)*sign;
sgn=(-1)*sgn;
--increment delta
flag:=1;
for k from 0 to n-1 when flag==1 do(
Expand All @@ -79,7 +79,7 @@ ryser Matrix := (M) -> (
prod=prod*s#i;
);

permanent = permanent+sign*prod;
permanent = permanent+sgn*prod;
);

permanent
Expand Down Expand Up @@ -117,7 +117,7 @@ glynn Matrix := (M) -> (
for i from 1 to n-2 do(del = append(del,0););--delta is of length n-1 because first position is always positive, so we don't consider it in the gray code

--take the initial product corresponding to delta all +1's
sign:=1;
sgn:=1;
prod:=1;
for i from 0 to n-1 do(
prod=prod*s#i;
Expand All @@ -127,7 +127,7 @@ glynn Matrix := (M) -> (
curIndex:=0;--which position in the gray code changed
curVal:=0;--what is the new value in the changed position of the gray code
for count from 2 to 2^(n-1) do(--start at 2 because we already took the initial product corresponding to delta consisting of all 1's
sign=(-1)*sign;
sgn=(-1)*sgn;
--increment delta
flag:=1;
for k from 0 to n-2 when flag==1 do(
Expand All @@ -146,7 +146,7 @@ glynn Matrix := (M) -> (
prod=prod*s#i;
);

perm = perm+sign*prod;
perm = perm+sgn*prod;
);

--need to divide in Glynn's formula
Expand Down
4 changes: 1 addition & 3 deletions M2/Macaulay2/packages/Permutations.m2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export {
"isCDG",
"foataBijection",
"ord",
"sign",
"isEven",
"isOdd",
"isDerangement",
Expand Down Expand Up @@ -327,7 +326,6 @@ ord Permutation := ZZ => w -> (

-- see https://en.wikipedia.org/wiki/Parity_of_a_permutation for different ways
-- to compute the sign or parity of a permutation
sign = method()
sign Permutation := ZZ => w -> (
if even(#w - #(cycleDecomposition w)) then 1 else -1
)
Expand Down Expand Up @@ -377,4 +375,4 @@ installPackage "Permutations"
restart
needsPackage "Permutations"
elapsedTime check "Permutations"
viewHelp "Permutations"
viewHelp "Permutations"
11 changes: 0 additions & 11 deletions M2/Macaulay2/packages/RealRoots.m2
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ isArtinian (Ring) := Boolean => R->(
dim R === 0
)


--Computes the sign of a real number
sign = method()
for A in {ZZ,QQ,RR} do
sign (A) := ZZ => n->(
if n < 0 then -1
else if n == 0 then 0
else if n > 0 then 1
)


--Computes the sign of a real univariate polynomial at a given real number
signAt = method()
for A in {ZZ,QQ,RR} do
Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/Resultants.m2
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,14 @@ detectGrassmannian (QuotientRing) := (G) -> (

duality = method(TypicalValue => RingMap); -- p. 94 [Gelfand, Kapranov, Zelevinsky - Discriminants, resultants, and multidimensional determinants, 1994]

sign = (permutation) -> sub(product(subsets(0..#permutation-1,2),I->(permutation_(I_1)-permutation_(I_0))/(I_1-I_0)),ZZ); -- thanks to Nivaldo Medeiros
sgn = (permutation) -> sub(product(subsets(0..#permutation-1,2),I->(permutation_(I_1)-permutation_(I_0))/(I_1-I_0)),ZZ); -- thanks to Nivaldo Medeiros
tosequence = (L) -> if #L != 1 then toSequence L else L_0;

duality(PolynomialRing) := (R) -> ( -- returns the map R:=G(k,P^n) ---> G(n-k-1,P^n*)
(k,n,KK,p) := detectGrassmannian R;
G := ambient Grass(k,n,KK,Variable=>p);
G' := ambient Grass(n-k-1,n,KK,Variable=>p);
L := for U in subsets(set(0..n),n-k) list sign( (sort toList(set(0..n)-U)) | sort toList U) * (p_(tosequence sort toList(set(0..n)-U)))_G;
L := for U in subsets(set(0..n),n-k) list sgn( (sort toList(set(0..n)-U)) | sort toList U) * (p_(tosequence sort toList(set(0..n)-U)))_G;
return(map(R,G,vars R) * map(G,G',L));
);

Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/SchurComplexes.m2
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ homologicalDegree(HashTable,List,List) := (T,evengen,oddgen) -> sum for b in key
------Straightening algorithm

--Inputs: U= List, V= permutation represented as a list. Outputs: sign of the induced permutation on the unmarked elements of U.
sign = (U,V)-> (
sgn = (U,V)-> (
n:=#U;
answer:=1;
for i from 0 to n-2 do (
Expand Down Expand Up @@ -288,7 +288,7 @@ shuffle = (T, vio, downCol2, lambdaprime) -> (
indicesofL:=toList (0..(#L-1));
subsetsofLofsizetruncatedcol1:=subsets(indicesofL,#truncatedcol1);
pairs1:=apply(subsetsofLofsizetruncatedcol1, x-> (x, indicesofL-(set x)));
signs:=apply(pairs1, x-> sign(L,join(x)));
signs:=apply(pairs1, x-> sgn(L,join(x)));
outputlist:={};
dividedContributions := for i from 0 to (#pairs1-1) list (
dividedContribution := 1; --contribution from divided power multiplication
Expand Down
14 changes: 7 additions & 7 deletions M2/Macaulay2/packages/SpechtModule.m2
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,8 @@ garnirElement(YoungTableau,ZZ,ZZ,ZZ):= (tableau,coef,a,b)-> (
for j from a+1 to conju#b do (
newTableau_(j-1,b) = AB#(comb#j);
);
sign:=sortColumnsTableau(newTableau);
spechtModuleElement (newTableau, (coef) *sign*permutationSign(conjugacyClass(comb)))
sgn:=sortColumnsTableau(newTableau);
spechtModuleElement (newTableau, (coef) *sgn*permutationSign(conjugacyClass(comb)))
));

);
Expand Down Expand Up @@ -941,9 +941,9 @@ sortColumnsTableau SpechtModuleElement := element ->
y := youngTableau(element#partition,t);
coef := element#values#t;
remove(element#values,t);
sign:= sortColumnsTableau(y);
if(element#values#?(entries y)) then element#values#(entries y) = element#values#(entries y)+sign*coef
else element#values#(entries y) = coef*sign;
sgn:= sortColumnsTableau(y);
if(element#values#?(entries y)) then element#values#(entries y) = element#values#(entries y)+sgn*coef
else element#values#(entries y) = coef*sgn;
)
);
)
Expand Down Expand Up @@ -1193,14 +1193,14 @@ higherSpechtPolynomial(YoungTableau, YoungTableau, PolynomialRing) := o-> (S,T,R
rowPermutations := rowPermutationTableaux indexTableau S;
ans = spechtPolynomial(T,R,AsExpression =>o.AsExpression)*sum(rowPermutations, tab -> product apply (numcols S, i->
(
(sortedList,sign) := sortList(tab_i);
(sortedList,sgn) := sortList(tab_i);
sortedList = sortedList - toList (0..(#(tab_i)-1));
sortedList = reverse sortedList;
firstZero := position(sortedList,i->i==0);
lastNonZero:= 0;
if (firstZero === null) then lastNonZero = #sortedList-1 else lastNonZero = firstZero -1;
partition:= new Partition from sortedList_{0..lastNonZero};
sign*schurPolynomial(T_i,partition,R,AsExpression => o.AsExpression)
sgn*schurPolynomial(T_i,partition,R,AsExpression => o.AsExpression)
)))
);
ans
Expand Down

0 comments on commit 2fe9d89

Please sign in to comment.