Implementex axpby for single column of multivect

anderson
Cirdans-Home 1 year ago
parent 301528e9d9
commit 614dc53dbd

@ -33,6 +33,7 @@ module psb_c_psblas_mod
use psb_desc_mod, only : psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_
use psb_c_vect_mod, only : psb_c_vect_type
use psb_c_mat_mod, only : psb_cspmat_type
use psb_c_multivect_mod, only: psb_c_multivect_type
interface psb_gedot
function psb_cdot_vect(x, y, desc_a,info,global) result(res)
@ -141,6 +142,17 @@ module psb_c_psblas_mod
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
end subroutine psb_caxpby
subroutine psb_caxpby_multivect_vect(alpha, x, beta, y,&
& j, desc_a, info)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type, psb_c_multivect_type
type(psb_c_vect_type), intent (inout) :: x
type(psb_c_multivect_type), intent (inout) :: y
complex(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_caxpby_multivect_vect
end interface
interface psb_geamax

@ -33,6 +33,7 @@ module psb_d_psblas_mod
use psb_desc_mod, only : psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_
use psb_d_vect_mod, only : psb_d_vect_type
use psb_d_mat_mod, only : psb_dspmat_type
use psb_d_multivect_mod, only: psb_d_multivect_type
interface psb_gedot
function psb_ddot_vect(x, y, desc_a,info,global) result(res)
@ -141,6 +142,16 @@ module psb_d_psblas_mod
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
end subroutine psb_daxpby
subroutine psb_daxpby_multivect_vect(alpha, x, beta, y, j, desc_a, info)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type, psb_d_multivect_type
type(psb_d_vect_type), intent (inout) :: x
type(psb_d_multivect_type), intent (inout) :: y
real(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_daxpby_multivect_vect
end interface
interface psb_geamax

@ -33,6 +33,7 @@ module psb_s_psblas_mod
use psb_desc_mod, only : psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_
use psb_s_vect_mod, only : psb_s_vect_type
use psb_s_mat_mod, only : psb_sspmat_type
use psb_s_multivect_mod, only: psb_s_multivect_type
interface psb_gedot
function psb_sdot_vect(x, y, desc_a,info,global) result(res)
@ -141,6 +142,17 @@ module psb_s_psblas_mod
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
end subroutine psb_saxpby
subroutine psb_saxpby_multivect_vect(alpha, x, beta, y,&
& j, desc_a, info)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type, psb_s_multivect_type
type(psb_s_vect_type), intent (inout) :: x
type(psb_s_multivect_type), intent (inout) :: y
real(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_saxpby_multivect_vect
end interface
interface psb_geamax

@ -33,6 +33,7 @@ module psb_z_psblas_mod
use psb_desc_mod, only : psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_
use psb_z_vect_mod, only : psb_z_vect_type
use psb_z_mat_mod, only : psb_zspmat_type
use psb_z_multivect_mod, only: psb_z_multivect_type
interface psb_gedot
function psb_zdot_vect(x, y, desc_a,info,global) result(res)
@ -141,6 +142,17 @@ module psb_z_psblas_mod
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
end subroutine psb_zaxpby
subroutine psb_zaxpby_multivect_vect(alpha, x, beta, y,&
& j, desc_a, info)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type, psb_z_multivect_type
type(psb_z_vect_type), intent (inout) :: x
type(psb_z_multivect_type), intent (inout) :: y
complex(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_zaxpby_multivect_vect
end interface
interface psb_geamax

@ -2070,8 +2070,9 @@ module psb_c_base_multivect_mod
procedure, pass(x) :: dot_a => c_base_mlv_dot_a
generic, public :: dot => dot_v, dot_a
procedure, pass(y) :: axpby_v => c_base_mlv_axpby_v
procedure, pass(y) :: axpby_vv => c_base_mlv_axpby_vv
procedure, pass(y) :: axpby_a => c_base_mlv_axpby_a
generic, public :: axpby => axpby_v, axpby_a
generic, public :: axpby => axpby_v, axpby_a, axpby_vv
!
! MultiVector by vector/multivector multiplication. Need all variants
! to handle multiple requirements from preconditioners
@ -2728,6 +2729,35 @@ contains
end subroutine c_base_mlv_axpby_v
!
! AXPBY is invoked via Y, hence the structure below.
!
!
!
!> Function base_mlv_axpby_v
!! \memberof psb_c_base_multivect_type
!! \brief AXPBY by a (base_mlv_vect) y(j)=alpha*x+beta*y(j)
!! \param m Number of entries to be considered
!! \param alpha scalar alpha
!! \param x The class(base_v_vect) to be added
!! \param beta scalar alpha
!! \param j to what column of the multivector should we add
!! \param info return code
!!
subroutine c_base_mlv_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_c_base_vect_type), intent(inout) :: x
class(psb_c_base_multivect_type), intent(inout) :: y
complex(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
call psb_geaxpby(m,alpha,x%v,beta,y%v(:,j),info)
end subroutine c_base_mlv_axpby_vv
!
! AXPBY is invoked via Y, hence the structure below.
!

@ -1316,6 +1316,8 @@ module psb_c_multivect_mod
!!$ procedure, pass(x) :: nrm2 => c_vect_nrm2
!!$ procedure, pass(x) :: amax => c_vect_amax
!!$ procedure, pass(x) :: asum => c_vect_asum
procedure, pass(y) :: axpby_vv => c_vect_axpby_vv
generic, public :: axpby => axpby_vv
end type psb_c_multivect_type
public :: psb_c_multivect, psb_c_multivect_type,&
@ -1769,6 +1771,24 @@ contains
!!$
!!$ end subroutine c_vect_axpby_v
!!$
subroutine c_vect_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
use psb_c_vect_mod
implicit none
integer(psb_ipk_), intent(in) :: m
type(psb_c_vect_type), intent(inout) :: x
class(psb_c_multivect_type), intent(inout) :: y
complex(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,j,info)
else
info = psb_err_invalid_vect_state_
end if
end subroutine c_vect_axpby_vv
!!$ subroutine c_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none

@ -2249,8 +2249,9 @@ module psb_d_base_multivect_mod
procedure, pass(x) :: dot_a => d_base_mlv_dot_a
generic, public :: dot => dot_v, dot_a
procedure, pass(y) :: axpby_v => d_base_mlv_axpby_v
procedure, pass(y) :: axpby_vv => d_base_mlv_axpby_vv
procedure, pass(y) :: axpby_a => d_base_mlv_axpby_a
generic, public :: axpby => axpby_v, axpby_a
generic, public :: axpby => axpby_v, axpby_a, axpby_vv
!
! MultiVector by vector/multivector multiplication. Need all variants
! to handle multiple requirements from preconditioners
@ -2907,6 +2908,35 @@ contains
end subroutine d_base_mlv_axpby_v
!
! AXPBY is invoked via Y, hence the structure below.
!
!
!
!> Function base_mlv_axpby_v
!! \memberof psb_d_base_multivect_type
!! \brief AXPBY by a (base_mlv_vect) y(j)=alpha*x+beta*y(j)
!! \param m Number of entries to be considered
!! \param alpha scalar alpha
!! \param x The class(base_v_vect) to be added
!! \param beta scalar alpha
!! \param j to what column of the multivector should we add
!! \param info return code
!!
subroutine d_base_mlv_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_d_base_vect_type), intent(inout) :: x
class(psb_d_base_multivect_type), intent(inout) :: y
real(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
call psb_geaxpby(m,alpha,x%v,beta,y%v(:,j),info)
end subroutine d_base_mlv_axpby_vv
!
! AXPBY is invoked via Y, hence the structure below.
!

@ -1395,6 +1395,8 @@ module psb_d_multivect_mod
!!$ procedure, pass(x) :: nrm2 => d_vect_nrm2
!!$ procedure, pass(x) :: amax => d_vect_amax
!!$ procedure, pass(x) :: asum => d_vect_asum
procedure, pass(y) :: axpby_vv => d_vect_axpby_vv
generic, public :: axpby => axpby_vv
end type psb_d_multivect_type
public :: psb_d_multivect, psb_d_multivect_type,&
@ -1848,6 +1850,24 @@ contains
!!$
!!$ end subroutine d_vect_axpby_v
!!$
subroutine d_vect_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
use psb_d_vect_mod
implicit none
integer(psb_ipk_), intent(in) :: m
type(psb_d_vect_type), intent(inout) :: x
class(psb_d_multivect_type), intent(inout) :: y
real(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,j,info)
else
info = psb_err_invalid_vect_state_
end if
end subroutine d_vect_axpby_vv
!!$ subroutine d_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none

@ -2249,8 +2249,9 @@ module psb_s_base_multivect_mod
procedure, pass(x) :: dot_a => s_base_mlv_dot_a
generic, public :: dot => dot_v, dot_a
procedure, pass(y) :: axpby_v => s_base_mlv_axpby_v
procedure, pass(y) :: axpby_vv => s_base_mlv_axpby_vv
procedure, pass(y) :: axpby_a => s_base_mlv_axpby_a
generic, public :: axpby => axpby_v, axpby_a
generic, public :: axpby => axpby_v, axpby_a, axpby_vv
!
! MultiVector by vector/multivector multiplication. Need all variants
! to handle multiple requirements from preconditioners
@ -2907,6 +2908,35 @@ contains
end subroutine s_base_mlv_axpby_v
!
! AXPBY is invoked via Y, hence the structure below.
!
!
!
!> Function base_mlv_axpby_v
!! \memberof psb_s_base_multivect_type
!! \brief AXPBY by a (base_mlv_vect) y(j)=alpha*x+beta*y(j)
!! \param m Number of entries to be considered
!! \param alpha scalar alpha
!! \param x The class(base_v_vect) to be added
!! \param beta scalar alpha
!! \param j to what column of the multivector should we add
!! \param info return code
!!
subroutine s_base_mlv_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_s_base_vect_type), intent(inout) :: x
class(psb_s_base_multivect_type), intent(inout) :: y
real(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
call psb_geaxpby(m,alpha,x%v,beta,y%v(:,j),info)
end subroutine s_base_mlv_axpby_vv
!
! AXPBY is invoked via Y, hence the structure below.
!

@ -1395,6 +1395,8 @@ module psb_s_multivect_mod
!!$ procedure, pass(x) :: nrm2 => s_vect_nrm2
!!$ procedure, pass(x) :: amax => s_vect_amax
!!$ procedure, pass(x) :: asum => s_vect_asum
procedure, pass(y) :: axpby_vv => s_vect_axpby_vv
generic, public :: axpby => axpby_vv
end type psb_s_multivect_type
public :: psb_s_multivect, psb_s_multivect_type,&
@ -1848,6 +1850,24 @@ contains
!!$
!!$ end subroutine s_vect_axpby_v
!!$
subroutine s_vect_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
use psb_s_vect_mod
implicit none
integer(psb_ipk_), intent(in) :: m
type(psb_s_vect_type), intent(inout) :: x
class(psb_s_multivect_type), intent(inout) :: y
real(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,j,info)
else
info = psb_err_invalid_vect_state_
end if
end subroutine s_vect_axpby_vv
!!$ subroutine s_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none

@ -2070,8 +2070,9 @@ module psb_z_base_multivect_mod
procedure, pass(x) :: dot_a => z_base_mlv_dot_a
generic, public :: dot => dot_v, dot_a
procedure, pass(y) :: axpby_v => z_base_mlv_axpby_v
procedure, pass(y) :: axpby_vv => z_base_mlv_axpby_vv
procedure, pass(y) :: axpby_a => z_base_mlv_axpby_a
generic, public :: axpby => axpby_v, axpby_a
generic, public :: axpby => axpby_v, axpby_a, axpby_vv
!
! MultiVector by vector/multivector multiplication. Need all variants
! to handle multiple requirements from preconditioners
@ -2728,6 +2729,35 @@ contains
end subroutine z_base_mlv_axpby_v
!
! AXPBY is invoked via Y, hence the structure below.
!
!
!
!> Function base_mlv_axpby_v
!! \memberof psb_z_base_multivect_type
!! \brief AXPBY by a (base_mlv_vect) y(j)=alpha*x+beta*y(j)
!! \param m Number of entries to be considered
!! \param alpha scalar alpha
!! \param x The class(base_v_vect) to be added
!! \param beta scalar alpha
!! \param j to what column of the multivector should we add
!! \param info return code
!!
subroutine z_base_mlv_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_z_base_vect_type), intent(inout) :: x
class(psb_z_base_multivect_type), intent(inout) :: y
complex(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
call psb_geaxpby(m,alpha,x%v,beta,y%v(:,j),info)
end subroutine z_base_mlv_axpby_vv
!
! AXPBY is invoked via Y, hence the structure below.
!

@ -1316,6 +1316,8 @@ module psb_z_multivect_mod
!!$ procedure, pass(x) :: nrm2 => z_vect_nrm2
!!$ procedure, pass(x) :: amax => z_vect_amax
!!$ procedure, pass(x) :: asum => z_vect_asum
procedure, pass(y) :: axpby_vv => z_vect_axpby_vv
generic, public :: axpby => axpby_vv
end type psb_z_multivect_type
public :: psb_z_multivect, psb_z_multivect_type,&
@ -1769,6 +1771,24 @@ contains
!!$
!!$ end subroutine z_vect_axpby_v
!!$
subroutine z_vect_axpby_vv(m,alpha, x, beta, y, j, info)
use psi_serial_mod
use psb_z_vect_mod
implicit none
integer(psb_ipk_), intent(in) :: m
type(psb_z_vect_type), intent(inout) :: x
class(psb_z_multivect_type), intent(inout) :: y
complex(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,j,info)
else
info = psb_err_invalid_vect_state_
end if
end subroutine z_vect_axpby_vv
!!$ subroutine z_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none

@ -741,3 +741,138 @@ subroutine psb_caddconst_vect(x,b,z,desc_a,info)
return
end subroutine psb_caddconst_vect
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! 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.
!
!
! File: psb_caxpby.f90
!
! Subroutine: psb_caxpby_vect
! Adds one distributed vector to another,
!
! Y := beta * Y + alpha * X
!
! Arguments:
! alpha - complex,input The scalar used to multiply each component of X
! x - type(psb_c_vect_type) The input vector containing the entries of X
! beta - complex,input The scalar used to multiply each component of Y
! y - type(psb_c_multivect_type) The input/output vector Y
! j - integer(psb_ipk) The column component of the multivect to which we should add
! desc_a - type(psb_desc_type) The communication descriptor.
! info - integer Return code
!
! Note: from a functional point of view, X is input, but here
! it's declared INOUT because of the sync() methods.
!
subroutine psb_caxpby_multivect_vect(alpha, x, beta, y,&
& j, desc_a, info)
use psb_base_mod, psb_protect_name => psb_caxpby_multivect_vect
implicit none
type(psb_c_vect_type), intent (inout) :: x
type(psb_c_multivect_type), intent (inout) :: y
complex(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_cgeaxpby'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ctxt=desc_a%get_context()
call psb_info(ctxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if ((iix /= ione).or.(iiy /= ione)) then
info=psb_err_ix_n1_iy_n1_unsupported_
call psb_errpush(info,name)
end if
if(desc_a%get_local_rows() > 0) then
call y%axpby(desc_a%get_local_rows(),&
& alpha,x,beta,j,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ctxt,err_act)
return
end subroutine psb_caxpby_multivect_vect

@ -741,3 +741,138 @@ subroutine psb_daddconst_vect(x,b,z,desc_a,info)
return
end subroutine psb_daddconst_vect
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! 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.
!
!
! File: psb_daxpby.f90
!
! Subroutine: psb_daxpby_vect
! Adds one distributed vector to another,
!
! Y := beta * Y + alpha * X
!
! Arguments:
! alpha - real,input The scalar used to multiply each component of X
! x - type(psb_d_vect_type) The input vector containing the entries of X
! beta - real,input The scalar used to multiply each component of Y
! y - type(psb_d_multivect_type) The input/output vector Y
! j - integer(psb_ipk) The column component of the multivect to which we should add
! desc_a - type(psb_desc_type) The communication descriptor.
! info - integer Return code
!
! Note: from a functional point of view, X is input, but here
! it's declared INOUT because of the sync() methods.
!
subroutine psb_daxpby_multivect_vect(alpha, x, beta, y,&
& j, desc_a, info)
use psb_base_mod, psb_protect_name => psb_daxpby_multivect_vect
implicit none
type(psb_d_vect_type), intent (inout) :: x
type(psb_d_multivect_type), intent (inout) :: y
real(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_dgeaxpby'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ctxt=desc_a%get_context()
call psb_info(ctxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if ((iix /= ione).or.(iiy /= ione)) then
info=psb_err_ix_n1_iy_n1_unsupported_
call psb_errpush(info,name)
end if
if(desc_a%get_local_rows() > 0) then
call y%axpby(desc_a%get_local_rows(),&
& alpha,x,beta,j,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ctxt,err_act)
return
end subroutine psb_daxpby_multivect_vect

@ -741,3 +741,138 @@ subroutine psb_saddconst_vect(x,b,z,desc_a,info)
return
end subroutine psb_saddconst_vect
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! 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.
!
!
! File: psb_saxpby.f90
!
! Subroutine: psb_saxpby_vect
! Adds one distributed vector to another,
!
! Y := beta * Y + alpha * X
!
! Arguments:
! alpha - real,input The scalar used to multiply each component of X
! x - type(psb_s_vect_type) The input vector containing the entries of X
! beta - real,input The scalar used to multiply each component of Y
! y - type(psb_s_multivect_type) The input/output vector Y
! j - integer(psb_ipk) The column component of the multivect to which we should add
! desc_a - type(psb_desc_type) The communication descriptor.
! info - integer Return code
!
! Note: from a functional point of view, X is input, but here
! it's declared INOUT because of the sync() methods.
!
subroutine psb_saxpby_multivect_vect(alpha, x, beta, y,&
& j, desc_a, info)
use psb_base_mod, psb_protect_name => psb_saxpby_multivect_vect
implicit none
type(psb_s_vect_type), intent (inout) :: x
type(psb_s_multivect_type), intent (inout) :: y
real(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_sgeaxpby'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ctxt=desc_a%get_context()
call psb_info(ctxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if ((iix /= ione).or.(iiy /= ione)) then
info=psb_err_ix_n1_iy_n1_unsupported_
call psb_errpush(info,name)
end if
if(desc_a%get_local_rows() > 0) then
call y%axpby(desc_a%get_local_rows(),&
& alpha,x,beta,j,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ctxt,err_act)
return
end subroutine psb_saxpby_multivect_vect

@ -741,3 +741,138 @@ subroutine psb_zaddconst_vect(x,b,z,desc_a,info)
return
end subroutine psb_zaddconst_vect
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! 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.
!
!
! File: psb_zaxpby.f90
!
! Subroutine: psb_zaxpby_vect
! Adds one distributed vector to another,
!
! Y := beta * Y + alpha * X
!
! Arguments:
! alpha - complex,input The scalar used to multiply each component of X
! x - type(psb_z_vect_type) The input vector containing the entries of X
! beta - complex,input The scalar used to multiply each component of Y
! y - type(psb_z_multivect_type) The input/output vector Y
! j - integer(psb_ipk) The column component of the multivect to which we should add
! desc_a - type(psb_desc_type) The communication descriptor.
! info - integer Return code
!
! Note: from a functional point of view, X is input, but here
! it's declared INOUT because of the sync() methods.
!
subroutine psb_zaxpby_multivect_vect(alpha, x, beta, y,&
& j, desc_a, info)
use psb_base_mod, psb_protect_name => psb_zaxpby_multivect_vect
implicit none
type(psb_z_vect_type), intent (inout) :: x
type(psb_z_multivect_type), intent (inout) :: y
complex(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(in) :: j
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_zgeaxpby'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ctxt=desc_a%get_context()
call psb_info(ctxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if ((iix /= ione).or.(iiy /= ione)) then
info=psb_err_ix_n1_iy_n1_unsupported_
call psb_errpush(info,name)
end if
if(desc_a%get_local_rows() > 0) then
call y%axpby(desc_a%get_local_rows(),&
& alpha,x,beta,j,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ctxt,err_act)
return
end subroutine psb_zaxpby_multivect_vect

Loading…
Cancel
Save