[lisplab-cvs] r65 - src/matrix

Jørn Inge Vestgården jivestgarden at common-lisp.net
Mon Jul 20 19:37:39 UTC 2009


Author: jivestgarden
Date: Mon Jul 20 15:37:39 2009
New Revision: 65

Log:
basic algebra on lists. Here it comes.

Added:
   src/matrix/level2-list.lisp

Added: src/matrix/level2-list.lisp
==============================================================================
--- (empty file)
+++ src/matrix/level2-list.lisp	Mon Jul 20 15:37:39 2009
@@ -0,0 +1,67 @@
+;;; Lisplab, level2-list.lisp
+;;; Basic algebra stuff for lists
+
+;;; Copyright (C) 2009 Joern Inge Vestgaarden
+;;;
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License along
+;;; with this program; if not, write to the Free Software Foundation, Inc.,
+;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+;;; Should it be somewhere else. It has nothing to do with matrices really. 
+
+(in-package :lisplab)
+
+(defmethod .mul ((x cons) (y cons))
+  (mapcar #'.mul x y))
+
+(defmethod .mul ((x cons) (y number))
+  (mapcar (lambda (x) (.mul x y)) x))
+
+(defmethod .mul ((x number) (y cons))
+  (mapcar (lambda (y) (.mul x y)) y))
+
+(defmethod .add ((x cons) (y cons))
+  (mapcar #'.add x y))
+
+(defmethod .add ((x cons) (y number))
+  (mapcar (lambda (x) (.add x y)) x))
+
+(defmethod .add ((x number) (y cons))
+  (mapcar (lambda (y) (.add x y)) y))
+
+(defmethod .sub ((x cons) (y cons))
+  (mapcar #'.sub x y))
+
+(defmethod .sub ((x cons) (y number))
+  (mapcar (lambda (x) (.sub x y)) x))
+
+(defmethod .sub ((x number) (y cons))
+  (mapcar (lambda (y) (.sub x y)) y))
+
+(defmethod .div ((x cons) (y cons))
+  (mapcar #'.div x y))
+
+(defmethod .div ((x cons) (y number))
+  (mapcar (lambda (x) (.div x y)) x))
+
+(defmethod .div ((x number) (y cons))
+  (mapcar (lambda (y) (.div x y)) y))
+
+(defmethod .expt ((x cons) (y cons))
+  (mapcar #'.expt x y))
+
+(defmethod .expt ((x cons) (y number))
+  (mapcar (lambda (x) (.expt x y)) x))
+
+(defmethod .expt ((x number) (y cons))
+  (mapcar (lambda (y) (.expt x y)) y))




More information about the lisplab-cvs mailing list