annotate libcruft/blas-xtra/smatm3.f @ 13141:e81ddf9cacd5

maint: untabify and remove trailing whitespace from source files * bicg.m, gmres.m, pkg.m: Untabify and remove trailing whitespace. * libcruft/Makefile.am, libcruft/blas-xtra/cdotc3.f, libcruft/blas-xtra/cmatm3.f, libcruft/blas-xtra/ddot3.f, libcruft/blas-xtra/dmatm3.f, libcruft/blas-xtra/sdot3.f, libcruft/blas-xtra/smatm3.f, libcruft/blas-xtra/zdotc3.f, libcruft/blas-xtra/zmatm3.f, libcruft/lapack-xtra/crsf2csf.f, libcruft/lapack-xtra/zrsf2csf.f, liboctave/Array.cc, liboctave/DASPK-opts.in, liboctave/DASRT-opts.in, liboctave/DASSL-opts.in, liboctave/LSODE-opts.in, liboctave/Makefile.a,mliboctave/Quad-opts.in, liboctave/Sparse-perm-op-defs.h, scripts/Makefile.a,mscripts/deprecated/glpkmex.m, scripts/general/blkdiag.m, scripts/general/interp1.m, scripts/general/profshow.m, scripts/general/quadl.m, scripts/general/triplequad.m, scripts/help/__makeinfo__.m, scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m, scripts/linear-algebra/rank.m, scripts/miscellaneous/gzip.m, scripts/miscellaneous/private/__xzip__.m, scripts/miscellaneous/tempdir.m, scripts/miscellaneous/unpack.m, scripts/pkg/pkg.m, scripts/plot/allchild.m, scripts/plot/ancestor.m, scripts/plot/cla.m, scripts/plot/clf.m, scripts/plot/findall.m, scripts/plot/findobj.m, scripts/plot/gca.m, scripts/plot/gcf.m, scripts/plot/hggroup.m, scripts/plot/isfigure.m, scripts/plot/ishghandle.m, scripts/plot/legend.m, scripts/plot/line.m, scripts/plot/loglog.m, scripts/plot/patch.m, scripts/plot/print.m, scripts/plot/private/__quiver__.m, scripts/plot/private/__scatter__.m, scripts/plot/rectangle.m, scripts/plot/semilogx.m, scripts/plot/semilogy.m, scripts/plot/surface.m, scripts/plot/text.m, scripts/plot/title.m, scripts/plot/trisurf.m, scripts/plot/view.m, scripts/plot/whitebg.m, scripts/plot/xlabel.m, scripts/plot/xlim.m, scripts/plot/ylabel.m, scripts/plot/ylim.m, scripts/plot/zlabel.m, scripts/plot/zlim.m, scripts/polynomial/mkpp.m, scripts/polynomial/polygcd.m, scripts/polynomial/ppint.m, scripts/polynomial/ppjumps.m, scripts/polynomial/ppval.m, scripts/set/setxor.m, scripts/sparse/bicgstab.m, scripts/sparse/cgs.m, scripts/sparse/spconvert.m, scripts/specfun/nthroot.m, scripts/strings/strmatch.m, scripts/strings/untabify.m, scripts/testfun/demo.m, scripts/testfun/example.m, src/DLD-FUNCTIONS/filter.cc, src/DLD-FUNCTIONS/mgorth.cc, src/DLD-FUNCTIONS/quadcc.cc, src/DLD-FUNCTIONS/str2double.cc, src/Makefile.a,msrc/gl-render.cc, src/gl2ps-renderer.cc, src/graphics.cc, src/octave-config.cc.in, src/octave-config.in, src/ov-class.h, src/ov-fcn.h, src/profiler.cc, src/profiler.h, src/pt-binop.cc, src/pt-unop.cc, src/symtab.cc, src/txt-eng-ft.cc: Remove trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Thu, 15 Sep 2011 12:51:10 -0400
parents fd0a3ac60b0e
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10508
diff changeset
1 c Copyright (C) 2009-2011 VZLU Prague, a.s., Czech Republic
9874
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
2 c
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
3 c Author: Jaroslav Hajek <highegg@gmail.com>
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
4 c
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
5 c This file is part of Octave.
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
6 c
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
7 c Octave is free software; you can redistribute it and/or modify
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
8 c it under the terms of the GNU General Public License as published by
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
9 c the Free Software Foundation; either version 3 of the License, or
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
10 c (at your option) any later version.
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
11 c
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
12 c This program is distributed in the hope that it will be useful,
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
13 c but WITHOUT ANY WARRANTY; without even the implied warranty of
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
14 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
15 c GNU General Public License for more details.
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
16 c
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
17 c You should have received a copy of the GNU General Public License
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
18 c along with this software; see the file COPYING. If not, see
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
19 c <http://www.gnu.org/licenses/>.
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
20 c
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
21 subroutine smatm3(m,n,k,np,a,b,c)
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
22 c purpose: a 3-dimensional matrix product.
9874
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
23 c given a (m,k,np) array a and (k,n,np) array b,
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
24 c calculates a (m,n,np) array c such that
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
25 c for i = 1:np
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
26 c c(:,:,i) = a(:,:,i) * b(:,:,i)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
27 c
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
28 c arguments:
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
29 c m,n,k (in) the dimensions
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
30 c np (in) number of multiplications
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
31 c a (in) a real input array, size (m,k,np)
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
32 c b (in) a real input array, size (k,n,np)
9874
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
33 c c (out) a real output array, size (m,n,np)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
34 integer m,n,k,np
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
35 real a(m*k,np),b(k*n,np)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
36 real c(m*n,np)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
37
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
38 real sdot,one,zero
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
39 parameter (one = 1e0, zero = 0e0)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
40 external sdot,sgemv,sgemm
10508
9a5e2d13fa5a fix typos in blas-xtra
Jaroslav Hajek <highegg@gmail.com>
parents: 9874
diff changeset
41 integer i
9874
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
42
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
43 c quick return if possible.
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
44 if (np <= 0) return
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
45
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
46 if (m == 1) then
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
47 if (n == 1) then
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
48 do i = 1,np
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
49 c(1,i) = sdot(k,a(1,i),1,b(1,i),1)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
50 end do
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
51 else
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
52 do i = 1,np
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
53 call sgemv("T",k,n,one,b(1,i),k,a(1,i),1,zero,c(1,i),1)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
54 end do
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
55 end if
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
56 else
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
57 if (n == 1) then
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
58 do i = 1,np
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
59 call sgemv("N",m,k,one,a(1,i),m,b(1,i),1,zero,c(1,i),1)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
60 end do
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
61 else
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
62 do i = 1,np
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
63 call sgemm("N","N",m,n,k,
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
64 + one,a(1,i),m,b(1,i),k,zero,c(1,i),m)
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
65 end do
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
66 end if
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
67 end if
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
68
90bc0cc4518f implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
69 end subroutine