[lisplab-cvs] r141 - in trunk/src: core fft io linalg matlisp matrix test
Jørn Inge Vestgården
jivestgarden at common-lisp.net
Sat Mar 20 19:19:43 UTC 2010
Author: jivestgarden
Date: Sat Mar 20 15:19:43 2010
New Revision: 141
Log:
Changed 0.0 to 0d0 etc.
Modified:
trunk/src/core/level0-basic.lisp
trunk/src/core/level0-const.lisp
trunk/src/core/template.lisp
trunk/src/fft/level3-fft-zge.lisp
trunk/src/io/level3-io.lisp
trunk/src/linalg/level3-linalg-dge.lisp
trunk/src/matlisp/mul.lisp
trunk/src/matrix/level1-ddiag.lisp
trunk/src/matrix/level1-dgt.lisp
trunk/src/matrix/level1-util.lisp
trunk/src/matrix/level2-constructors.lisp
trunk/src/matrix/level2-generic.lisp
trunk/src/matrix/level2-matrix-dge.lisp
trunk/src/matrix/level2-matrix-zge.lisp
trunk/src/test/test-methods.lisp
Modified: trunk/src/core/level0-basic.lisp
==============================================================================
--- trunk/src/core/level0-basic.lisp (original)
+++ trunk/src/core/level0-basic.lisp Sat Mar 20 15:19:43 2010
@@ -54,6 +54,6 @@
(defun dvec (n)
"Creates a double vector with n elements."
- (make-array n :element-type 'double-float :initial-element 0.0))
+ (make-array n :element-type 'double-float :initial-element 0d0))
Modified: trunk/src/core/level0-const.lisp
==============================================================================
--- trunk/src/core/level0-const.lisp (original)
+++ trunk/src/core/level0-const.lisp Sat Mar 20 15:19:43 2010
@@ -20,9 +20,9 @@
(in-package :lisplab)
;;; Float and complex constants
-(define-constant %e (exp 1.0) "The number e = exp(1).")
-(define-constant %i #C(0.0 1.0) "The imaginary unit i=sqrt(-1).")
-(define-constant -%i #C(0.0 -1.0) "The negative imaginary unit -i=-sqrt(-1).")
+(define-constant %e (exp 1d0) "The number e = exp(1).")
+(define-constant %i #C(0d0 1d0) "The imaginary unit i=sqrt(-1).")
+(define-constant -%i #C(0d0 -1d0) "The negative imaginary unit -i=-sqrt(-1).")
;;; Type constants
;;; TODO: throw them out or use deftype in stead
@@ -35,28 +35,28 @@
;;; TODO: throw them out
-(define-constant +lisplab-dbl-epsilon+ 2.2204460492503131e-16)
-(define-constant +lisplab-sqrt-dbl-epsilon+ 1.4901161193847656e-08)
-(define-constant +lisplab-root3-dbl-epsilon+ 6.0554544523933429e-06)
-(define-constant +lisplab-root4-dbl-epsilon+ 1.2207031250000000e-04)
-(define-constant +lisplab-root5-dbl-epsilon+ 7.4009597974140505e-04)
-(define-constant +lisplab-root6-dbl-epsilon+ 2.4607833005759251e-03)
-(define-constant +lisplab-log-dbl-epsilon+ -3.6043653389117154e+01)
-
-(define-constant +lisplab-dbl-min+ 2.2250738585072014e-308)
-(define-constant +lisplab-sqrt-dbl-min+ 1.4916681462400413e-154)
-(define-constant +lisplab-root3-dbl-min+ 2.8126442852362996e-103)
-(define-constant +lisplab-root4-dbl-min+ 1.2213386697554620e-77)
-(define-constant +lisplab-root5-dbl-min+ 2.9476022969691763e-62)
-(define-constant +lisplab-root6-dbl-min+ 5.3034368905798218e-52)
-(define-constant +lisplab-log-dbl-min+ -7.0839641853226408e+02)
-
-(define-constant +lisplab-dbl-max+ 1.7976931348623157e+308)
-(define-constant +lisplab-sqrt-dbl-max+ 1.3407807929942596e+154)
-(define-constant +lisplab-root3-dbl-max+ 5.6438030941222897e+102)
-(define-constant +lisplab-root4-dbl-max+ 1.1579208923731620e+77)
-(define-constant +lisplab-root5-dbl-max+ 4.4765466227572707e+61)
-(define-constant +lisplab-root6-dbl-max+ 2.3756689782295612e+51)
-(define-constant +lisplab-log-dbl-max+ 7.0978271289338397e+02)
+(define-constant +lisplab-dbl-epsilon+ 2.2204460492503131d-16)
+(define-constant +lisplab-sqrt-dbl-epsilon+ 1.4901161193847656d-08)
+(define-constant +lisplab-root3-dbl-epsilon+ 6.0554544523933429d-06)
+(define-constant +lisplab-root4-dbl-epsilon+ 1.2207031250000000d-04)
+(define-constant +lisplab-root5-dbl-epsilon+ 7.4009597974140505d-04)
+(define-constant +lisplab-root6-dbl-epsilon+ 2.4607833005759251d-03)
+(define-constant +lisplab-log-dbl-epsilon+ -3.6043653389117154d+01)
+
+(define-constant +lisplab-dbl-min+ 2.2250738585072014d-308)
+(define-constant +lisplab-sqrt-dbl-min+ 1.4916681462400413d-154)
+(define-constant +lisplab-root3-dbl-min+ 2.8126442852362996d-103)
+(define-constant +lisplab-root4-dbl-min+ 1.2213386697554620d-77)
+(define-constant +lisplab-root5-dbl-min+ 2.9476022969691763d-62)
+(define-constant +lisplab-root6-dbl-min+ 5.3034368905798218d-52)
+(define-constant +lisplab-log-dbl-min+ -7.0839641853226408d+02)
+
+(define-constant +lisplab-dbl-max+ 1.7976931348623157d+308)
+(define-constant +lisplab-sqrt-dbl-max+ 1.3407807929942596d+154)
+(define-constant +lisplab-root3-dbl-max+ 5.6438030941222897d+102)
+(define-constant +lisplab-root4-dbl-max+ 1.1579208923731620d+77)
+(define-constant +lisplab-root5-dbl-max+ 4.4765466227572707d+61)
+(define-constant +lisplab-root6-dbl-max+ 2.3756689782295612d+51)
+(define-constant +lisplab-log-dbl-max+ 7.0978271289338397d+02)
Modified: trunk/src/core/template.lisp
==============================================================================
--- trunk/src/core/template.lisp (original)
+++ trunk/src/core/template.lisp Sat Mar 20 15:19:43 2010
@@ -145,11 +145,11 @@
(N (cols b))
(S (cols a))
(c (create a 0 (list M N)))
- (tmp 0.0))
+ (tmp 0d0))
(w/dynamic (a b c tmp)
(dotimes (i (rows A))
(dotimes (j (cols B))
- (setf tmp 0.0)
+ (setf tmp 0d0)
(dotimes (k (cols A))
(incf tmp (* (mref a i k) (mref b k j))))
(setf (mref c i j) tmp)))
Modified: trunk/src/fft/level3-fft-zge.lisp
==============================================================================
--- trunk/src/fft/level3-fft-zge.lisp (original)
+++ trunk/src/fft/level3-fft-zge.lisp Sat Mar 20 15:19:43 2010
@@ -150,7 +150,7 @@
forward or :r for reverse transform. Input must be a
vector of complex double float"
(let* ((ftx x)
- (sign (ecase direction (:f -1.0) (:r 1.0))))
+ (sign (ecase direction (:f -1d0) (:r 1d0))))
(declare (type-blas-idx n start step)
(double-float sign)
(type-blas-store ftx))
@@ -158,8 +158,8 @@
;; apply fft recursion
(dotimes (bit (floor (log n 2)))
(let* ((dual (expt 2 bit))
- (W #C(1.0 0.0))
- (tmp (- (exp (/ (* sign %i pi) dual)) 1.0 )))
+ (W #C(1d0 0d0))
+ (tmp (- (exp (/ (* sign %i pi) dual)) 1d0 )))
(declare (type type-blas-idx dual)
(type (integer 0 30) bit)
(type (complex double-float) W tmp))
Modified: trunk/src/io/level3-io.lisp
==============================================================================
--- trunk/src/io/level3-io.lisp (original)
+++ trunk/src/io/level3-io.lisp Sat Mar 20 15:19:43 2010
@@ -118,8 +118,8 @@
(let* ((rows (rows m))
(cols (cols m))
(scale (- max min)))
- (when (<= (- max min) 0.0)
- (setf max 1.0 min 0.0 scale 1.0))
+ (when (<= (- max min) 0d0)
+ (setf max 1d0 min 0d0 scale 1d0))
(with-open-file (out filename :direction :output :if-exists :supersede)
(format out "P5~%")
(format out "~A ~A~%" cols rows)
@@ -145,10 +145,10 @@
;; TODO: clean up and some more lispifying.
;; TODO: more testing.
;; TOOD: change name to epswrite.
- (when (<= (- max min) 0.0)
- (setf max 1.0 min 0.0 ))
- (let* ((DTXSCALE 1.0)
- (DTYSCALE 1.0)
+ (when (<= (- max min) 0d0)
+ (setf max 1d0 min 0d0 ))
+ (let* ((DTXSCALE 1d0)
+ (DTYSCALE 1d0)
#+nil (DTHRES 513)
#+nil (DTVRES 481)
(XOFFSET 54) ; 3/4 inch. 72 units = 1 inch.
@@ -159,9 +159,9 @@
#+nil (invert 0)
#+nil (count 0)
#+nil (title nil)
- (xsc 1.0)
- ; (ysc 1.0 )
- (ysc (/ (cols m) (rows m) 1.0))
+ (xsc 1d0)
+ ; (ysc 1d0 )
+ (ysc (/ (cols m) (rows m) 1d0))
(xscale (floor (* DTXSCALE scale 432 xsc)))
(yscale (floor (* DTYSCALE scale 432 ysc)))
Modified: trunk/src/linalg/level3-linalg-dge.lisp
==============================================================================
--- trunk/src/linalg/level3-linalg-dge.lisp (original)
+++ trunk/src/linalg/level3-linalg-dge.lisp Sat Mar 20 15:19:43 2010
@@ -50,7 +50,7 @@
(refc (i j) `(ref-blas-real-store C2 ,i ,j N)))
(dotimes (i N)
(dotimes (j M)
- (let ((cij 0.0))
+ (let ((cij 0d0))
(declare (double-float cij))
(dotimes (k S)
(incf cij (* (refa i k ) (refb k j))))
Modified: trunk/src/matlisp/mul.lisp
==============================================================================
--- trunk/src/matlisp/mul.lisp (original)
+++ trunk/src/matlisp/mul.lisp Sat Mar 20 15:19:43 2010
@@ -25,8 +25,8 @@
(n (cols b))
(k (cols a))
(c (mcreate a 0 (list m n))))
- (f77::dgemm "N" "N" m n k 1.0
- (matrix-store a) m (matrix-store b) k 0.0 (matrix-store c) m)
+ (f77::dgemm "N" "N" m n k 1d0
+ (matrix-store a) m (matrix-store b) k 0d0 (matrix-store c) m)
c)
(call-next-method)))
@@ -36,7 +36,7 @@
(n (cols b))
(k (cols a))
(c (mcreate a 0 (list m n))))
- (f77::zgemm "N" "N" m n k #C(1.0 0.0)
- (matrix-store a) m (matrix-store b) k #C(0.0 0.0) (matrix-store c) m)
+ (f77::zgemm "N" "N" m n k #C(1d0 0d0)
+ (matrix-store a) m (matrix-store b) k #C(0d0 0d0) (matrix-store c) m)
c)
(call-next-method)))
Modified: trunk/src/matrix/level1-ddiag.lisp
==============================================================================
--- trunk/src/matrix/level1-ddiag.lisp (original)
+++ trunk/src/matrix/level1-ddiag.lisp Sat Mar 20 15:19:43 2010
@@ -59,7 +59,7 @@
(defmethod mref ((matrix matrix-base-ddi) row col)
(if (= row col)
(aref (slot-value matrix 'diagonal-store) row)
- 0.0))
+ 0d0))
(defmethod (setf mref) (value (matrix matrix-base-ddi) row col)
(if (= row col)
Modified: trunk/src/matrix/level1-dgt.lisp
==============================================================================
--- trunk/src/matrix/level1-dgt.lisp (original)
+++ trunk/src/matrix/level1-dgt.lisp Sat Mar 20 15:19:43 2010
@@ -82,7 +82,7 @@
(aref (slot-value matrix 'subdiagonal-store) col))
((= (1+ row) col) 8
(aref (slot-value matrix 'superdiagonal-store) row))
- (t 0.0)))
+ (t 0d0)))
(defmethod (setf mref) (value (matrix matrix-base-dgt) row col)
(let ((val2 (coerce value 'double-float)))
Modified: trunk/src/matrix/level1-util.lisp
==============================================================================
--- trunk/src/matrix/level1-util.lisp (original)
+++ trunk/src/matrix/level1-util.lisp Sat Mar 20 15:19:43 2010
@@ -101,7 +101,7 @@
value)
value)
-(defun allocate-real-store (size &optional (initial-element 0.0))
+(defun allocate-real-store (size &optional (initial-element 0d0))
;; All matrix double and complex double constructors
;; should call this one
(let ((x (coerce initial-element 'double-float)))
@@ -109,10 +109,10 @@
(type type-blas-idx size))
;; Stupid efficiency hack for SBCL. Allocations of arrays with zeros
;; is significantly faster than others!
- (if (= x 0.0)
+ (if (= x 0d0)
(make-array size
:element-type 'double-float
- :initial-element 0.0)
+ :initial-element 0d0)
(make-array size
:element-type 'double-float
:initial-element x))))
@@ -141,7 +141,7 @@
;;;; The complex store
-(defun allocate-complex-store (size &optional (value 0.0))
+(defun allocate-complex-store (size &optional (value 0d0))
(let* ((2size (* 2 size))
(rv (coerce (realpart value) 'double-float))
(iv (coerce (imagpart value) 'double-float))
Modified: trunk/src/matrix/level2-constructors.lisp
==============================================================================
--- trunk/src/matrix/level2-constructors.lisp (original)
+++ trunk/src/matrix/level2-constructors.lisp Sat Mar 20 15:19:43 2010
@@ -88,7 +88,7 @@
(defun drandom (rows cols)
"Creates a double matrix with random element between 0 and 1."
- (mmap t #'random (dnew 1.0 rows cols)))
+ (mmap t #'random (dnew 1d0 rows cols)))
(defmacro dmat (&body args)
"Creates a matrix-dge matrix."
Modified: trunk/src/matrix/level2-generic.lisp
==============================================================================
--- trunk/src/matrix/level2-generic.lisp (original)
+++ trunk/src/matrix/level2-generic.lisp Sat Mar 20 15:19:43 2010
@@ -30,7 +30,7 @@
(in-package :lisplab)
-(defmethod mcreate ((m number) &optional (val 0.0) dim)
+(defmethod mcreate ((m number) &optional (val 0) dim)
;; This is not about matrices at all, but is usefull
;; when you use the dotted algebra and is not sure is input is numbers or matrices.
;; TODO what the dim, should I use it or ignore it
Modified: trunk/src/matrix/level2-matrix-dge.lisp
==============================================================================
--- trunk/src/matrix/level2-matrix-dge.lisp (original)
+++ trunk/src/matrix/level2-matrix-dge.lisp Sat Mar 20 15:19:43 2010
@@ -69,7 +69,7 @@
nil)
(defmethod msum ((m matrix-base-dge))
- (let ((sum 0.0))
+ (let ((sum 0d0))
(with-elements-df-1 (matrix-store m) x
(incf sum x))
sum))
@@ -278,66 +278,66 @@
(copy a))
(defmethod .sqrt ((a matrix-base-dge))
- (if (>= (mmin a) 0.0)
+ (if (>= (mmin a) 0d0)
(let ((out (mcreate a)))
(sqrt_dfa-to-dfa (matrix-store a) (matrix-store out))
out)
(let ((out (make-matrix-instance (cons :z (cdr (type-spec a)))
(dim a)
- 0.0)))
+ 0d0)))
(sqrt_dfa-to-cdfa (matrix-store a) (matrix-store out))
out)))
(defmethod .ln ((a matrix-base-dge))
- (if (> (mmin a) 0.0)
+ (if (> (mmin a) 0d0)
(let ((out (mcreate a)))
(log_dfa-to-dfa (matrix-store a) (matrix-store out))
out)
(let ((out (make-matrix-instance (cons :z (cdr (type-spec a)))
(dim a)
- 0.0)))
+ 0d0)))
(log_dfa-to-cdfa (matrix-store a) (matrix-store out))
out)))
(defmethod .asin ((a matrix-base-dge))
(destructuring-bind (min max)
(mminmax a)
- (if (and (>= min -1.0)
- (<= max 1.0))
+ (if (and (>= min -1d0)
+ (<= max 1d0))
(let ((out (mcreate a)))
(asin_dfa-to-dfa (matrix-store a) (matrix-store out))
out)
(let ((out (make-matrix-instance (cons :z (cdr (type-spec a)))
(dim a)
- 0.0)))
+ 0d0)))
(asin_dfa-to-cdfa (matrix-store a) (matrix-store out))
out))))
(defmethod .acos ((a matrix-base-dge))
(destructuring-bind (min max)
(mminmax a)
- (if (and (>= min -1.0)
- (<= max 1.0))
+ (if (and (>= min -1d0)
+ (<= max 1d0))
(let ((out (mcreate a)))
(acos_dfa-to-dfa (matrix-store a) (matrix-store out))
out)
(let ((out (make-matrix-instance (cons :z (cdr (type-spec a)))
(dim a)
- 0.0)))
+ 0d0)))
(acos_dfa-to-cdfa (matrix-store a) (matrix-store out))
out))))
(defmethod .atanh ((a matrix-base-dge))
(destructuring-bind (min max)
(mminmax a)
- (if (and (> min -1.0)
- (< max 1.0))
+ (if (and (> min -1d0)
+ (< max 1d0))
(let ((out (mcreate a)))
(atanh_dfa-to-dfa (matrix-store a) (matrix-store out))
out)
(let ((out (make-matrix-instance (cons :z (cdr (type-spec a)))
(dim a)
- 0.0)))
+ 0d0)))
(atanh_dfa-to-cdfa (matrix-store a) (matrix-store out))
out))))
Modified: trunk/src/matrix/level2-matrix-zge.lisp
==============================================================================
--- trunk/src/matrix/level2-matrix-zge.lisp (original)
+++ trunk/src/matrix/level2-matrix-zge.lisp Sat Mar 20 15:19:43 2010
@@ -54,8 +54,8 @@
to)))
(defmethod msum ((m matrix-base-zge))
- (let ((sum-r 0.0)
- (sum-i 0.0)
+ (let ((sum-r 0d0)
+ (sum-i 0d0)
(m0 (matrix-store m)))
(declare (type double-float sum-r sum-i)
(type type-blas-store m0))
Modified: trunk/src/test/test-methods.lisp
==============================================================================
--- trunk/src/test/test-methods.lisp (original)
+++ trunk/src/test/test-methods.lisp Sat Mar 20 15:19:43 2010
@@ -20,7 +20,7 @@
(defun test-level0-methods ()
(let* ((a 1)
- (b 1.0)
+ (b 1d0)
(c %i)
(x (dmat (1 2) (3 4)))
(y (zmat (1 2) (3 4)))
More information about the lisplab-cvs
mailing list