GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
csconv2.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 csconv2o(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  complex a(ma,na)
39  real b(mb,nb)
40  complex c(ma+mb-1,na+nb-1)
41  complex btmp
42  integer i,j,k
43  external caxpy
44  do k = 1,na
45  do j = 1,nb
46  do i = 1,mb
47  btmp = b(i,j)
48  call caxpy(ma,btmp,a(1,k),1,c(i,j+k-1),1)
49  end do
50  end do
51  end do
52  end subroutine
53 
54  subroutine csconv2i(ma,na,a,mb,nb,b,c)
55 c purpose: a 2-dimensional inner additive convolution.
56 c equivalent to the following:
57 c for i = 1:ma-mb+1
58 c for j = 1:na-nb+1
59 c c(i,j) = sum (sum (a(i:i+mb-1,j:j+nb-1) .* b))
60 c endfor
61 c endfor
62 c arguments:
63 c ma,na (in) dimensions of a
64 c a (in) 1st matrix
65 c mb,nb (in) dimensions of b
66 c b (in) 2nd matrix
67 c c (inout) accumulator matrix, size (ma+mb-1, na+nb-1)
68 c
69  integer ma,na,mb,nb
70  complex a(ma,na)
71  real b(mb,nb)
72  complex c(ma-mb+1,na-nb+1)
73  complex btmp
74  integer i,j,k
75  external caxpy
76  do k = 1,na-nb+1
77  do j = 1,nb
78  do i = 1,mb
79  btmp = b(i,j)
80  call caxpy(ma-mb+1,btmp,a(mb+1-i,k+nb-j),1,c(1,k),1)
81  end do
82  end do
83  end do
84  end subroutine
subroutine csconv2o(ma, na, a, mb, nb, b, c)
Definition: csconv2.f:23
subroutine csconv2i(ma, na, a, mb, nb, b, c)
Definition: csconv2.f:55