Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.54 KB | None | 0 0
  1. (defmacro with-matrix-elements (matrix &body body)
  2.   `(let ((rows (number-of-rows ,matrix))
  3.      (cols (number-of-cols ,matrix)))
  4.      (declare
  5.       (type fixnum rows cols)
  6.       (optimize (debug 0) (safety 0) (speed 3)))
  7.      (loop for i fixnum from 0 below rows
  8.        do
  9.          (loop for j from 0 below cols
  10.           do
  11.            ,@body))))
  12.  
  13.  
  14. (defmethod self-print ((matrix r-matrix-sfp))
  15.   (print-object matrix t)
  16.   (format t "~%Matrix elements:~%")
  17.   (with-matrix-elements matrix
  18.     (format t "~TA(~a,~a)=~,4e~%" i j (mref matrix i j))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement