File: ztpmm.f90

package info (click to toggle)
elkcode 5.4.24-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 12,840 kB
  • sloc: f90: 48,415; fortran: 22,457; perl: 965; makefile: 384; sh: 369; python: 105; ansic: 67
file content (49 lines) | stat: -rw-r--r-- 1,470 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

! Copyright (C) 2016 T. Mueller, J. K. Dewhurst, S. Sharma and E. K. U. Gross.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

!BOP
! !ROUTINE: ztpmm
! !INTERFACE:
subroutine ztpmm(m,n,a,b,c)
! !INPUT/OUTPUT PARAMETERS:
!   m : order of matrix A (in,integer)
!   n : order of matrix B (in,integer)
!   a : matrix A (in,complex(m,m))
!   b : matrix B (in,complex(n,n))
!   c : matrix C (inout,complex(m*n,m*n))
! !DESCRIPTION:
!   Performs an in-place multiplication of a matrix tensor product with another
!   matrix:
!   $$ C\rightarrow (A\otimes B)C, $$
!   where $A$, $B$ and $C$ are $m\times m$, $n\times n$ and $mn\times mn$
!   general complex matrices, respectively. This is done most efficiently by
!   considering each column of the matrix $C$ as an $m\times n$ matrix $D$,
!   performing the multiplication $BDA^t$ and replacing the column of $C$ with
!   the result.
!
! !REVISION HISTORY:
!   Created December 2016 (TM,JKD)
!EOP
!BOC
implicit none
! arguments
integer, intent(in) :: m,n
complex(8), intent(in) :: a(m,m),b(n,n)
complex(8), intent(inout) :: c(m*n,*)
! local variables
integer j
complex(8), parameter :: z0=(0.d0,0.d0),z1=(1.d0,0.d0)
! allocatable arrays
complex(8), allocatable :: d(:,:)
allocate(d(n,m))
do j=1,m*n
  call zgemm('N','N',n,m,n,z1,b,n,c(:,j),n,z0,d,n)
  call zgemm('N','T',n,m,m,z1,d,n,a,m,z0,c(:,j),n)
end do
deallocate(d)
return
end subroutine
!EOC