Skip to content

Commit

Permalink
fixed schubAdd bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmousa committed Nov 8, 2023
1 parent 99ec6b4 commit 5f08303
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 13 deletions.
11 changes: 11 additions & 0 deletions MatrixSchubert.m2
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ end---------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------

A = {3,2,4,1}
B = {2,3,1}
I = schubDetIdeal A
J = schubDetIdeal B
schubAdd {A,B}


A = matrix{{0,0,0},{0,1,0},{1,-1,0}}
B = matrix{{0,1,0,0,0},{0,0,0,1,0},{1,-1,1,0,0},{0,0,0,0,1},{0,1,0,0,0}}
J = schubAdd {A,B}

------------------------------------
--Development Section
------------------------------------
Expand Down
46 changes: 33 additions & 13 deletions MatrixSchubert/MatrixSchubertConstructions.m2
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ indexOfVariable RingElement := ZZ => (elem) -> (
)


--------------------------------
--pads an ASM with a block identity matrix to view the ASM in a larger polynomial ring
--useful for adding and intersecting ASM ideals of differing sizes
--INPUT: an ASM, number of rows/columns to add
--OUTPUT: a new ASM from the old one with the same fulton generators, but forming a larger matrix
--TODO: add docs and tests
-----------------------------------
padASM = method()
padASM(Matrix, ZZ) := Matrix => (A,n) -> (
if not(isASM A) then error("The input must be an alternating sign matrix.");
m := numcols A;
zeroMatrixRight := map(ZZ^m, ZZ^n,0);
zeroMatrixUnder := map(ZZ^n, ZZ^m,0);
B := id_(ZZ^n);
matrix{{A,zeroMatrixRight},{zeroMatrixUnder,B}}
);


--------------------------------------------
--------------------------------------------
--**Constructing ASM Varieties**--
Expand Down Expand Up @@ -476,9 +494,9 @@ entrywiseMinRankTable List := Matrix => L -> (
-- comb through the list to get the minimal entries
for M in L do (
T := rankTable M;
-- if (numrows M != n) then error ("The input must be a list of partial alternating sign matrices of the same size.");
-- if (numcols M != m) then error ("The input must be a list of partial alternating sign matrices of the same size.");
if not(isPartialASM(M)) then error("The input must be a list containing partial alternating sign matrices.");
if (numrows M != n) then error ("The input must be a list of alternating sign matrices of the same size.");
if (numcols M != m) then error ("The input must be a list of alternating sign matrices of the same size.");
if not(isPartialASM(M)) then error("The input must be a list containing partial alternating sign matrices.");

for i from 0 to n-1 do (
for j from 0 to m-1 do (
Expand All @@ -504,8 +522,8 @@ entrywiseMaxRankTable List := Matrix => L -> (
-- comb through the list to get the maximal entries
for M in L do (
T := rankTable M;
-- if (numrows M != n) then error ("The input must be a list of partial alternating sign matrices of the same size.");
-- if (numcols M != m) then error ("The input must be a list of partial alternating sign matrices of the same size.");
if (numrows M != n) then error ("The input must be a list of alternating sign matrices of the same size.");
if (numcols M != m) then error ("The input must be a list of alternating sign matrices of the same size.");
if not(isPartialASM(M)) then error("The input must be a list containing partial alternating sign matrices.");

for i from 0 to (numrows M)-1 do (
Expand Down Expand Up @@ -610,25 +628,25 @@ isIntersectionSchubIdeals Ideal := Boolean => I -> (
-------------------------------------------
isASMIdeal = method()
isASMIdeal Ideal := Boolean => (I) -> (
isASM := true;
ASMcheck := true;
schubDecomp := schubDecompose I;
primeComps := schubDecomp / schubDetIdeal;
Q := ring primeComps_0;
intersectCheck := intersect(apply(primeComps, J-> sub(J,Q)));
if (isASM = (intersectCheck == sub(I,Q))) then {
if (ASMcheck = (intersectCheck == sub(I,Q))) then {
permMatrices := (schubDecomp / permToMatrix);
rkTable := entrywiseMaxRankTable permMatrices;
A := rankTableToASM matrix rkTable;
ASMIdeal := schubDetIdeal matrix A;
-- varHash := hashTable(apply((ring ASMIdeal)_*, i-> (last baseName i)=> i));
-- phi := map(ring ASMIdeal, ring I, apply((ring I)_*, i-> varHash#(last baseName i)));
isASM = (ASMIdeal == sub(I, ring ASMIdeal));
if isASM then I.cache.ASM = A;
ASMcheck = (ASMIdeal == sub(I, ring ASMIdeal));
if ASMcheck then I.cache.ASM = A;
}
else {
isASM = false;
ASMcheck = false;
};
isASM
ASMcheck
)


Expand Down Expand Up @@ -800,8 +818,10 @@ schubIntersect List := Ideal => (L) -> (
schubAdd = method()
schubAdd List := Ideal => (L) -> (
if (#L == 0) then error("Please enter a nonempty list.");
listPermM := L / (i -> if instance(i, Matrix) then i else if instance(i_0, List) then matrix i else (permToMatrix i));
rankM := entrywiseMinRankTable(listPermM);
listASMs := L / (i -> if instance(i, Matrix) then (partialASMToASM i) else if instance(i_0, List) then matrix i else (permToMatrix i));
n := max(apply(listASMs, i-> numrows i));
paddedASMs := apply(listASMs, A -> padASM(A, n - (numrows A)));
rankM := entrywiseMinRankTable(paddedASMs);
sumI := schubDetIdeal rankTableToASM(rankM);
sumI.cache.rankTable = rankM;
sumI
Expand Down
25 changes: 25 additions & 0 deletions MatrixSchubert/MatrixSchubertTests.m2
Original file line number Diff line number Diff line change
Expand Up @@ -982,3 +982,28 @@ assert(isSchubCM(matrix{{0, 0, 1, 0}, {1, 0, -1, 1}, {0, 1, 0, 0}, {0, 0, 1, 0}}
TEST ///
assert(#ASMFullList(1) == 1);
///

TEST ///
--for schubAdd
A = {3,2,4,1};
B = {2,3,1};
I = schubDetIdeal A;
J = schubDetIdeal B;
K = schubAdd {A,B};
assert(K == sub(I + sub(J, ring I), ring K))

---

A = matrix{{0,0,0},{0,1,0},{1,-1,0}}
B = matrix{{0,1,0,0,0},{0,0,0,1,0},{1,-1,1,0,0},{0,0,0,0,1},{0,1,0,0,0}}
C = {3,1,4,2}
L = schubAdd {A,B,C}

I = schubDetIdeal A;
J = schubDetIdeal B;
K = schubDetIdeal C;
I' = sub(I, ring J)
K' = sub(K, ring J)
assert(L == sub(I'+J+K', ring L))

///

0 comments on commit 5f08303

Please sign in to comment.