GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
sconv2.f
Go to the documentation of this file.
1 c Copyright (C) 2010-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 sconv2o(ma,na,a,mb,nb,b,c)
22 c purpose: a 2-dimensional outer additive convolution.
23 c equivalent to the following:
24 c for i = 1:ma
25 c for j = 1:na
26 c c(i:i+mb-1,j:j+mb-1) += a(i,j)*b
27 c endfor
28 c endfor
29 c arguments:
30 c ma,na (in) dimensions of a
31 c a (in) 1st matrix
32 c mb,nb (in) dimensions of b
33 c b (in) 2nd matrix
34 c c (inout) accumulator matrix, size (ma+mb-1, na+nb-1)
35 c
36  integer ma,na,mb,nb
37  real a(ma,na),b(mb,nb)
38  real c(ma+mb-1,na+nb-1)
39  integer i,j,k
40  external saxpy
41  do k = 1,na
42  do j = 1,nb
43  do i = 1,mb
44  call saxpy(ma,b(i,j),a(1,k),1,c(i,j+k-1),1)
45  end do
46  end do
47  end do
48  end subroutine
49 
50  subroutine sconv2i(ma,na,a,mb,nb,b,c)
51 c purpose: a 2-dimensional inner additive convolution.
52 c equivalent to the following:
53 c for i = 1:ma-mb+1
54 c for j = 1:na-nb+1
55 c c(i,j) = sum (sum (a(i+mb-1:-1:i,j+nb-1:-1:j) .* b))
56 c endfor
57 c endfor
58 c arguments:
59 c ma,na (in) dimensions of a
60 c a (in) 1st matrix
61 c mb,nb (in) dimensions of b
62 c b (in) 2nd matrix
63 c c (inout) accumulator matrix, size (ma+mb-1, na+nb-1)
64 c
65  integer ma,na,mb,nb
66  real a(ma,na),b(mb,nb)
67  real c(ma-mb+1,na-nb+1)
68  integer i,j,k
69  external saxpy
70  do k = 1,na-nb+1
71  do j = 1,nb
72  do i = 1,mb
73  call saxpy(ma-mb+1,b(i,j),a(mb+1-i,k+nb-j),1,c(1,k),1)
74  end do
75  end do
76  end do
77  end subroutine
subroutine sconv2o(ma, na, a, mb, nb, b, c)
Definition: sconv2.f:22
subroutine sconv2i(ma, na, a, mb, nb, b, c)
Definition: sconv2.f:51