dotpmc Subroutine

public subroutine dotpmc(x, ix, y, iy, c, total, n, iflag)

Calculates +/-C +/- (X.dot.Y) for arrays X, Y and scalar C author: Roger L. Crane, Kenneth E. Hillstrom, Michael Minkoff; Linpack author: P J Knight, CCFE, Culham Science Centre x(ixn) : input real array : X array ix : input integer : interval in storage between X array elements y(iyn) : input real array : Y array iy : input integer : interval in storage between Y array elements c : input real : C value total : output real : computed result n : input integer : number of terms in the dot product iflag : input integer : switch = 0 +c + (x dot y) is computed = 1 +c - (x dot y) is computed = 2 -c + (x dot y) is computed = 3 -c - (x dot y) is computed This subroutine computes total = (plus or minus c) plus or minus the dot product of x and y by invoking the basic linear algebra routine dot. !

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in), dimension(:):: x
integer, intent(in) :: ix
real(kind=dp), intent(in), dimension(:):: y
integer, intent(in) :: iy
real(kind=dp), intent(in) :: c
real(kind=dp), intent(out) :: total
integer, intent(in) :: n
integer, intent(in) :: iflag

Contents

Source Code


Source Code

  subroutine dotpmc(x,ix,y,iy,c,total,n,iflag)

    !! Calculates +/-C +/- (X.dot.Y) for arrays X, Y and scalar C
    !! author: Roger L. Crane, Kenneth E. Hillstrom, Michael Minkoff; Linpack
    !! author: P J Knight, CCFE, Culham Science Centre
    !! x(ix*n) : input real array : X array
    !! ix      : input integer : interval in storage between X array elements
    !! y(iy*n) : input real array : Y array
    !! iy      : input integer : interval in storage between Y array elements
    !! c       : input real : C value
    !! total   : output real : computed result
    !! n       : input integer : number of terms in the dot product
    !! iflag   : input integer : switch
    !! = 0    +c + (x dot y) is computed
    !! = 1    +c - (x dot y) is computed
    !! = 2    -c + (x dot y) is computed
    !! = 3    -c - (x dot y) is computed
    !! This subroutine computes
    !! total = (plus or minus c) plus or minus the dot product of x and y
    !! by invoking the basic linear algebra routine dot.
    !!     !
    ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    implicit none

    !  Arguments

    integer, intent(in) :: ix,iy,n,iflag
    real(dp), dimension(:), intent(in) :: x
    real(dp), dimension(:), intent(in) :: y
    real(dp), intent(in) :: c
    real(dp), intent(out) :: total

    !  Local variables

    real(dp) :: prod

    ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    !  Calculate dot product

    prod = sdot(n,x,ix,y,iy)
    if (mod(iflag,2) /= 0) prod = -prod

    total = c + prod
    if (iflag > 1) total = -c + prod

  end subroutine dotpmc