<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>mutable matrices</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_mutable__Identity_lp__Ring_cm__Z__Z_rp.html">next</a> | <a href="_multidegree.html">previous</a> | <a href="_mutable__Identity_lp__Ring_cm__Z__Z_rp.html">forward</a> | <a href="_multidegree.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <hr/> <div><h1>mutable matrices</h1> <div>To and from matrices:<table class="examples"><tr><td><pre>i1 : m = matrix{{1,2,3},{4,5,6}} o1 = | 1 2 3 | | 4 5 6 | 2 3 o1 : Matrix ZZ <--- ZZ</pre> </td></tr> <tr><td><pre>i2 : n = mutableMatrix m o2 = | 1 2 3 | | 4 5 6 | o2 : MutableMatrix</pre> </td></tr> <tr><td><pre>i3 : m2 = matrix n o3 = | 1 2 3 | | 4 5 6 | 2 3 o3 : Matrix ZZ <--- ZZ</pre> </td></tr> <tr><td><pre>i4 : m2 - m == 0 o4 = true</pre> </td></tr> </table> Modifying and accessing entries. Remember that the upper left entry is (0,0), not (1,1)!<table class="examples"><tr><td><pre>i5 : n_(0,0) = 212314323 o5 = 212314323</pre> </td></tr> <tr><td><pre>i6 : n_(0,0) o6 = 212314323</pre> </td></tr> <tr><td><pre>i7 : n o7 = | 212314323 2 3 | | 4 5 6 | o7 : MutableMatrix</pre> </td></tr> </table> Number of rows, columns, and the ring:<table class="examples"><tr><td><pre>i8 : numrows n o8 = 2</pre> </td></tr> <tr><td><pre>i9 : numColumns n o9 = 3</pre> </td></tr> <tr><td><pre>i10 : numcols n o10 = 3</pre> </td></tr> <tr><td><pre>i11 : ring n o11 = ZZ o11 : Ring</pre> </td></tr> </table> <p/> <a href="_row_spand_spcolumn_spoperations.html" title="">row and column operations</a><p/> Some other methods for creating mutable matrices.<table class="examples"><tr><td><pre>i12 : mutableIdentity(RR_100,5) o12 = | 1 . . . . | | . 1 . . . | | . . 1 . . | | . . . 1 . | | . . . . 1 | o12 : MutableMatrix</pre> </td></tr> <tr><td><pre>i13 : mutableMatrix(QQ,3,5) o13 = 0 o13 : MutableMatrix</pre> </td></tr> <tr><td><pre>i14 : randomMutableMatrix(4,4,.5,100) o14 = | . . 68 29 | | -81 . . . | | . . 90 -68 | | -63 . 95 . | o14 : MutableMatrix</pre> </td></tr> </table> </div> </div> </body> </html>