dconv2.f

Go to the documentation of this file.
00001 c Copyright (C) 2010-2012  VZLU Prague, a.s., Czech Republic
00002 c
00003 c Author: Jaroslav Hajek <highegg@gmail.com>
00004 c
00005 c This file is part of Octave.
00006 c
00007 c Octave is free software; you can redistribute it and/or modify
00008 c it under the terms of the GNU General Public License as published by
00009 c the Free Software Foundation; either version 3 of the License, or
00010 c (at your option) any later version.
00011 c
00012 c This program is distributed in the hope that it will be useful,
00013 c but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 c GNU General Public License for more details.
00016 c
00017 c You should have received a copy of the GNU General Public License
00018 c along with this software; see the file COPYING.  If not, see
00019 c <http://www.gnu.org/licenses/>.
00020 c
00021       subroutine dconv2o(ma,na,a,mb,nb,b,c)
00022 c purpose:      a 2-dimensional outer additive convolution.
00023 c               equivalent to the following:
00024 c                 for i = 1:ma
00025 c                   for j = 1:na
00026 c                     c(i:i+mb-1,j:j+mb-1) += a(i,j)*b
00027 c                   endfor
00028 c                 endfor
00029 c arguments:
00030 c ma,na (in)    dimensions of a
00031 c a (in)        1st matrix
00032 c mb,nb (in)    dimensions of b
00033 c b (in)        2nd matrix
00034 c c (inout)     accumulator matrix, size (ma+mb-1, na+nb-1)
00035 c
00036       integer ma,na,mb,nb
00037       double precision a(ma,na),b(mb,nb)
00038       double precision c(ma+mb-1,na+nb-1)
00039       integer i,j,k
00040       external daxpy
00041       do k = 1,na
00042         do j = 1,nb
00043           do i = 1,mb
00044             call daxpy(ma,b(i,j),a(1,k),1,c(i,j+k-1),1)
00045           end do
00046         end do
00047       end do
00048       end subroutine
00049 
00050       subroutine dconv2i(ma,na,a,mb,nb,b,c)
00051 c purpose:      a 2-dimensional inner additive convolution.
00052 c               equivalent to the following:
00053 c                 for i = 1:ma-mb+1
00054 c                   for j = 1:na-nb+1
00055 c                     c(i,j) = sum (sum (a(i+mb-1:-1:i,j+nb-1:-1:j) .* b))
00056 c                   endfor
00057 c                 endfor
00058 c arguments:
00059 c ma,na (in)    dimensions of a
00060 c a (in)        1st matrix
00061 c mb,nb (in)    dimensions of b
00062 c b (in)        2nd matrix
00063 c c (inout)     accumulator matrix, size (ma+mb-1, na+nb-1)
00064 c
00065       integer ma,na,mb,nb
00066       double precision a(ma,na),b(mb,nb)
00067       double precision c(ma-mb+1,na-nb+1)
00068       integer i,j,k
00069       external daxpy
00070       do k = 1,na-nb+1
00071         do j = 1,nb
00072           do i = 1,mb
00073             call daxpy(ma-mb+1,b(i,j),a(mb+1-i,k+nb-j),1,c(1,k),1)
00074           end do
00075         end do
00076       end do
00077       end subroutine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines