[lisplab-cvs] r59 - doc/manual
Jørn Inge Vestgården
jivestgarden at common-lisp.net
Mon Jul 20 07:54:51 UTC 2009
Author: jivestgarden
Date: Mon Jul 20 03:54:44 2009
New Revision: 59
Log:
manual
Added:
doc/manual/Makefile
Modified:
doc/manual/lisplab.texi
Added: doc/manual/Makefile
==============================================================================
--- (empty file)
+++ doc/manual/Makefile Mon Jul 20 03:54:44 2009
@@ -0,0 +1,9 @@
+source=lisplab.texi
+
+all: html
+
+html: $(source)
+ makeinfo --html $(source)
+
+pdf: $(source)
+ texi2pdf $(source)
\ No newline at end of file
Modified: doc/manual/lisplab.texi
==============================================================================
--- doc/manual/lisplab.texi (original)
+++ doc/manual/lisplab.texi Mon Jul 20 03:54:44 2009
@@ -338,9 +338,111 @@
@end example
which is also settable. Note that the matrices are column major order.
- at section Matrix manipulation
+ at section The dotted algebra
+The element-vise functions by conventions have names starting
+with a dot (period). The dotted algebra works on the single elements and
+is structure agnostic. The functions of the dotted algebra
+introduce a programming style
+much the same as for Matlab, and combined with the linear algebra
+functions, you can write compact programs, without the slower
+single element references.
+ at example
+LL> (.sin (drow 0 1))
+#<MATRIX-DGE 1x2
+0.0 0.8414709848078965
+ @{BB1FE21@}>
+ at end example
+And so also for the algebraic operations
+ at example
+LL> (let ((a (drow 0 1))
+ (b (dcol 0.1 0.2)))
+ (.+ a (.* b 2)))
+#<MATRIX-DGE 1x2
+0.2 1.4
+ @{BC5AC51@}>
+ at end example
+Note here that the @code{.+}, @code{.*}, etc. ignore the structure
+so that it is completely valid to add a row and a column matrix. Note
+also that the scalar is multiplied element-vise.
+
+The dotted algebra is to some extent also implemented for
+general element matrices
+ at example
+LL> (.+ (row 'matrix-ge 1/2 3/2) 1)
+#<MATRIX-GE 1x2
+3/2 5/2
+ @{B5AE9B9@}>
+ at end example
+
@section Linear algebra
+The linear algebra functions (unlike the dotted algebra)
+The linear algebra functions often start with @i{m}, although this
+conventions is not strictly enforced. Currently there is no a wide
+spectrum of linear algebra function, but you find matrix multiplication,
+matrix inversion, transpose, conjugate transpose and eigenvalues.
+
+Matrix multiplications
+ at example
+LL>(let ((a (dmat (1 0) (0 -1)))
+ (b (dcol 0.1 0.2)))
+ (m* a b))
+#<MATRIX-DGE 2x1
+0.1
+-0.2
+ @{BD45221@}>
+ at end example
+Matrix inversion
+ at example
+LL> (minv (dmat (1 2) (-2 1)))
+#<MATRIX-DGE 2x2
+0.2 -0.4
+0.4 0.2
+ @{BD85161@}>
+ at end example
+Transpose
+ at example
+LL> (mtp (dmat (1 2) (-2 1)))
+#<MATRIX-DGE 2x2
+1.0 -2.0
+2.0 1.0
+ @{BD99B11@}>
+ at end example
+Conjugate transpose
+ at example
+LL> (mct (zmat (1 (* 2 %i)) (-2 1)))
+#<MATRIX-ZGE 2x2
+#C(1.0 -0.0) #C(-2.0 -0.0)
+#C(0.0 -2.0) #C(1.0 -0.0)
+ @{BDC1DC9@}>
+ at end example
+Eigenvalues
+ at example
+LL> (eigenvalues (dmat (1 2) (0 0.5)))
+#<MATRIX-DGE 2x1
+1.0
+0.5
+ @{B2C5B19@}>
+ at end example
+Eigenvectors
+ at example
+LL> (eigenvectors (dmat (1 2) (0 0.5)))
+(#<MATRIX-DGE 2x1
+1.0
+0.5
+ @{B3368C1@}>
+ #<MATRIX-DGE 2x2
+1.0 -0.9701425001453319
+0.0 0.24253562503633297
+ @{B3361A9@}>)
+ at end example
+
+Some of the linear algebra functions also work for
+general element matrices
+ at example
+
+ at end example
+
@section Matrix IO
More information about the lisplab-cvs
mailing list