-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'GLInvariants' of https://github.com/Macaulay2/Workshop-…
…2024-Utah into GLInvariants
- Loading branch information
Showing
2 changed files
with
148 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,122 +1,134 @@ | ||
newPackage( | ||
"GLIdeals", | ||
Version => "0.1", | ||
Date => "June 1, 2024", | ||
Authors => { | ||
{Name => "Hunter Simper", Email => "[email protected]", HomePage => "https://www.huntersimper.com"}, | ||
{} | ||
}, | ||
Headline => "Template for gl ideals package", | ||
PackageExports => {"SchurRings","SimpleDoc"}, | ||
DebuggingMode => false, | ||
Reload=>true | ||
) | ||
|
||
export{"generateIlambda"} | ||
|
||
numgensILambda = method() -- TODO: Make it accept Partitions as well | ||
numgensILambda(Matrix, List) := (X, lam) -> ( | ||
myHookLength := P -> ( | ||
-- compute prod (P_i - P_j + j - i) / (j - i) for all i < j | ||
num := 1; | ||
den := 1; | ||
for i in 0..#P-1 do( | ||
for j in i+1..#P-1 do( | ||
num = num * (P#i - P#j + j - i); | ||
den = den * (j - i); | ||
); | ||
); | ||
return num / den; | ||
); | ||
|
||
size := #lam; | ||
|
||
r := numRows X; | ||
c := numColumns X; | ||
minSize := min(r, c); | ||
maxSize := max(r, c); | ||
|
||
if minSize < size then( | ||
error "Partition is too large for the matrix"; | ||
); | ||
|
||
P := lam | apply(minSize - size, i -> 0); -- make it size minSize | ||
dimension := myHookLength(P); | ||
P = P | apply(maxSize - minSize, i -> 0); -- make it size maxSize | ||
return sub(dimension * myHookLength(P),ZZ); | ||
); | ||
|
||
|
||
idealILambda = method() | ||
idealILambda(Matrix,List) := (X,lam) -> ( | ||
n:=rank target X; | ||
m:=rank source X; | ||
kk:=baseRing ring X; | ||
if char kk !=0 then( | ||
error "Base ring is not characteristic 0"; | ||
); | ||
conjlam := toList conjugate( new Partition from lam); | ||
d:=numgensILambda(X,lam); | ||
lis := for i from 0 to d-1 list | ||
( | ||
A := random(kk^m,kk^m); | ||
B := random(kk^n,kk^n); | ||
N := A * X * B; | ||
product for j from 0 to #conjlam-1 list det(N_{0..conjlam_j-1}^{0..conjlam_j-1})); | ||
J := ideal lis; | ||
minJ:=mingens J; | ||
|
||
while rank source minJ != d do( | ||
A := random(kk^m,kk^m); | ||
B := random(kk^n,kk^n); | ||
N := A * X * B; | ||
lis = append(lis, product for j from 0 to #conjlam-1 list det(N_{0..conjlam_j-1}^{0..conjlam_j-1})); | ||
J = ideal lis; | ||
minJ = mingens J; | ||
); | ||
return ideal mingens J; | ||
); | ||
|
||
|
||
|
||
partitionsLeq = method(); | ||
partitionsLeq(Partition, Partition) := (A, B) -> ( | ||
-- A and B are partitions | ||
-- assuming weakly decreasing | ||
-- return if A <= B | ||
n := #B; | ||
for i in 0..#A-1 do( | ||
if A#i == 0 then break; | ||
if i > n then return false; | ||
if A#i > B#i then return false; | ||
); | ||
return true; | ||
) | ||
|
||
Partition ? Partition := (A, B) -> ( | ||
AleB := partitionsLeq(A, B); | ||
BleA := partitionsLeq(B, A); | ||
if AleB and BleA then return symbol ==; | ||
if AleB then return symbol <; | ||
if BleA then return symbol >; | ||
return symbol incomparable; | ||
) | ||
|
||
Partition == Partition := (A, B) -> ( | ||
return (A ? B) == (symbol ==); | ||
) | ||
----- | ||
|
||
beginDocumentation() | ||
|
||
|
||
doc /// | ||
|
||
/// | ||
|
||
|
||
end | ||
|
||
|
||
|
||
|
||
newPackage( | ||
"GLIdeals", | ||
Version => "0.1", | ||
Date => "June 1, 2024", | ||
Authors => { | ||
{Name => "Hunter Simper", Email => "[email protected]", HomePage => "https://www.huntersimper.com"}, | ||
{} | ||
}, | ||
Headline => "Template for gl ideals package", | ||
PackageExports => {"SchurRings","SimpleDoc"}, | ||
DebuggingMode => false, | ||
Reload=>true | ||
) | ||
|
||
export{"idealILambda"} | ||
|
||
numgensILambda = method() -- TODO: Make it accept Partitions as well | ||
numgensILambda(Matrix, List) := (X, lam) -> ( | ||
myHookLength := P -> ( | ||
-- compute prod (P_i - P_j + j - i) / (j - i) for all i < j | ||
num := 1; | ||
den := 1; | ||
for i in 0..#P-1 do( | ||
for j in i+1..#P-1 do( | ||
num = num * (P#i - P#j + j - i); | ||
den = den * (j - i); | ||
); | ||
); | ||
return num / den; | ||
); | ||
|
||
size := #lam; | ||
|
||
r := numRows X; | ||
c := numColumns X; | ||
minSize := min(r, c); | ||
maxSize := max(r, c); | ||
|
||
if minSize < size then( | ||
error "Partition is too large for the matrix"; | ||
); | ||
|
||
P := lam | apply(minSize - size, i -> 0); -- make it size minSize | ||
dimension := myHookLength(P); | ||
P = P | apply(maxSize - minSize, i -> 0); -- make it size maxSize | ||
return sub(dimension * myHookLength(P),ZZ); | ||
); | ||
|
||
|
||
detLam = method() | ||
detLam = (X,lam) -> ( | ||
(m,n) := (numColumns(X), numRows(X)); | ||
base := ring X; | ||
C := 1; | ||
for i in lam do( | ||
C = C*determinant(submatrix(X,{0..i},{0..i})); | ||
); | ||
return C | ||
) | ||
|
||
|
||
|
||
idealILambda = method() | ||
idealILambda(Matrix,List) := (X,lam) -> ( | ||
n:=rank target X; | ||
m:=rank source X; | ||
kk:=baseRing ring X; | ||
if char kk !=0 then( | ||
error "Base ring is not characteristic 0"; | ||
); | ||
conjlam := toList conjugate( new Partition from lam); | ||
d:=numgensILambda(X,lam); | ||
lis := for i from 0 to d-1 list | ||
( | ||
A := random(kk^m,kk^m); | ||
B := random(kk^n,kk^n); | ||
N := A * X * B; | ||
product for j from 0 to #conjlam-1 list det(N_{0..conjlam_j-1}^{0..conjlam_j-1})); | ||
J := ideal lis; | ||
minJ:=mingens J; | ||
|
||
while rank source minJ != d do( | ||
A := random(kk^m,kk^m); | ||
B := random(kk^n,kk^n); | ||
N := A * X * B; | ||
lis = append(lis, product for j from 0 to #conjlam-1 list det(N_{0..conjlam_j-1}^{0..conjlam_j-1})); | ||
J = ideal lis; | ||
minJ = mingens J; | ||
); | ||
return ideal minJ; | ||
); | ||
|
||
|
||
|
||
partitionsLeq = method(); | ||
partitionsLeq(Partition, Partition) := (A, B) -> ( | ||
-- A and B are partitions | ||
-- assuming weakly decreasing | ||
-- return if A <= B | ||
n := #B; | ||
for i in 0..#A-1 do( | ||
if A#i == 0 then break; | ||
if i > n then return false; | ||
if A#i > B#i then return false; | ||
); | ||
return true; | ||
) | ||
|
||
Partition ? Partition := (A, B) -> ( | ||
AleB := partitionsLeq(A, B); | ||
BleA := partitionsLeq(B, A); | ||
if AleB and BleA then return symbol ==; | ||
if AleB then return symbol <; | ||
if BleA then return symbol >; | ||
return symbol incomparable; | ||
) | ||
|
||
Partition == Partition := (A, B) -> ( | ||
return (A ? B) == (symbol ==); | ||
) | ||
----- | ||
|
||
beginDocumentation() | ||
|
||
|
||
doc /// | ||
|
||
/// | ||
|
||
|
||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
randomLam = method(); | ||
randomLam(ZZ, ZZ) := (n,k) -> ( | ||
L=new MutableList from {}; | ||
sumsofar = 0; | ||
for i from 0 to (n-2) do( | ||
x = random(0, k-sumsofar); | ||
L#i=x; | ||
sumsofar = sumsofar + x; | ||
); | ||
L#(n-1) = k - sumsofar; | ||
L=toList L; | ||
L=rsort L; | ||
return delete(0,L) | ||
) |