GNU Octave
4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
sdot3.f
Go to the documentation of this file.
1
c Copyright (C) 2009-2018 VZLU Prague, a.s., Czech Republic
2
c
3
c Author: Jaroslav Hajek <highegg@gmail.com>
4
c
5
c This file is part of Octave.
6
c
7
c Octave is free software: you can redistribute it and/or modify it
8
c under the terms of the GNU General Public License as published by
9
c the Free Software Foundation, either version 3 of the License, or
10
c (at your option) any later version.
11
c
12
c Octave is distributed in the hope that it will be useful, but
13
c WITHOUT ANY WARRANTY; without even the implied warranty of
14
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
c GNU General Public License for more details.
16
c
17
c You should have received a copy of the GNU General Public License
18
c along with Octave; see the file COPYING. If not, see
19
c <https://www.gnu.org/licenses/>.
20
c
21
subroutine
sdot3
(m,n,k,a,b,c)
22
c purpose: a 3-dimensional dot product.
23
c c = sum (a .* b, 2), where a and b are 3d arrays.
24
c arguments:
25
c m,n,k (in) the dimensions of a and b
26
c a,b (in) real input arrays of size (m,k,n)
27
c c (out) real output array, size (m,n)
28
integer
m,n,k,i,j,l
29
real
a(m,k,n),b(m,k,n)
30
real
c(m,n)
31
32
real
sdot
33
external
sdot
34
35
c quick return if possible.
36
if
(m <= 0 .or. n <= 0)
return
37
38
if
(m == 1)
then
39
c the column-major case.
40
do
j = 1,n
41
c(1,j) = sdot(k,a(1,1,j),1,b(1,1,j),1)
42
end do
43
else
44
c We prefer performance here, because that's what we generally
45
c do by default in reduction functions. Besides, the accuracy
46
c of xDOT is questionable. Hence, do a cache-aligned nested loop.
47
do
j = 1,n
48
do
i = 1,m
49
c(i,j) = 0d0
50
end do
51
do
l = 1,k
52
do
i = 1,m
53
c(i,j) = c(i,j) + a(i,l,j)*b(i,l,j)
54
end do
55
end do
56
end do
57
end if
58
59
end subroutine
sdot3
subroutine sdot3(m, n, k, a, b, c)
Definition:
sdot3.f:22
liboctave
external
blas-xtra
sdot3.f
Generated on Sat Sep 1 2018 14:01:45 for GNU Octave by
1.8.14