GNU Octave  6.2.0
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-2021 The Octave Project Developers
2 c
3 c See the file COPYRIGHT.md in the top-level directory of this
4 c distribution or <https://octave.org/copyright/>.
5 c
6 c This file is part of Octave.
7 c
8 c Octave is free software: you can redistribute it and/or modify it
9 c under the terms of the GNU General Public License as published by
10 c the Free Software Foundation, either version 3 of the License, or
11 c (at your option) any later version.
12 c
13 c Octave is distributed in the hope that it will be useful, but
14 c WITHOUT ANY WARRANTY; without even the implied warranty of
15 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 c GNU General Public License for more details.
17 c
18 c You should have received a copy of the GNU General Public License
19 c along with Octave; see the file COPYING. If not, see
20 c <https://www.gnu.org/licenses/>.
21 c
22  subroutine sconv2o(ma,na,a,mb,nb,b,c)
23 c purpose: a 2-dimensional outer additive convolution.
24 c equivalent to the following:
25 c for i = 1:ma
26 c for j = 1:na
27 c c(i:i+mb-1,j:j+mb-1) += a(i,j)*b
28 c endfor
29 c endfor
30 c arguments:
31 c ma,na (in) dimensions of a
32 c a (in) 1st matrix
33 c mb,nb (in) dimensions of b
34 c b (in) 2nd matrix
35 c c (inout) accumulator matrix, size (ma+mb-1, na+nb-1)
36 c
37  integer ma,na,mb,nb
38  real a(ma,na),b(mb,nb)
39  real c(ma+mb-1,na+nb-1)
40  integer i,j,k
41  external saxpy
42  do k = 1,na
43  do j = 1,nb
44  do i = 1,mb
45  call saxpy(ma,b(i,j),a(1,k),1,c(i,j+k-1),1)
46  end do
47  end do
48  end do
49  end subroutine
50 
51  subroutine sconv2i(ma,na,a,mb,nb,b,c)
52 c purpose: a 2-dimensional inner additive convolution.
53 c equivalent to the following:
54 c for i = 1:ma-mb+1
55 c for j = 1:na-nb+1
56 c c(i,j) = sum (sum (a(i+mb-1:-1:i,j+nb-1:-1:j) .* b))
57 c endfor
58 c endfor
59 c arguments:
60 c ma,na (in) dimensions of a
61 c a (in) 1st matrix
62 c mb,nb (in) dimensions of b
63 c b (in) 2nd matrix
64 c c (inout) accumulator matrix, size (ma+mb-1, na+nb-1)
65 c
66  integer ma,na,mb,nb
67  real a(ma,na),b(mb,nb)
68  real c(ma-mb+1,na-nb+1)
69  integer i,j,k
70  external saxpy
71  do k = 1,na-nb+1
72  do j = 1,nb
73  do i = 1,mb
74  call saxpy(ma-mb+1,b(i,j),a(mb+1-i,k+nb-j),1,c(1,k),1)
75  end do
76  end do
77  end do
78  end subroutine
subroutine sconv2i(ma, na, a, mb, nb, b, c)
Definition: sconv2.f:52
subroutine sconv2o(ma, na, a, mb, nb, b, c)
Definition: sconv2.f:23