[lisplab-cvs] r33 -

Jørn Inge Vestgården jivestgarden at common-lisp.net
Thu May 21 19:14:55 UTC 2009


Author: jivestgarden
Date: Thu May 21 15:14:54 2009
New Revision: 33

Log:
Updated the exampes

Modified:
   example.lisp

Modified: example.lisp
==============================================================================
--- example.lisp	(original)
+++ example.lisp	Thu May 21 15:14:54 2009
@@ -5,33 +5,40 @@
 ;;; 19 ways to create a matrix
 (defparameter *test-matrices* 
   (list 
+   ;; Blank matrices
+   
+   (mnew 'matrix-dge 0 3 5)
+     ; same as
+   (dnew 0 3 5)
+     ; same as
+   (mnew '(:d :ge :any) 0 3 5)
+
+   (mnew 'matrix-zge 0 3 5)
+     ; same as
+   (znew 0 3 5)
+     ; same as
+   (mnew '(:z :ge :any) 0 3 5)
+
+   (drow 2 4 2)
+   (dcol 2 3 1)
+   (zrow 2 %i 1)
+   (zcol 2 %i 1)
 
    ;; Setting of individual elements
-   #2a((1 4) (-2 3))
-   (rmat (0 4 -2) (1 3 -5) (-2 4 0))
-   (cmat (0 #C(0 2) -2) (1 3 -5) (-2 %i 0))  
-   (funmat 4 4 (i j) (if (= i j) 1 0))
-   (rrow 2 4 2)
-   (rcol 2 3 1)
-   (crow 2 %i 1)
-   (ccol 2 %i 1)
+   (dmat (0 4 -2) (1 3 -5) (-2 4 0))
+   (zmat (0 #C(0 2) -2) (1 3 -5) (-2 %i 0))  
 
    ;; Setting of structure
-   (make-array '(3 4) :element-type 'double-float)
-   (rnew 1 3 5)
-
-   ; (cnew %i 2 5)
-   (new 'array '(3 5) t 4)
-   (new 'blas-real '(3 5) t 4)
-   (new 'blas-complex '(3 5) t 4)
+   (funmat '(4 4) (i j) (if (= i j) 1 0)) 
+   (fmat 'matrix-dge '(3 4) (i j) (if (< i j) 1 0.5))
 
    ;; From another matrix
-   (copy #2a((1 4) (-2 3)))
-   (create #2a((1 4) (-2 3)))
-   (convert '((3 2 4) (1 4 2)) 'array)
-   (convert (funmat 3 3 (i j) (random 1.0)) 'blas-real)
-   (mmap 'blas-real #'random (rnew 1 3 3))
-   (.+ 3 (rmat (2 3) (-2 9)))))
+   (copy (dmat (1 4) (-2 3)))
+   (mcreate (dmat (1 4) (-2 3)))
+   (convert '((3 2 4) (1 4 2)) 'matrix-dge)
+   (convert (funmat '(3 3) (i j) (random 1.0)) 'matrix-dge)
+   (mmap '(:z :ge :any) #'random (mnew '(:d :ge :any) 1 3 3))
+   (.+ 3 (dmat (2 3) (-2 9)))))
 
 (mapcar (lambda (x) (mref x 0 0)) *test-matrices*)
 
@@ -39,19 +46,17 @@
 
 ;; Arithmetics 
 
-(let ((a (rmat (0 4 -2) (1 3 -5) (-2 4 0)))
-      (b (cmat (0 #C(0 2) -2) (1 3 -5) (-2 %i 0))))  
+(let ((a (dmat (0 4 -2) (1 3 -5) (-2 4 0)))
+      (b (zmat (0 #C(0 2) -2) (1 3 -5) (-2 %i 0))))  
   (.+ (.* 3 a) b))
 
 ;; Infix arithmetics 
 
-(let ((a (rmat (0 4 -2) (1 3 -5) (-2 4 0)))
-      (b (cmat (0 #C(0 2) -2) (1 3 -5) (-2 %i 0))))  
+(let ((a (dmat (0 4 -2) (1 3 -5) (-2 4 0)))
+      (b (zmat (0 #C(0 2) -2) (1 3 -5) (-2 %i 0))))  
   (w/infix 3 .* a .+ b))
 
 
 ;; Matrix inversion
 
-(minv #2a((0 4 -2) (1 3 -5) (-2 4 0)))
-
-(minv (rmat (0 4 -2) (1 3 -5) (-2 4 0)))
+(minv (dmat (0 4 -2) (1 3 -5) (-2 4 0)))




More information about the lisplab-cvs mailing list