Skip to content

Commit

Permalink
Update helpers.m2
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmousa authored Oct 17, 2023
1 parent b1a04f8 commit bea97cd
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions MatrixSchubert/Code/helpers.m2
Original file line number Diff line number Diff line change
@@ -1,50 +1 @@

-- Utility routines --

--------------------------------
--auxiliary function for generating a generic matrix of z variables
--INPUT: integers n,m
--OUTPUT: an n by m generic matrix with entries z_(i,j)
--NOTE: the ring automatically comes equipped with the antidiagonal term order
--TODO: allow user to input the field they want as an option
-----------------------------------

genMat = method(
Options => {
CoefficientRing => QQ,
Variable => getSymbol "z"
}
)
genMat (ZZ,ZZ) := o -> (n,m) -> (
k := o.CoefficientRing;
zEntries := flatten table (n,m,(i,j) -> (i,j));
z := o.Variable;
degs := apply(zEntries,i-> i_1-i_0 + m); --are there better ways to make the antidiagonal weights? prob
Q := k(monoid[z_(1,1)..z_(n,m)]);
Mmut := mutableMatrix(Q,n,m);
for box in zEntries do (
Mmut_(box) = Q_(m*(box_0) + box_1);
);
matrix Mmut
)


--------------------------------
--auxiliary function for getting the index of a variable in a ring
--INPUT: an indexed variable
--OUTPUT: the index of the variable
--TODO: add docs
--SUGGESTION: (from Anton) `indexOfVariable = v -> ( i:= index v; last toList R.generatorSymbols#i )` -- need `debug Core` to use `R.generatorSymbols`
--SUGGESTION: (from Ayah) `(expression(x_1))#1`
--SUGGESTION: (from Mahrud) `last baseName x_(1,2)`
-----------------------------------
indexOfVariable = method()
indexOfVariable RingElement := Sequence => (elem) -> (
last baseName elem
)
indexOfVariable RingElement := List => (elem) -> (
last baseName elem
)
indexOfVariable RingElement := ZZ => (elem) -> (
last baseName elem
)

0 comments on commit bea97cd

Please sign in to comment.