File: ch08.html

package info (click to toggle)
genius 1.0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 25,308 kB
  • sloc: ansic: 75,620; xml: 71,565; sh: 4,445; makefile: 1,927; lex: 523; yacc: 298; perl: 54
file content (55 lines) | stat: -rw-r--r-- 4,003 bytes parent folder | download
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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 8. Matrices in GEL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Genius Manual"><link rel="up" href="index.html" title="Genius Manual"><link rel="prev" href="ch07s06.html" title="Loading Programs"><link rel="next" href="ch08s02.html" title="Conjugate Transpose and Transpose Operator"></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">Chapter 8. Matrices in GEL</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s06.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch08s02.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="genius-gel-matrices"></a>Chapter 8. Matrices in GEL</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="ch08.html#genius-gel-matrix-support">Entering Matrices</a></span></dt><dt><span class="sect1"><a href="ch08s02.html">Conjugate Transpose and Transpose Operator</a></span></dt><dt><span class="sect1"><a href="ch08s03.html">Linear Algebra</a></span></dt></dl></div><p>
      Genius has support for vectors and matrices and possesses a sizable library of
      matrix manipulation and linear algebra functions.
    </p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-matrix-support"></a>Entering Matrices</h2></div></div></div><p>
To enter matrices, you can use one of the following two syntaxes. You can either enter
the matrix on one line, separating values by commas and rows by semicolons.  Or you
can enter each row on one line, separating
values by commas.
You can also just combine the two methods.
So to enter a 3x3 matrix
of numbers 1-9 you could do
</p><pre class="programlisting">[1,2,3;4,5,6;7,8,9]
</pre><p>
or
</p><pre class="programlisting">[1, 2, 3
 4, 5, 6
 7, 8, 9]
</pre><p>
Do not use both ';' and return at once on the same line though.
      </p><p>
You can also use the matrix expansion functionality to enter matrices.
For example you can do:
</p><pre class="programlisting">a = [ 1, 2, 3
      4, 5, 6
      7, 8, 9]
b = [ a,  10
      11, 12]
</pre><p>
and you should get
</p><pre class="programlisting">[1,   2,  3, 10
 4,   5,  6, 10
 7,   8,  9, 10
 11, 11, 11, 12]
</pre><p>
similarly you can build matrices out of vectors and other stuff like that.
      </p><p>
Another thing is that non-specified spots are initialized to 0, so
</p><pre class="programlisting">[1, 2, 3
 4, 5
 6]
</pre><p>
will end up being
</p><pre class="programlisting">
[1, 2, 3
 4, 5, 0
 6, 0, 0]
</pre><p>
      </p><p>
	When matrices are evaluated, they are evaluated and traversed row-wise.  This is just
	like the <code class="literal">M@(j)</code> operator, which traverses the matrix row-wise.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
Be careful about using returns for expressions inside the
<code class="literal">[ ]</code> brackets, as they have a slightly different meaning
there.  You will start a new row.
        </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07s06.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch08s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Loading Programs </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Conjugate Transpose and Transpose Operator</td></tr></table></div></body></html>