[top][index]
search for:

genericMatrix -- make a generic matrix of variables

genericMatrix(R,x,m,n) -- produce an m by n matrix of variables drawn from the ring R, starting with variable x.

i1 : R = ZZ/101[a..d]

o1 = R

o1 : PolynomialRing
i2 : genericMatrix(R,a,2,2)

o2 = | a c |
     | b d |

             2       2
o2 : Matrix R  <--- R

Code:

     -- ../../../Macaulay2/m2/genmat.m2:9-15
     genericMatrix = (R,first,nrows,ncols) -> (
          first = getIndex(R,first);
          if not instance(nrows,ZZ) or not instance(ncols,ZZ) or nrows < 0 or ncols < 0
          then error "expected nonnegative integers";
          if first + nrows * ncols > numgens R
          then error "not enough variables in this ring";
          matrix table(nrows, ncols, (i,j)->R_(first + i + nrows*j)))

[top][index]
search for: