;;; Lisplab, level1-interface.lisp ;;; Minimum matrix interface. Anything that specializes on these ;;; generic functions is a matrix! ;;; 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. (in-package :lisplab) (defvar *lisplab-print-size* 5 "Suggested number of rows and columns printed to standard output. Not all matrices will care about the value.") (defvar *lisplab-element-printer* nil "The function used to print matrix elements. For is same as princ and prin1.") (defgeneric vref (matrix idx) (:documentation "Vector accessor.")) (defgeneric (setf vref) (value matrix idx)) (defgeneric dim (matrix &optional direction) (:documentation "Gives a list of all dimension lengths, or the length of the dimension specified.")) (defgeneric (setf dim) (value matrix &optional direction)) (defgeneric element-type (matrix) (:documentation "The object element type, or t if any.")) (defgeneric (setf element-type) (value matrix)) (defgeneric size (matrix) (:documentation "Gives the number of elements in the object.")) (defgeneric (setf size) (value matrix)) (defgeneric rank (matrix) (:documentation "The rank is the number of dimensions.")) (defgeneric (setf rank) (value matrix)) ;;; Internal routines for access to matrix store (declaim (inline vector-store)) (defgeneric vector-store (x) (:documentation "Returns the store of the matrix"))