Macaulay2 » Documentation
Packages » Macaulay2Doc » map » map(Module,ZZ,List)
next | previous | forward | backward | up | index | toc

# map(Module,ZZ,List) -- create a matrix by giving a sparse or dense list of entries

- Function: map
- Usage:
    `map(M,n,v)`
- Inputs:
  - M, a module
  - n, an integer
  - v, a list
- Optional inputs:
  - Degree => ..., default value null, specify the degree of a map
  - DegreeLift => ..., default value null, make a ring map
  - DegreeMap => ..., default value null, make a ring map
- Outputs:
  - a matrix, A matrix M <-- R^n whose entries are obtained from v, where R is the ring of M, and the source of the result is a graded free module chosen in an attempt to make the result homogeneous of degree zero

## Description

The list v is either a doubly nested list of ring elements, or a list of elements (i,j) => f. The first version provides all of the elements of the output matrix, row by row. The second form provides only the non-zero elements of the output matrix h: h_(i,j) = f, for every (i,j) => f in the list v.

The ring elements appearing in v should be in R, or in a base ring of R.

In the first form, each list in v gives a row of the matrix. The length of the list v should be the number of generators of M, and the length of each element of v (which is itself a list of ring elements) should be the number of generators of the source module N.

    i1 : R = ZZ/101[x,y,z];

    i2 : p = map(R^2,3,{{x^2,0,3},{0,y^2,5}})

    o2 = | x2 0  3 |
         | 0  y2 5 |

                 2      3
    o2 : Matrix R  <-- R

    i3 : isHomogeneous p

    o3 = true

In the second form, if an index (i,j) occurs more than once, only the last is taken.

    i4 : p = map(R^2,3,{(0,0) => x+y, (1,1) => x^2, (0,2) => x-1, (0,0) => x-y})

    o4 = | x-y 0  x-1 |
         | 0   x2 0   |

                 2      3
    o4 : Matrix R  <-- R

## See also

- matrix -- make a matrix
- map(Module,Nothing,List) -- create a matrix by giving a doubly nested list of ring elements

## Ways to use this method:

- map(Module,ZZ,List) -- create a matrix by giving a sparse or dense list of entries

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/map-doc.m2:328:0.