zdconv2.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 zdconv2o(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 complex a(ma,na)
00038       double precision b(mb,nb)
00039       double complex c(ma+mb-1,na+nb-1)
00040       double complex btmp
00041       integer i,j,k
00042       external zaxpy
00043       do k = 1,na
00044         do j = 1,nb
00045           do i = 1,mb
00046             btmp = b(i,j)
00047             call zaxpy(ma,btmp,a(1,k),1,c(i,j+k-1),1)
00048           end do
00049         end do
00050       end do
00051       end subroutine
00052 
00053       subroutine zdconv2i(ma,na,a,mb,nb,b,c)
00054 c purpose:      a 2-dimensional inner additive convolution.
00055 c               equivalent to the following:
00056 c                 for i = 1:ma-mb+1
00057 c                   for j = 1:na-nb+1
00058 c                     c(i,j) = sum (sum (a(i:i+mb-1,j:j+nb-1) .* b))
00059 c                   endfor
00060 c                 endfor
00061 c arguments:
00062 c ma,na (in)    dimensions of a
00063 c a (in)        1st matrix
00064 c mb,nb (in)    dimensions of b
00065 c b (in)        2nd matrix
00066 c c (inout)     accumulator matrix, size (ma+mb-1, na+nb-1)
00067 c
00068       integer ma,na,mb,nb
00069       double complex a(ma,na)
00070       double precision b(mb,nb)
00071       double complex c(ma-mb+1,na-nb+1)
00072       double complex btmp
00073       integer i,j,k
00074       external zaxpy
00075       do k = 1,na-nb+1
00076         do j = 1,nb
00077           do i = 1,mb
00078             btmp = b(i,j)
00079             call zaxpy(ma-mb+1,btmp,a(mb+1-i,k+nb-j),1,c(1,k),1)
00080           end do
00081         end do
00082       end do
00083       end subroutine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines