1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Matrix Manipulation</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Genius Manual"><link rel="up" href="ch11.html" title="Chapter 11. List of GEL functions"><link rel="prev" href="ch11s07.html" title="Number Theory"><link rel="next" href="ch11s09.html" title="Linear Algebra"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Matrix Manipulation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11s07.html">Prev</a> </td><th width="60%" align="center">Chapter 11. List of GEL functions</th><td width="20%" align="right"> <a accesskey="n" href="ch11s09.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-function-list-matrix"></a>Matrix Manipulation</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a name="gel-function-AppendElement"></a>AppendElement</span></dt><dd><pre class="synopsis">AppendElement (v,elt)</pre><p>Append an element to a vector and return the vector. No expansion is done. Normally
a row vector is built if starting from <code class="constant">null</code> or a 1-by-1 matrix,
but if given a column vector it will properly build a column vector.</p></dd><dt><span class="term"><a name="gel-function-ApplyOverMatrix"></a>ApplyOverMatrix</span></dt><dd><pre class="synopsis">ApplyOverMatrix (a,func)</pre><p>Apply a function over all entries of a matrix and return a matrix of the results.</p></dd><dt><span class="term"><a name="gel-function-ApplyOverMatrix2"></a>ApplyOverMatrix2</span></dt><dd><pre class="synopsis">ApplyOverMatrix2 (a,b,func)</pre><p>Apply a function over all entries of 2 matrices (or 1 value and 1 matrix) and return a matrix of the results.</p></dd><dt><span class="term"><a name="gel-function-ColumnsOf"></a>ColumnsOf</span></dt><dd><pre class="synopsis">ColumnsOf (M)</pre><p>Gets the columns of a matrix as a horizontal vector.</p></dd><dt><span class="term"><a name="gel-function-ComplementSubmatrix"></a>ComplementSubmatrix</span></dt><dd><pre class="synopsis">ComplementSubmatrix (m,r,c)</pre><p>Remove column(s) and row(s) from a matrix.</p></dd><dt><span class="term"><a name="gel-function-CompoundMatrix"></a>CompoundMatrix</span></dt><dd><pre class="synopsis">CompoundMatrix (k,A)</pre><p>Calculate the kth compound matrix of A.</p></dd><dt><span class="term"><a name="gel-function-CountZeroColumns"></a>CountZeroColumns</span></dt><dd><pre class="synopsis">CountZeroColumns (M)</pre><p>
Count the number of zero columns in a matrix. For example,
once you column-reduce a matrix, you can use this to find
the nullity. See <a class="link" href="ch11s09.html#gel-function-cref"><code class="function">cref</code></a>
and <a class="link" href="ch11s09.html#gel-function-Nullity"><code class="function">Nullity</code></a>.
</p></dd><dt><span class="term"><a name="gel-function-DeleteColumn"></a>DeleteColumn</span></dt><dd><pre class="synopsis">DeleteColumn (M,col)</pre><p>Delete a column of a matrix.</p></dd><dt><span class="term"><a name="gel-function-DeleteRow"></a>DeleteRow</span></dt><dd><pre class="synopsis">DeleteRow (M,row)</pre><p>Delete a row of a matrix.</p></dd><dt><span class="term"><a name="gel-function-DiagonalOf"></a>DiagonalOf</span></dt><dd><pre class="synopsis">DiagonalOf (M)</pre><p>Gets the diagonal entries of a matrix as a column vector.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Diagonal_of_a_matrix#Matrices" target="_top">Wikipedia</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-DotProduct"></a>DotProduct</span></dt><dd><pre class="synopsis">DotProduct (u,v)</pre><p>Get the dot product of two vectors. The vectors must be of the
same size. No conjugates are taken so this is a bilinear form even if working over the complex numbers; This is the bilinear scalar product not the sesquilinear scalar product. See <a class="link" href="ch11s08.html#gel-function-HermitianProduct">HermitianProduct</a> for the standard sesquilinear inner product.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Dot_product" target="_top">Wikipedia</a> or
<a class="ulink" href="http://planetmath.org/DotProduct" target="_top">Planetmath</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-ExpandMatrix"></a>ExpandMatrix</span></dt><dd><pre class="synopsis">ExpandMatrix (M)</pre><p>
Expands a matrix just like we do on unquoted matrix input.
That is we expand any internal matrices as blocks. This is
a way to construct matrices out of smaller ones and this is
normally done automatically on input unless the matrix is quoted.
</p></dd><dt><span class="term"><a name="gel-function-HermitianProduct"></a>HermitianProduct</span></dt><dd><pre class="synopsis">HermitianProduct (u,v)</pre><p>Aliases: <code class="function">InnerProduct</code></p><p>Get the Hermitian product of two vectors. The vectors must be of the same size. This is a sesquilinear form using the identity matrix.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Sesquilinear_form" target="_top">Wikipedia</a> or
<a class="ulink" href="http://mathworld.wolfram.com/HermitianInnerProduct.html" target="_top">Mathworld</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-I"></a>I</span></dt><dd><pre class="synopsis">I (n)</pre><p>Aliases: <code class="function">eye</code></p><p>Return an identity matrix of a given size, that is <code class="varname">n</code> by <code class="varname">n</code>. If <code class="varname">n</code> is zero, returns <code class="constant">null</code>.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Identity_matrix" target="_top">Wikipedia</a> or
<a class="ulink" href="http://planetmath.org/IdentityMatrix" target="_top">Planetmath</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-IndexComplement"></a>IndexComplement</span></dt><dd><pre class="synopsis">IndexComplement (vec,msize)</pre><p>Return the index complement of a vector of indexes. Everything is one based. For example for vector <strong class="userinput"><code>[2,3]</code></strong> and size
<strong class="userinput"><code>5</code></strong>, we return <strong class="userinput"><code>[1,4,5]</code></strong>. If
<code class="varname">msize</code> is 0, we always return <code class="constant">null</code>.</p></dd><dt><span class="term"><a name="gel-function-IsDiagonal"></a>IsDiagonal</span></dt><dd><pre class="synopsis">IsDiagonal (M)</pre><p>Is a matrix diagonal.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Diagonal_matrix" target="_top">Wikipedia</a> or
<a class="ulink" href="http://planetmath.org/DiagonalMatrix" target="_top">Planetmath</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-IsIdentity"></a>IsIdentity</span></dt><dd><pre class="synopsis">IsIdentity (x)</pre><p>Check if a matrix is the identity matrix. Automatically returns <code class="constant">false</code>
if the matrix is not square. Also works on numbers, in which
case it is equivalent to <strong class="userinput"><code>x==1</code></strong>. When <code class="varname">x</code> is
<code class="constant">null</code> (we could think of that as a 0 by 0 matrix),
no error is generated and <code class="constant">false</code> is returned.</p></dd><dt><span class="term"><a name="gel-function-IsLowerTriangular"></a>IsLowerTriangular</span></dt><dd><pre class="synopsis">IsLowerTriangular (M)</pre><p>Is a matrix lower triangular. That is, are all the entries above the diagonal zero.</p></dd><dt><span class="term"><a name="gel-function-IsMatrixInteger"></a>IsMatrixInteger</span></dt><dd><pre class="synopsis">IsMatrixInteger (M)</pre><p>Check if a matrix is a matrix of integers (non-complex).</p></dd><dt><span class="term"><a name="gel-function-IsMatrixNonnegative"></a>IsMatrixNonnegative</span></dt><dd><pre class="synopsis">IsMatrixNonnegative (M)</pre><p>Check if a matrix is non-negative, that is if each element is non-negative.
Do not confuse positive matrices with positive semi-definite matrices.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Positive_matrix" target="_top">Wikipedia</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-IsMatrixPositive"></a>IsMatrixPositive</span></dt><dd><pre class="synopsis">IsMatrixPositive (M)</pre><p>Check if a matrix is positive, that is if each element is
positive (and hence real). In particular, no element is 0. Do not confuse
positive matrices with positive definite matrices.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Positive_matrix" target="_top">Wikipedia</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-IsMatrixRational"></a>IsMatrixRational</span></dt><dd><pre class="synopsis">IsMatrixRational (M)</pre><p>Check if a matrix is a matrix of rational (non-complex)
numbers.</p></dd><dt><span class="term"><a name="gel-function-IsMatrixReal"></a>IsMatrixReal</span></dt><dd><pre class="synopsis">IsMatrixReal (M)</pre><p>Check if a matrix is a matrix of real (non-complex) numbers.</p></dd><dt><span class="term"><a name="gel-function-IsMatrixSquare"></a>IsMatrixSquare</span></dt><dd><pre class="synopsis">IsMatrixSquare (M)</pre><p>
Check if a matrix is square, that is its width is equal to
its height.
</p></dd><dt><span class="term"><a name="gel-function-IsUpperTriangular"></a>IsUpperTriangular</span></dt><dd><pre class="synopsis">IsUpperTriangular (M)</pre><p>Is a matrix upper triangular? That is, a matrix is upper triangular if all the entries below the diagonal are zero.</p></dd><dt><span class="term"><a name="gel-function-IsValueOnly"></a>IsValueOnly</span></dt><dd><pre class="synopsis">IsValueOnly (M)</pre><p>Check if a matrix is a matrix of numbers only. Many internal
functions make this check. Values can be any number including complex numbers.</p></dd><dt><span class="term"><a name="gel-function-IsVector"></a>IsVector</span></dt><dd><pre class="synopsis">IsVector (v)</pre><p>
Is argument a horizontal or a vertical vector. Genius does
not distinguish between a matrix and a vector and a vector
is just a 1 by <code class="varname">n</code> or <code class="varname">n</code> by 1 matrix.
</p></dd><dt><span class="term"><a name="gel-function-IsZero"></a>IsZero</span></dt><dd><pre class="synopsis">IsZero (x)</pre><p>Check if a matrix is composed of all zeros. Also works on numbers, in which
case it is equivalent to <strong class="userinput"><code>x==0</code></strong>. When <code class="varname">x</code> is
<code class="constant">null</code> (we could think of that as a 0 by 0 matrix),
no error is generated and <code class="constant">true</code> is returned as the condition is
vacuous.
</p></dd><dt><span class="term"><a name="gel-function-LowerTriangular"></a>LowerTriangular</span></dt><dd><pre class="synopsis">LowerTriangular (M)</pre><p>Returns a copy of the matrix <code class="varname">M</code> with all the entries above the diagonal set to zero.</p></dd><dt><span class="term"><a name="gel-function-MakeDiagonal"></a>MakeDiagonal</span></dt><dd><pre class="synopsis">MakeDiagonal (v,arg...)</pre><p>Aliases: <code class="function">diag</code></p><p>Make diagonal matrix from a vector. Alternatively you can pass
in the values to put on the diagonal as arguments. So
<strong class="userinput"><code>MakeDiagonal([1,2,3])</code></strong> is the same as
<strong class="userinput"><code>MakeDiagonal(1,2,3)</code></strong>.</p><p>
See
<a class="ulink" href="https://en.wikipedia.org/wiki/Diagonal_matrix" target="_top">Wikipedia</a> or
<a class="ulink" href="http://planetmath.org/DiagonalMatrix" target="_top">Planetmath</a> for more information.
</p></dd><dt><span class="term"><a name="gel-function-MakeVector"></a>MakeVector</span></dt><dd><pre class="synopsis">MakeVector (A)</pre><p>Alias: <code class="function">MakeColumnVector</code></p><p>Make column vector out of matrix by putting columns above
each other. Returns <code class="constant">null</code> when given <code class="constant">null</code>.
Can be used to ensure a vector is a column vector.</p></dd><dt><span class="term"><a name="gel-function-MakeRowVector"></a>MakeRowVector</span></dt><dd><pre class="synopsis">MakeRowVector (A)</pre><p>Make row vector out of matrix by putting rows one after another.
Returns <code class="constant">null</code> when given <code class="constant">null</code>.
Can be used to ensure a vector is a row vector.</p></dd><dt><span class="term"><a name="gel-function-MatrixProduct"></a>MatrixProduct</span></dt><dd><pre class="synopsis">MatrixProduct (A)</pre><p>
Calculate the product of all elements in a matrix or vector.
That is we multiply all the elements and return a number that
is the product of all the elements.
</p></dd><dt><span class="term"><a name="gel-function-MatrixSum"></a>MatrixSum</span></dt><dd><pre class="synopsis">MatrixSum (A)</pre><p>
Calculate the sum of all elements in a matrix or vector. That is
we add all the elements and return a number that is the
sum of all the elements.
</p></dd><dt><span class="term"><a name="gel-function-MatrixSumSquares"></a>MatrixSumSquares</span></dt><dd><pre class="synopsis">MatrixSumSquares (A)</pre><p>Calculate the sum of squares of all elements in a matrix
or vector.</p></dd><dt><span class="term"><a name="gel-function-NonzeroColumns"></a>NonzeroColumns</span></dt><dd><pre class="synopsis">NonzeroColumns (M)</pre><p>Returns a row vector of the indices of nonzero columns in the matrix <code class="varname">M</code>.</p><p>Version 1.0.18 onwards.</p></dd><dt><span class="term"><a name="gel-function-NonzeroElements"></a>NonzeroElements</span></dt><dd><pre class="synopsis">NonzeroElements (v)</pre><p>Returns a row vector of the indices of nonzero elements in the vector <code class="varname">v</code>.</p><p>Version 1.0.18 onwards.</p></dd><dt><span class="term"><a name="gel-function-OuterProduct"></a>OuterProduct</span></dt><dd><pre class="synopsis">OuterProduct (u,v)</pre><p>Get the outer product of two vectors. That is, suppose that
<code class="varname">u</code> and <code class="varname">v</code> are vertical vectors, then
the outer product is <strong class="userinput"><code>v * u.'</code></strong>.</p></dd><dt><span class="term"><a name="gel-function-ReverseVector"></a>ReverseVector</span></dt><dd><pre class="synopsis">ReverseVector (v)</pre><p>Reverse elements in a vector. Return <code class="constant">null</code> if given <code class="constant">null</code></p></dd><dt><span class="term"><a name="gel-function-RowSum"></a>RowSum</span></dt><dd><pre class="synopsis">RowSum (m)</pre><p>Calculate sum of each row in a matrix and return a vertical
vector with the result.</p></dd><dt><span class="term"><a name="gel-function-RowSumSquares"></a>RowSumSquares</span></dt><dd><pre class="synopsis">RowSumSquares (m)</pre><p>Calculate sum of squares of each row in a matrix and return a vertical vector with the results.</p></dd><dt><span class="term"><a name="gel-function-RowsOf"></a>RowsOf</span></dt><dd><pre class="synopsis">RowsOf (M)</pre><p>Gets the rows of a matrix as a vertical vector. Each element
of the vector is a horizontal vector that is the corresponding row of
<code class="varname">M</code>. This function is useful if you wish to loop over the
rows of a matrix. For example, as <strong class="userinput"><code>for r in RowsOf(M) do
something(r)</code></strong>.</p></dd><dt><span class="term"><a name="gel-function-SetMatrixSize"></a>SetMatrixSize</span></dt><dd><pre class="synopsis">SetMatrixSize (M,rows,columns)</pre><p>Make new matrix of given size from old one. That is, a new
matrix will be returned to which the old one is copied. Entries that
don't fit are clipped and extra space is filled with zeros.
If <code class="varname">rows</code> or <code class="varname">columns</code> are zero
then <code class="constant">null</code> is returned.
</p></dd><dt><span class="term"><a name="gel-function-ShuffleVector"></a>ShuffleVector</span></dt><dd><pre class="synopsis">ShuffleVector (v)</pre><p>Shuffle elements in a vector. Return <code class="constant">null</code> if given <code class="constant">null</code>.</p><p>Version 1.0.13 onwards.</p></dd><dt><span class="term"><a name="gel-function-SortVector"></a>SortVector</span></dt><dd><pre class="synopsis">SortVector (v)</pre><p>Sort vector elements in an increasing order.</p></dd><dt><span class="term"><a name="gel-function-StripZeroColumns"></a>StripZeroColumns</span></dt><dd><pre class="synopsis">StripZeroColumns (M)</pre><p>Removes any all-zero columns of <code class="varname">M</code>.</p></dd><dt><span class="term"><a name="gel-function-StripZeroRows"></a>StripZeroRows</span></dt><dd><pre class="synopsis">StripZeroRows (M)</pre><p>Removes any all-zero rows of <code class="varname">M</code>.</p></dd><dt><span class="term"><a name="gel-function-Submatrix"></a>Submatrix</span></dt><dd><pre class="synopsis">Submatrix (m,r,c)</pre><p>Return column(s) and row(s) from a matrix. This is
just equivalent to <strong class="userinput"><code>m@(r,c)</code></strong>. <code class="varname">r</code>
and <code class="varname">c</code> should be vectors of rows and columns (or single numbers if only one row or column is needed).</p></dd><dt><span class="term"><a name="gel-function-SwapRows"></a>SwapRows</span></dt><dd><pre class="synopsis">SwapRows (m,row1,row2)</pre><p>Swap two rows in a matrix.</p></dd><dt><span class="term"><a name="gel-function-UpperTriangular"></a>UpperTriangular</span></dt><dd><pre class="synopsis">UpperTriangular (M)</pre><p>Returns a copy of the matrix <code class="varname">M</code> with all the entries below the diagonal set to zero.</p></dd><dt><span class="term"><a name="gel-function-columns"></a>columns</span></dt><dd><pre class="synopsis">columns (M)</pre><p>Get the number of columns of a matrix.</p></dd><dt><span class="term"><a name="gel-function-elements"></a>elements</span></dt><dd><pre class="synopsis">elements (M)</pre><p>Get the total number of elements of a matrix. This is the
number of columns times the number of rows.</p></dd><dt><span class="term"><a name="gel-function-ones"></a>ones</span></dt><dd><pre class="synopsis">ones (rows,columns...)</pre><p>Make an matrix of all ones (or a row vector if only one argument is given). Returns <code class="constant">null</code> if either rows or columns are zero.</p></dd><dt><span class="term"><a name="gel-function-rows"></a>rows</span></dt><dd><pre class="synopsis">rows (M)</pre><p>Get the number of rows of a matrix.</p></dd><dt><span class="term"><a name="gel-function-zeros"></a>zeros</span></dt><dd><pre class="synopsis">zeros (rows,columns...)</pre><p>Make a matrix of all zeros (or a row vector if only one argument is given). Returns <code class="constant">null</code> if either rows or columns are zero.</p></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11s07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch11.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch11s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Number Theory </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Linear Algebra</td></tr></table></div></body></html>
|