Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » matrix » matrix(MutableMatrix)
next | previous | forward | backward | up | index | toc

# matrix(MutableMatrix) -- make a matrix from a mutable one

- Function: matrix
- Usage:
    `matrix m`
- Inputs:
  - m, a mutable matrix
- Optional inputs:
  - Degree => ..., default value null, create a matrix from a doubly-nested list of ring elements or matrices
- Outputs:
  - a matrix, the same matrix as m, but not mutable.

## Description

There are many more operations available for matrices than for immutable matrices, but mutable matrices are sometimes easier to construct.

    i1 : m = mutableMatrix(ZZ,3,5)

    o1 = 0

    o1 : MutableMatrix

    i2 : m_(1,2) = 3

    o2 = 3

    i3 : m_(2,4) = 54

    o3 = 54

    i4 : m_(0,0) = -12

    o4 = -12

    i5 : m

    o5 = | -12 0 0 0 0  |
         | 0   0 3 0 0  |
         | 0   0 0 0 54 |

    o5 : MutableMatrix

    i6 : matrix m

    o6 = | -12 0 0 0 0  |
         | 0   0 3 0 0  |
         | 0   0 0 0 54 |

                  3       5
    o6 : Matrix ZZ  <-- ZZ

## See also

- mutableMatrix -- make a mutable matrix
- mutableIdentity -- make a mutable identity matrix
- MutableMatrix -- the class of all mutable matrices

## Ways to use this method:

- matrix(MutableMatrix) -- make a matrix from a mutable one

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