1 % Copyright (C) 2008 Jaroslav Hajek <highegg@gmail.com>
3 % This file is part of OctaveForge.
5 % OctaveForge is free software; you can redistribute it and/or modify
6 % it under the terms of the GNU General Public License as published by
7 % the Free Software Foundation; either version 2 of the License, or
8 % (at your option) any later version.
10 % This program is distributed in the hope that it will be useful,
11 % but WITHOUT ANY WARRANTY; without even the implied warranty of
12 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 % GNU General Public License for more details.
15 % You should have received a copy of the GNU General Public License
16 % along with this software; see the file COPYING. If not, see
17 % <http://www.gnu.org/licenses/>.
20 % function benchmark_dtmm (m, n, nvec)
22 % Dense transposed matrix-matrix and matrix-vector multiplication benchmark.
23 % This is to test the "compound operators" feature introduced in Octave.
26 % m = row dimension of matrices
27 % n = col dimension of matrices
28 % nvec = number of vector op repeats
31 % time_tmm = Time for A'*B (A,B m-by-n matrices)
32 % time_smm = Time for A'*A
33 % time_mtm = Time for A*B' (A,B n-by-m matrices)
34 % time_msm = Time for A*A'
35 % time_tmv = Time for A'*v nvec-times (A m-by-n matrix)
36 % ratio_tmv = Ratio to precomputed transpose time
37 % time_mtv = Time for v*A' nvec-times (A m-by-n matrix)
38 % ratio_mtv = Ratio to precomputed transpose time
41 function results = benchmark_dtmm (m, n, nvec)
43 benchutil_default_arg ('m', 40192);
44 benchutil_default_arg ('n', 150);
45 benchutil_default_arg ('nvec', 100);
47 benchutil_initialize (mfilename)
52 tic; C = A'*B; time_tmm = toc;
53 benchutil_set_result ('time_tmm')
55 tic; C = A'*A; time_smm = toc;
56 benchutil_set_result ('time_smm')
61 tic; C = A*B'; time_mtm = toc;
62 benchutil_set_result ('time_mtm')
64 tic; C = A*A'; time_msm = toc;
65 benchutil_set_result ('time_msm')
75 benchutil_set_result ('time_tmv')
82 ratio_tmv = time_tmv / toc;
83 benchutil_set_result ('ratio_tmv')
91 benchutil_set_result ('time_mtv')
97 ratio_mtv = time_mtv / toc;
98 benchutil_set_result ('ratio_mtv')