File: zgerci.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 (47 lines) | stat: -rw-r--r-- 1,119 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

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

subroutine zgerci(m,n,x,y,ld,a)
use modomp
implicit none
! arguments
integer, intent(in) :: m,n
complex(8), intent(in) :: x(m),y(n)
integer, intent(in) :: ld
complex(8), intent(inout) :: a(ld,*)
! local variables
integer j,nthd
! numbers less than eps are considered to be zero
real(8), parameter :: eps=1.d-10
real(8) a1,b1
complex(8) z1
call omp_hold(n,nthd)
!$OMP PARALLEL DEFAULT(SHARED) &
!$OMP PRIVATE(z1,a1,b1) &
!$OMP NUM_THREADS(nthd)
!$OMP DO
do j=1,n
  z1=y(j)
  if (abs(dble(z1)).gt.eps) then
    if (abs(aimag(z1)).gt.eps) then
! complex prefactor
      call zaxpy(m,z1,x,1,a(:,j),1)
    else
! real prefactor
      a1=dble(z1)
      call daxpy(2*m,a1,x,1,a(:,j),1)
    end if
  else if (abs(aimag(z1)).gt.eps) then
! imaginary prefactor
    b1=aimag(z1)
    a(1:m,j)=a(1:m,j)+b1*cmplx(-aimag(x(1:m)),dble(x(1:m)),8)
  end if
end do
!$OMP END DO
!$OMP END PARALLEL
call omp_free(nthd)
return
end subroutine