You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
350 lines
6.9 KiB
Fortran
350 lines
6.9 KiB
Fortran
19 years ago
|
!!$
|
||
|
!!$ Parallel Sparse BLAS v2.0
|
||
|
!!$ (C) Copyright 2006 Salvatore Filippone University of Rome Tor Vergata
|
||
|
!!$ Alfredo Buttari University of Rome Tor Vergata
|
||
|
!!$
|
||
|
!!$ Redistribution and use in source and binary forms, with or without
|
||
|
!!$ modification, are permitted provided that the following conditions
|
||
|
!!$ are met:
|
||
|
!!$ 1. Redistributions of source code must retain the above copyright
|
||
|
!!$ notice, this list of conditions and the following disclaimer.
|
||
|
!!$ 2. Redistributions in binary form must reproduce the above copyright
|
||
|
!!$ notice, this list of conditions, and the following disclaimer in the
|
||
|
!!$ documentation and/or other materials provided with the distribution.
|
||
|
!!$ 3. The name of the PSBLAS group or the names of its contributors may
|
||
|
!!$ not be used to endorse or promote products derived from this
|
||
|
!!$ software without specific written permission.
|
||
|
!!$
|
||
|
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
|
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||
|
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||
|
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
|
||
|
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||
|
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||
|
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||
|
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||
|
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||
|
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||
|
!!$ POSSIBILITY OF SUCH DAMAGE.
|
||
|
!!$
|
||
|
!!$
|
||
19 years ago
|
module psi_gthsct_mod
|
||
20 years ago
|
|
||
19 years ago
|
interface psi_gth
|
||
|
module procedure psi_igthm, psi_igthv,&
|
||
|
& psi_dgthm, psi_dgthv,&
|
||
|
& psi_zgthm, psi_zgthv
|
||
|
end interface
|
||
20 years ago
|
|
||
19 years ago
|
interface psi_sct
|
||
|
module procedure psi_isctm, psi_isctv,&
|
||
|
& psi_dsctm, psi_dsctv,&
|
||
|
& psi_zsctm, psi_zsctv
|
||
|
end interface
|
||
20 years ago
|
|
||
19 years ago
|
contains
|
||
18 years ago
|
|
||
19 years ago
|
subroutine psi_dgthm(n,k,idx,x,y)
|
||
20 years ago
|
|
||
19 years ago
|
implicit none
|
||
|
|
||
|
integer :: n, k, idx(:)
|
||
|
real(kind(1.d0)) :: x(:,:), y(:)
|
||
|
|
||
|
! Locals
|
||
|
integer :: i, j, pt
|
||
|
|
||
|
pt=0
|
||
|
do j=1,k
|
||
|
do i=1,n
|
||
20 years ago
|
pt=pt+1
|
||
|
y(pt)=x(idx(i),j)
|
||
19 years ago
|
end do
|
||
|
end do
|
||
20 years ago
|
|
||
19 years ago
|
end subroutine psi_dgthm
|
||
20 years ago
|
|
||
19 years ago
|
subroutine psi_dgthv(n,idx,x,y)
|
||
20 years ago
|
|
||
19 years ago
|
implicit none
|
||
20 years ago
|
|
||
19 years ago
|
integer :: n, idx(:)
|
||
|
real(kind(1.d0)) :: x(:), y(:)
|
||
20 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j
|
||
20 years ago
|
|
||
19 years ago
|
do i=1,n
|
||
|
y(i)=x(idx(i))
|
||
|
end do
|
||
20 years ago
|
|
||
19 years ago
|
end subroutine psi_dgthv
|
||
20 years ago
|
|
||
|
|
||
19 years ago
|
subroutine psi_dsctm(n,k,idx,x,beta,y)
|
||
20 years ago
|
|
||
19 years ago
|
implicit none
|
||
20 years ago
|
|
||
19 years ago
|
integer :: n, k, idx(:)
|
||
|
real(kind(1.d0)) :: beta, x(:), y(:,:)
|
||
20 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
20 years ago
|
|
||
19 years ago
|
if (beta.eq.0.d0) then
|
||
|
pt=0
|
||
|
do j=1,k
|
||
20 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = x(pt)
|
||
20 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
else if (beta.eq.1.d0) then
|
||
|
pt=0
|
||
|
do j=1,k
|
||
20 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = y(idx(i),j)+x(pt)
|
||
20 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
else
|
||
|
pt=0
|
||
|
do j=1,k
|
||
20 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = beta*y(idx(i),j)+x(pt)
|
||
20 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
end if
|
||
|
end subroutine psi_dsctm
|
||
20 years ago
|
|
||
19 years ago
|
subroutine psi_dsctv(n,idx,x,beta,y)
|
||
|
|
||
|
implicit none
|
||
20 years ago
|
|
||
18 years ago
|
integer :: n, k, idx(:)
|
||
19 years ago
|
real(kind(1.d0)) :: beta, x(:), y(:)
|
||
20 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
20 years ago
|
|
||
19 years ago
|
if (beta.eq.0.d0) then
|
||
|
do i=1,n
|
||
20 years ago
|
y(idx(i)) = x(i)
|
||
19 years ago
|
end do
|
||
|
else if (beta.eq.1.d0) then
|
||
|
do i=1,n
|
||
20 years ago
|
y(idx(i)) = y(idx(i))+x(i)
|
||
19 years ago
|
end do
|
||
|
else
|
||
|
do i=1,n
|
||
20 years ago
|
y(idx(i)) = beta*y(idx(i))+x(i)
|
||
19 years ago
|
end do
|
||
|
end if
|
||
|
end subroutine psi_dsctv
|
||
20 years ago
|
|
||
|
|
||
19 years ago
|
subroutine psi_igthm(n,k,idx,x,y)
|
||
20 years ago
|
|
||
19 years ago
|
implicit none
|
||
20 years ago
|
|
||
19 years ago
|
integer :: n, k, idx(:)
|
||
|
integer :: x(:,:), y(:)
|
||
20 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
20 years ago
|
|
||
19 years ago
|
pt=0
|
||
|
do j=1,k
|
||
|
do i=1,n
|
||
20 years ago
|
pt=pt+1
|
||
|
y(pt)=x(idx(i),j)
|
||
19 years ago
|
end do
|
||
|
end do
|
||
20 years ago
|
|
||
19 years ago
|
end subroutine psi_igthm
|
||
20 years ago
|
|
||
|
|
||
19 years ago
|
subroutine psi_igthv(n,idx,x,y)
|
||
20 years ago
|
|
||
19 years ago
|
implicit none
|
||
20 years ago
|
|
||
19 years ago
|
integer :: n, idx(:)
|
||
|
integer :: x(:), y(:)
|
||
20 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j
|
||
20 years ago
|
|
||
19 years ago
|
do i=1,n
|
||
|
y(i)=x(idx(i))
|
||
|
end do
|
||
20 years ago
|
|
||
19 years ago
|
end subroutine psi_igthv
|
||
20 years ago
|
|
||
|
|
||
|
|
||
19 years ago
|
subroutine psi_isctm(n,k,idx,x,beta,y)
|
||
|
|
||
|
implicit none
|
||
|
|
||
|
integer :: n, k, idx(:)
|
||
|
integer :: beta, x(:), y(:,:)
|
||
20 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
20 years ago
|
|
||
19 years ago
|
if (beta.eq.0.d0) then
|
||
|
pt=0
|
||
|
do j=1,k
|
||
20 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = x(pt)
|
||
20 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
else if (beta.eq.1.d0) then
|
||
|
pt=0
|
||
|
do j=1,k
|
||
20 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = y(idx(i),j)+x(pt)
|
||
20 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
else
|
||
|
pt=0
|
||
|
do j=1,k
|
||
20 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = beta*y(idx(i),j)+x(pt)
|
||
20 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
end if
|
||
|
end subroutine psi_isctm
|
||
20 years ago
|
|
||
19 years ago
|
subroutine psi_isctv(n,idx,x,beta,y)
|
||
20 years ago
|
|
||
19 years ago
|
implicit none
|
||
20 years ago
|
|
||
19 years ago
|
integer :: n, k, idx(:)
|
||
|
integer :: beta, x(:), y(:)
|
||
20 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
20 years ago
|
|
||
19 years ago
|
if (beta.eq.0.d0) then
|
||
|
do i=1,n
|
||
20 years ago
|
y(idx(i)) = x(i)
|
||
19 years ago
|
end do
|
||
|
else if (beta.eq.1.d0) then
|
||
|
do i=1,n
|
||
20 years ago
|
y(idx(i)) = y(idx(i))+x(i)
|
||
19 years ago
|
end do
|
||
|
else
|
||
|
do i=1,n
|
||
20 years ago
|
y(idx(i)) = beta*y(idx(i))+x(i)
|
||
19 years ago
|
end do
|
||
|
end if
|
||
|
end subroutine psi_isctv
|
||
19 years ago
|
|
||
|
|
||
19 years ago
|
subroutine psi_zgthm(n,k,idx,x,y)
|
||
19 years ago
|
|
||
19 years ago
|
implicit none
|
||
19 years ago
|
|
||
19 years ago
|
integer :: n, k, idx(:)
|
||
|
complex(kind(1.d0)) :: x(:,:), y(:)
|
||
19 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
19 years ago
|
|
||
19 years ago
|
pt=0
|
||
|
do j=1,k
|
||
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(pt)=x(idx(i),j)
|
||
19 years ago
|
end do
|
||
|
end do
|
||
19 years ago
|
|
||
19 years ago
|
end subroutine psi_zgthm
|
||
19 years ago
|
|
||
|
|
||
19 years ago
|
subroutine psi_zgthv(n,idx,x,y)
|
||
19 years ago
|
|
||
19 years ago
|
implicit none
|
||
19 years ago
|
|
||
19 years ago
|
integer :: n, idx(:)
|
||
|
complex(kind(1.d0)) :: x(:), y(:)
|
||
19 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j
|
||
19 years ago
|
|
||
19 years ago
|
do i=1,n
|
||
|
y(i)=x(idx(i))
|
||
|
end do
|
||
19 years ago
|
|
||
19 years ago
|
end subroutine psi_zgthv
|
||
19 years ago
|
|
||
19 years ago
|
subroutine psi_zsctm(n,k,idx,x,beta,y)
|
||
19 years ago
|
|
||
19 years ago
|
implicit none
|
||
19 years ago
|
|
||
19 years ago
|
integer :: n, k, idx(:)
|
||
|
complex(kind(1.d0)) :: beta, x(:), y(:,:)
|
||
19 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
19 years ago
|
|
||
19 years ago
|
if (beta.eq.0.d0) then
|
||
|
pt=0
|
||
|
do j=1,k
|
||
19 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = x(pt)
|
||
19 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
else if (beta.eq.1.d0) then
|
||
|
pt=0
|
||
|
do j=1,k
|
||
19 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = y(idx(i),j)+x(pt)
|
||
19 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
else
|
||
|
pt=0
|
||
|
do j=1,k
|
||
19 years ago
|
do i=1,n
|
||
19 years ago
|
pt=pt+1
|
||
|
y(idx(i),j) = beta*y(idx(i),j)+x(pt)
|
||
19 years ago
|
end do
|
||
19 years ago
|
end do
|
||
|
end if
|
||
|
end subroutine psi_zsctm
|
||
19 years ago
|
|
||
|
|
||
19 years ago
|
subroutine psi_zsctv(n,idx,x,beta,y)
|
||
19 years ago
|
|
||
19 years ago
|
implicit none
|
||
19 years ago
|
|
||
19 years ago
|
integer :: n, k, idx(:)
|
||
|
complex(kind(1.d0)) :: beta, x(:), y(:)
|
||
19 years ago
|
|
||
19 years ago
|
! Locals
|
||
|
integer :: i, j, pt
|
||
|
|
||
|
if (beta.eq.0.d0) then
|
||
|
do i=1,n
|
||
19 years ago
|
y(idx(i)) = x(i)
|
||
19 years ago
|
end do
|
||
|
else if (beta.eq.1.d0) then
|
||
|
do i=1,n
|
||
19 years ago
|
y(idx(i)) = y(idx(i))+x(i)
|
||
19 years ago
|
end do
|
||
|
else
|
||
|
do i=1,n
|
||
19 years ago
|
y(idx(i)) = beta*y(idx(i))+x(i)
|
||
19 years ago
|
end do
|
||
|
end if
|
||
|
end subroutine psi_zsctv
|
||
|
|
||
|
end module psi_gthsct_mod
|