Mercurial > octave
annotate liboctave/external/blas-xtra/cdotc3.f @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
1 c Copyright (C) 2009-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
2 c |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
3 c See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 c or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
5 c |
9874
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 Author: Jaroslav Hajek <highegg@gmail.com> |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
8 c |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
9 c This file is part of Octave. |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
10 c |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23434
diff
changeset
|
11 c Octave is free software: you can redistribute it and/or modify it |
22802
0dcff7695e26
maint: Update more Copyright statements to use standard form.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 c under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23434
diff
changeset
|
13 c the Free Software Foundation, either version 3 of the License, or |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
14 c (at your option) any later version. |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
15 c |
22802
0dcff7695e26
maint: Update more Copyright statements to use standard form.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 c Octave is distributed in the hope that it will be useful, but |
0dcff7695e26
maint: Update more Copyright statements to use standard form.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 c WITHOUT ANY WARRANTY; without even the implied warranty of |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
18 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
19 c GNU General Public License for more details. |
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 c You should have received a copy of the GNU General Public License |
22802
0dcff7695e26
maint: Update more Copyright statements to use standard form.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
22 c along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23434
diff
changeset
|
23 c <https://www.gnu.org/licenses/>. |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
24 c |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
25 subroutine cdotc3(m,n,k,a,b,c) |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
26 c purpose: a 3-dimensional dot product. |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
27 c c = sum (conj (a) .* b, 2), where a and b are 3d arrays. |
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 of a and b |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
30 c a,b (in) complex input arrays of size (m,k,n) |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
31 c c (out) complex output array, size (m,n) |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
32 integer m,n,k,i,j,l |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
33 complex a(m,k,n),b(m,k,n) |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
34 complex c(m,n) |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
35 |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
36 complex cdotc |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
37 external cdotc |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
38 |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
39 c quick return if possible. |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
40 if (m <= 0 .or. n <= 0) return |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
41 |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
42 if (m == 1) then |
9876
21d81d06b221
cache-aligned loop for rowwise dot
Jaroslav Hajek <highegg@gmail.com>
parents:
9874
diff
changeset
|
43 c the column-major case. |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
44 do j = 1,n |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
45 c(1,j) = cdotc(k,a(1,1,j),1,b(1,1,j),1) |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
46 end do |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
47 else |
9876
21d81d06b221
cache-aligned loop for rowwise dot
Jaroslav Hajek <highegg@gmail.com>
parents:
9874
diff
changeset
|
48 c We prefer performance here, because that's what we generally |
21d81d06b221
cache-aligned loop for rowwise dot
Jaroslav Hajek <highegg@gmail.com>
parents:
9874
diff
changeset
|
49 c do by default in reduction functions. Besides, the accuracy |
21d81d06b221
cache-aligned loop for rowwise dot
Jaroslav Hajek <highegg@gmail.com>
parents:
9874
diff
changeset
|
50 c of xDOT is questionable. Hence, do a cache-aligned nested loop. |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
51 do j = 1,n |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
52 do i = 1,m |
9876
21d81d06b221
cache-aligned loop for rowwise dot
Jaroslav Hajek <highegg@gmail.com>
parents:
9874
diff
changeset
|
53 c(i,j) = 0e0 |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
54 end do |
9876
21d81d06b221
cache-aligned loop for rowwise dot
Jaroslav Hajek <highegg@gmail.com>
parents:
9874
diff
changeset
|
55 do l = 1,k |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
56 do i = 1,m |
9876
21d81d06b221
cache-aligned loop for rowwise dot
Jaroslav Hajek <highegg@gmail.com>
parents:
9874
diff
changeset
|
57 c(i,j) = c(i,j) + conjg(a(i,l,j))*b(i,l,j) |
9874
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
58 end do |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
59 end do |
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 end if |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
62 |
90bc0cc4518f
implement compiled dot and blkmm
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
63 end subroutine |