2 (in-package :clem-test
)
4 (defparameter *hprod-test-matrix-size
* 256)
6 (eval-when (:compile-toplevel
:load-toplevel
:execute
)
7 (defun symbolicate (&rest args
)
8 (intern (string-upcase (apply #'concatenate
'string args
)))))
10 (defmacro def-hprod-test
(type-1 val-1 type-2 val-2
)
11 (let ((funcname (symbolicate "test/mat-hprod/" (symbol-name type-1
)
12 "/" (symbol-name type-2
)))
13 (m1 (symbolicate (symbol-name type-1
) "-matrix"))
14 (m2 (symbolicate (symbol-name type-2
) "-matrix")))
15 `(defun ,funcname
(&key
(size *hprod-test-matrix-size
*))
16 (let ((m (make-instance ',m1
:cols size
:rows size
17 :initial-element
,val-1
))
18 (n (make-instance ',m2
:cols size
:rows size
19 :initial-element
,val-2
)))
20 (let ((p (time (clem:mat-hprod m n
))))
23 (defmacro def-hprod
!-test
(type-1 val-1 type-2 val-2
)
24 (let ((funcname (symbolicate "test/mat-hprod!/" (symbol-name type-1
)
25 "/" (symbol-name type-2
)))
26 (m1 (symbolicate (symbol-name type-1
) "-matrix"))
27 (m2 (symbolicate (symbol-name type-2
) "-matrix")))
28 `(defun ,funcname
(&key
(size *hprod-test-matrix-size
*))
29 (let ((m (make-instance ',m1
:cols size
:rows size
30 :initial-element
,val-1
))
31 (n (make-instance ',m2
:cols size
:rows size
32 :initial-element
,val-2
)))
33 (let ((p (time (clem:mat-hprod
! m n
))))
36 (defmacro def-hprod-tests
(type-1 val-1 type-2 val-2
)
38 (def-hprod-test ,type-1
,val-1
,type-2
,val-2
)
39 (def-hprod!-test
,type-1
,val-1
,type-2
,val-2
)))
41 (def-hprod-tests double-float
1.25d0 double-float pi
)
42 (def-hprod-tests double-float
1.25d0 single-float
2.81818s0
)
43 (def-hprod-tests double-float
1.25d0 ub8
12)
44 (def-hprod-tests double-float
1.25d0 ub16
256)
45 (def-hprod-tests double-float
1.25d0 ub32
#x000f0000
)
46 (def-hprod-tests double-float
1.25d0 sb8
12)
47 (def-hprod-tests double-float
1.25d0 sb16
256)
48 (def-hprod-tests double-float
1.25d0 sb32
#x000f0000
)
49 (def-hprod-tests double-float
1.25d0 bit
0)
51 (def-hprod-tests single-float
1.25s0 single-float
2.81818s0
)
52 (def-hprod-tests single-float
1.25s0 ub8
12)
53 (def-hprod-tests single-float
1.25s0 ub16
256)
54 (def-hprod-tests single-float
1.25s0 ub32
#x000f0000
)
55 (def-hprod-tests single-float
1.25s0 sb8
12)
56 (def-hprod-tests single-float
1.25s0 sb16
256)
57 (def-hprod-tests single-float
1.25s0 sb32
#x000f0000
)
58 (def-hprod-tests single-float
1.25s0 bit
0)
60 (def-hprod-tests ub8
2 ub8
2)
61 (def-hprod-tests ub8
2 bit
0)
63 (def-hprod-tests ub16
2 ub16
2)
64 (def-hprod-tests ub16
2 ub8
2)
65 (def-hprod-tests ub16
2 bit
0)
67 (def-hprod-tests ub32
2 ub32
2)
68 (def-hprod-tests ub32
2 ub16
2)
69 (def-hprod-tests ub32
2 ub8
2)
70 (def-hprod-tests ub32
2 bit
0)
72 (def-hprod-tests sb8
2 sb8
2)
73 (def-hprod-tests sb8
2 bit
0)
75 (def-hprod-tests sb16
2 sb16
2)
76 (def-hprod-tests sb16
2 sb8
2)
77 (def-hprod-tests sb16
2 bit
0)
79 (def-hprod-tests sb32
2 sb32
2)
80 (def-hprod-tests sb32
2 sb16
2)
81 (def-hprod-tests sb32
2 sb8
2)
82 (def-hprod-tests sb32
2 bit
0)
84 (def-hprod-tests fixnum
2 fixnum
0)
85 (def-hprod-tests fixnum
2 bit
0)
87 (def-hprod-tests bit
1 bit
0)
89 (defun run-hprod-tests ()
91 (test/mat-hprod
/double-float
/double-float
)
92 (test/mat-hprod
/double-float
/single-float
)
93 (test/mat-hprod
/double-float
/ub8
)
94 (test/mat-hprod
/double-float
/ub16
)
95 (test/mat-hprod
/double-float
/ub32
)
96 (test/mat-hprod
/double-float
/sb8
)
97 (test/mat-hprod
/double-float
/sb16
)
98 (test/mat-hprod
/double-float
/sb32
)
99 (test/mat-hprod
/double-float
/bit
)
101 (test/mat-hprod
/single-float
/single-float
)
102 (test/mat-hprod
/single-float
/ub8
)
103 (test/mat-hprod
/single-float
/ub16
)
104 (test/mat-hprod
/single-float
/ub32
)
105 (test/mat-hprod
/single-float
/sb8
)
106 (test/mat-hprod
/single-float
/sb16
)
107 (test/mat-hprod
/single-float
/sb32
)
108 (test/mat-hprod
/single-float
/bit
)
110 (test/mat-hprod
/ub8
/ub8
)
111 (test/mat-hprod
/ub8
/bit
)
113 (test/mat-hprod
/ub16
/ub16
)
114 (test/mat-hprod
/ub16
/ub8
)
115 (test/mat-hprod
/ub16
/bit
)
117 (test/mat-hprod
/ub32
/ub32
)
118 (test/mat-hprod
/ub32
/ub16
)
119 (test/mat-hprod
/ub32
/ub8
)
120 (test/mat-hprod
/ub32
/bit
)
122 (test/mat-hprod
/sb8
/sb8
)
123 (test/mat-hprod
/sb8
/bit
)
125 (test/mat-hprod
/sb16
/sb16
)
126 (test/mat-hprod
/sb16
/sb8
)
127 (test/mat-hprod
/sb16
/bit
)
129 (test/mat-hprod
/sb32
/sb32
)
130 (test/mat-hprod
/sb32
/sb16
)
131 (test/mat-hprod
/sb32
/sb8
)
132 (test/mat-hprod
/sb32
/bit
)
134 (test/mat-hprod
/fixnum
/fixnum
)
135 (test/mat-hprod
/fixnum
/bit
)
137 (test/mat-hprod
/bit
/bit
))
139 (defun run-hprod!-tests
()
141 (test/mat-hprod
!/double-float
/double-float
)
142 (test/mat-hprod
!/double-float
/single-float
)
143 (test/mat-hprod
!/double-float
/ub8
)
144 (test/mat-hprod
!/double-float
/ub16
)
145 (test/mat-hprod
!/double-float
/ub32
)
146 (test/mat-hprod
!/double-float
/sb8
)
147 (test/mat-hprod
!/double-float
/sb16
)
148 (test/mat-hprod
!/double-float
/sb32
)
149 (test/mat-hprod
!/double-float
/bit
)
151 (test/mat-hprod
!/single-float
/single-float
)
152 (test/mat-hprod
!/single-float
/ub8
)
153 (test/mat-hprod
!/single-float
/ub16
)
154 (test/mat-hprod
!/single-float
/ub32
)
155 (test/mat-hprod
!/single-float
/sb8
)
156 (test/mat-hprod
!/single-float
/sb16
)
157 (test/mat-hprod
!/single-float
/sb32
)
158 (test/mat-hprod
!/single-float
/bit
)
160 (test/mat-hprod
!/ub8
/ub8
)
161 (test/mat-hprod
!/ub8
/bit
)
163 (test/mat-hprod
!/ub16
/ub16
)
164 (test/mat-hprod
!/ub16
/ub8
)
165 (test/mat-hprod
!/ub16
/bit
)
167 (test/mat-hprod
!/ub32
/ub32
)
168 (test/mat-hprod
!/ub32
/ub16
)
169 (test/mat-hprod
!/ub32
/ub8
)
170 (test/mat-hprod
!/ub32
/bit
)
172 (test/mat-hprod
!/sb8
/sb8
)
173 (test/mat-hprod
!/sb8
/bit
)
175 (test/mat-hprod
!/sb16
/sb16
)
176 (test/mat-hprod
!/sb16
/sb8
)
177 (test/mat-hprod
!/sb16
/bit
)
179 (test/mat-hprod
!/sb32
/sb32
)
180 (test/mat-hprod
!/sb32
/sb16
)
181 (test/mat-hprod
!/sb32
/sb8
)
182 (test/mat-hprod
!/sb32
/bit
)
184 (test/mat-hprod
!/fixnum
/fixnum
)
185 (test/mat-hprod
!/fixnum
/bit
)
187 (test/mat-hprod
!/bit
/bit
))