Merged new reduction methods from development.

ILmat
Salvatore Filippone 8 years ago
parent e212ee54ff
commit 47912056cf

@ -35,50 +35,55 @@ module psb_c_psblas_mod
use psb_c_mat_mod, only : psb_cspmat_type
interface psb_gedot
function psb_cdot_vect(x, y, desc_a,info) result(res)
function psb_cdot_vect(x, y, desc_a,info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
complex(psb_spk_) :: res
type(psb_c_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cdot_vect
function psb_cdotv(x, y, desc_a,info)
function psb_cdotv(x, y, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
complex(psb_spk_) :: psb_cdotv
complex(psb_spk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cdotv
function psb_cdot(x, y, desc_a, info, jx, jy)
function psb_cdot(x, y, desc_a, info, jx, jy,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
complex(psb_spk_) :: psb_cdot
complex(psb_spk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cdot
end interface
interface psb_gedots
subroutine psb_cdotvs(res,x, y, desc_a, info)
subroutine psb_cdotvs(res,x, y, desc_a, info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
complex(psb_spk_), intent(out) :: res
complex(psb_spk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_cdotvs
subroutine psb_cmdots(res,x, y, desc_a,info)
subroutine psb_cmdots(res,x, y, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
complex(psb_spk_), intent(out) :: res(:)
complex(psb_spk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_cmdots
end interface
@ -91,7 +96,7 @@ module psb_c_psblas_mod
type(psb_c_vect_type), intent (inout) :: y
complex(psb_spk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_caxpby_vect
subroutine psb_caxpbyv(alpha, x, beta, y,&
& desc_a, info)
@ -112,35 +117,38 @@ module psb_c_psblas_mod
complex(psb_spk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_caxpby
end interface
interface psb_geamax
function psb_camax(x, desc_a, info, jx)
function psb_camax(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) psb_camax
complex(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_camax
function psb_camaxv(x, desc_a,info)
function psb_camaxv(x, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) psb_camaxv
complex(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_camaxv
function psb_camax_vect(x, desc_a, info) result(res)
function psb_camax_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) :: res
type(psb_c_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_camax_vect
end interface
@ -154,69 +162,76 @@ module psb_c_psblas_mod
#endif
interface psb_geamaxs
subroutine psb_camaxvs(res,x,desc_a,info)
subroutine psb_camaxvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_), intent (out) :: res
complex(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_camaxvs
subroutine psb_cmamaxs(res,x,desc_a,info,jx)
subroutine psb_cmamaxs(res,x,desc_a,info,jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_), intent (out) :: res(:)
complex(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
logical, intent(in), optional :: global
end subroutine psb_cmamaxs
end interface
interface psb_geasum
function psb_casum_vect(x, desc_a, info) result(res)
function psb_casum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) :: res
type(psb_c_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_casum_vect
function psb_casum(x, desc_a, info, jx)
function psb_casum(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) psb_casum
complex(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_casum
function psb_casumv(x, desc_a, info)
function psb_casumv(x, desc_a, info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) psb_casumv
complex(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_casumv
end interface
interface psb_geasums
subroutine psb_casumvs(res,x,desc_a,info)
subroutine psb_casumvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_), intent (out) :: res
complex(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_casumvs
subroutine psb_cmasum(res,x,desc_a,info)
subroutine psb_cmasum(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_), intent (out) :: res(:)
complex(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_cmasum
end interface
@ -230,30 +245,33 @@ module psb_c_psblas_mod
#endif
interface psb_genrm2
function psb_cnrm2(x, desc_a, info, jx)
function psb_cnrm2(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) psb_cnrm2
complex(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cnrm2
function psb_cnrm2v(x, desc_a, info)
function psb_cnrm2v(x, desc_a, info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) psb_cnrm2v
complex(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cnrm2v
function psb_cnrm2_vect(x, desc_a, info) result(res)
function psb_cnrm2_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) :: res
type(psb_c_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cnrm2_vect
end interface
@ -264,25 +282,27 @@ module psb_c_psblas_mod
#endif
interface psb_genrm2s
subroutine psb_cnrm2vs(res,x,desc_a,info)
subroutine psb_cnrm2vs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_), intent (out) :: res
complex(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_cnrm2vs
end interface
interface psb_spnrmi
function psb_cnrmi(a, desc_a,info)
function psb_cnrmi(a, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) :: psb_cnrmi
type(psb_cspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cnrmi
end interface
@ -293,13 +313,14 @@ module psb_c_psblas_mod
#endif
interface psb_spnrm1
function psb_cspnrm1(a, desc_a,info)
function psb_cspnrm1(a, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_c_vect_type, psb_cspmat_type
real(psb_spk_) :: psb_cspnrm1
real(psb_spk_) :: psb_cspnrm1
type(psb_cspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_cspnrm1
end interface

@ -35,50 +35,55 @@ module psb_d_psblas_mod
use psb_d_mat_mod, only : psb_dspmat_type
interface psb_gedot
function psb_ddot_vect(x, y, desc_a,info) result(res)
function psb_ddot_vect(x, y, desc_a,info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: res
type(psb_d_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_ddot_vect
function psb_ddotv(x, y, desc_a,info)
function psb_ddotv(x, y, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: psb_ddotv
real(psb_dpk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_ddotv
function psb_ddot(x, y, desc_a, info, jx, jy)
function psb_ddot(x, y, desc_a, info, jx, jy,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: psb_ddot
real(psb_dpk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_ddot
end interface
interface psb_gedots
subroutine psb_ddotvs(res,x, y, desc_a, info)
subroutine psb_ddotvs(res,x, y, desc_a, info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_), intent(out) :: res
real(psb_dpk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_ddotvs
subroutine psb_dmdots(res,x, y, desc_a,info)
subroutine psb_dmdots(res,x, y, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_), intent(out) :: res(:)
real(psb_dpk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_dmdots
end interface
@ -91,7 +96,7 @@ module psb_d_psblas_mod
type(psb_d_vect_type), intent (inout) :: y
real(psb_dpk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_daxpby_vect
subroutine psb_daxpbyv(alpha, x, beta, y,&
& desc_a, info)
@ -112,35 +117,38 @@ module psb_d_psblas_mod
real(psb_dpk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_daxpby
end interface
interface psb_geamax
function psb_damax(x, desc_a, info, jx)
function psb_damax(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) psb_damax
real(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_damax
function psb_damaxv(x, desc_a,info)
function psb_damaxv(x, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) psb_damaxv
real(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_damaxv
function psb_damax_vect(x, desc_a, info) result(res)
function psb_damax_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: res
type(psb_d_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_damax_vect
end interface
@ -154,69 +162,76 @@ module psb_d_psblas_mod
#endif
interface psb_geamaxs
subroutine psb_damaxvs(res,x,desc_a,info)
subroutine psb_damaxvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_), intent (out) :: res
real(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_damaxvs
subroutine psb_dmamaxs(res,x,desc_a,info,jx)
subroutine psb_dmamaxs(res,x,desc_a,info,jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_), intent (out) :: res(:)
real(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
logical, intent(in), optional :: global
end subroutine psb_dmamaxs
end interface
interface psb_geasum
function psb_dasum_vect(x, desc_a, info) result(res)
function psb_dasum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: res
type(psb_d_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dasum_vect
function psb_dasum(x, desc_a, info, jx)
function psb_dasum(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) psb_dasum
real(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dasum
function psb_dasumv(x, desc_a, info)
function psb_dasumv(x, desc_a, info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) psb_dasumv
real(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dasumv
end interface
interface psb_geasums
subroutine psb_dasumvs(res,x,desc_a,info)
subroutine psb_dasumvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_), intent (out) :: res
real(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_dasumvs
subroutine psb_dmasum(res,x,desc_a,info)
subroutine psb_dmasum(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_), intent (out) :: res(:)
real(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_dmasum
end interface
@ -230,30 +245,33 @@ module psb_d_psblas_mod
#endif
interface psb_genrm2
function psb_dnrm2(x, desc_a, info, jx)
function psb_dnrm2(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) psb_dnrm2
real(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dnrm2
function psb_dnrm2v(x, desc_a, info)
function psb_dnrm2v(x, desc_a, info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) psb_dnrm2v
real(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dnrm2v
function psb_dnrm2_vect(x, desc_a, info) result(res)
function psb_dnrm2_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: res
type(psb_d_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dnrm2_vect
end interface
@ -264,25 +282,27 @@ module psb_d_psblas_mod
#endif
interface psb_genrm2s
subroutine psb_dnrm2vs(res,x,desc_a,info)
subroutine psb_dnrm2vs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_), intent (out) :: res
real(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_dnrm2vs
end interface
interface psb_spnrmi
function psb_dnrmi(a, desc_a,info)
function psb_dnrmi(a, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: psb_dnrmi
type(psb_dspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dnrmi
end interface
@ -293,13 +313,14 @@ module psb_d_psblas_mod
#endif
interface psb_spnrm1
function psb_dspnrm1(a, desc_a,info)
function psb_dspnrm1(a, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: psb_dspnrm1
real(psb_dpk_) :: psb_dspnrm1
type(psb_dspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dspnrm1
end interface

@ -35,50 +35,55 @@ module psb_s_psblas_mod
use psb_s_mat_mod, only : psb_sspmat_type
interface psb_gedot
function psb_sdot_vect(x, y, desc_a,info) result(res)
function psb_sdot_vect(x, y, desc_a,info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: res
type(psb_s_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_sdot_vect
function psb_sdotv(x, y, desc_a,info)
function psb_sdotv(x, y, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: psb_sdotv
real(psb_spk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_sdotv
function psb_sdot(x, y, desc_a, info, jx, jy)
function psb_sdot(x, y, desc_a, info, jx, jy,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: psb_sdot
real(psb_spk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_sdot
end interface
interface psb_gedots
subroutine psb_sdotvs(res,x, y, desc_a, info)
subroutine psb_sdotvs(res,x, y, desc_a, info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_), intent(out) :: res
real(psb_spk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_sdotvs
subroutine psb_smdots(res,x, y, desc_a,info)
subroutine psb_smdots(res,x, y, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_), intent(out) :: res(:)
real(psb_spk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_smdots
end interface
@ -91,7 +96,7 @@ module psb_s_psblas_mod
type(psb_s_vect_type), intent (inout) :: y
real(psb_spk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_saxpby_vect
subroutine psb_saxpbyv(alpha, x, beta, y,&
& desc_a, info)
@ -112,35 +117,38 @@ module psb_s_psblas_mod
real(psb_spk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_saxpby
end interface
interface psb_geamax
function psb_samax(x, desc_a, info, jx)
function psb_samax(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) psb_samax
real(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_samax
function psb_samaxv(x, desc_a,info)
function psb_samaxv(x, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) psb_samaxv
real(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_samaxv
function psb_samax_vect(x, desc_a, info) result(res)
function psb_samax_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: res
type(psb_s_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_samax_vect
end interface
@ -154,69 +162,76 @@ module psb_s_psblas_mod
#endif
interface psb_geamaxs
subroutine psb_samaxvs(res,x,desc_a,info)
subroutine psb_samaxvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_), intent (out) :: res
real(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_samaxvs
subroutine psb_smamaxs(res,x,desc_a,info,jx)
subroutine psb_smamaxs(res,x,desc_a,info,jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_), intent (out) :: res(:)
real(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
logical, intent(in), optional :: global
end subroutine psb_smamaxs
end interface
interface psb_geasum
function psb_sasum_vect(x, desc_a, info) result(res)
function psb_sasum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: res
type(psb_s_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_sasum_vect
function psb_sasum(x, desc_a, info, jx)
function psb_sasum(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) psb_sasum
real(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_sasum
function psb_sasumv(x, desc_a, info)
function psb_sasumv(x, desc_a, info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) psb_sasumv
real(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_sasumv
end interface
interface psb_geasums
subroutine psb_sasumvs(res,x,desc_a,info)
subroutine psb_sasumvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_), intent (out) :: res
real(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_sasumvs
subroutine psb_smasum(res,x,desc_a,info)
subroutine psb_smasum(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_), intent (out) :: res(:)
real(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_smasum
end interface
@ -230,30 +245,33 @@ module psb_s_psblas_mod
#endif
interface psb_genrm2
function psb_snrm2(x, desc_a, info, jx)
function psb_snrm2(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) psb_snrm2
real(psb_spk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_snrm2
function psb_snrm2v(x, desc_a, info)
function psb_snrm2v(x, desc_a, info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) psb_snrm2v
real(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_snrm2v
function psb_snrm2_vect(x, desc_a, info) result(res)
function psb_snrm2_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: res
type(psb_s_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_snrm2_vect
end interface
@ -264,25 +282,27 @@ module psb_s_psblas_mod
#endif
interface psb_genrm2s
subroutine psb_snrm2vs(res,x,desc_a,info)
subroutine psb_snrm2vs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_), intent (out) :: res
real(psb_spk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_snrm2vs
end interface
interface psb_spnrmi
function psb_snrmi(a, desc_a,info)
function psb_snrmi(a, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: psb_snrmi
type(psb_sspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_snrmi
end interface
@ -293,13 +313,14 @@ module psb_s_psblas_mod
#endif
interface psb_spnrm1
function psb_sspnrm1(a, desc_a,info)
function psb_sspnrm1(a, desc_a,info,global)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: psb_sspnrm1
real(psb_spk_) :: psb_sspnrm1
type(psb_sspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_sspnrm1
end interface

@ -35,50 +35,55 @@ module psb_z_psblas_mod
use psb_z_mat_mod, only : psb_zspmat_type
interface psb_gedot
function psb_zdot_vect(x, y, desc_a,info) result(res)
function psb_zdot_vect(x, y, desc_a,info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
complex(psb_dpk_) :: res
type(psb_z_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zdot_vect
function psb_zdotv(x, y, desc_a,info)
function psb_zdotv(x, y, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
complex(psb_dpk_) :: psb_zdotv
complex(psb_dpk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zdotv
function psb_zdot(x, y, desc_a, info, jx, jy)
function psb_zdot(x, y, desc_a, info, jx, jy,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
complex(psb_dpk_) :: psb_zdot
complex(psb_dpk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zdot
end interface
interface psb_gedots
subroutine psb_zdotvs(res,x, y, desc_a, info)
subroutine psb_zdotvs(res,x, y, desc_a, info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
complex(psb_dpk_), intent(out) :: res
complex(psb_dpk_), intent(in) :: x(:), y(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_zdotvs
subroutine psb_zmdots(res,x, y, desc_a,info)
subroutine psb_zmdots(res,x, y, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
complex(psb_dpk_), intent(out) :: res(:)
complex(psb_dpk_), intent(in) :: x(:,:), y(:,:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_zmdots
end interface
@ -91,7 +96,7 @@ module psb_z_psblas_mod
type(psb_z_vect_type), intent (inout) :: y
complex(psb_dpk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_zaxpby_vect
subroutine psb_zaxpbyv(alpha, x, beta, y,&
& desc_a, info)
@ -112,35 +117,38 @@ module psb_z_psblas_mod
complex(psb_dpk_), intent (in) :: alpha, beta
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent(in) :: n, jx, jy
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
end subroutine psb_zaxpby
end interface
interface psb_geamax
function psb_zamax(x, desc_a, info, jx)
function psb_zamax(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) psb_zamax
complex(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zamax
function psb_zamaxv(x, desc_a,info)
function psb_zamaxv(x, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) psb_zamaxv
complex(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zamaxv
function psb_zamax_vect(x, desc_a, info) result(res)
function psb_zamax_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) :: res
type(psb_z_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zamax_vect
end interface
@ -154,69 +162,76 @@ module psb_z_psblas_mod
#endif
interface psb_geamaxs
subroutine psb_zamaxvs(res,x,desc_a,info)
subroutine psb_zamaxvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_), intent (out) :: res
complex(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_zamaxvs
subroutine psb_zmamaxs(res,x,desc_a,info,jx)
subroutine psb_zmamaxs(res,x,desc_a,info,jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_), intent (out) :: res(:)
complex(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
logical, intent(in), optional :: global
end subroutine psb_zmamaxs
end interface
interface psb_geasum
function psb_zasum_vect(x, desc_a, info) result(res)
function psb_zasum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) :: res
type(psb_z_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zasum_vect
function psb_zasum(x, desc_a, info, jx)
function psb_zasum(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) psb_zasum
complex(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zasum
function psb_zasumv(x, desc_a, info)
function psb_zasumv(x, desc_a, info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) psb_zasumv
complex(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zasumv
end interface
interface psb_geasums
subroutine psb_zasumvs(res,x,desc_a,info)
subroutine psb_zasumvs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_), intent (out) :: res
complex(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_zasumvs
subroutine psb_zmasum(res,x,desc_a,info)
subroutine psb_zmasum(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_), intent (out) :: res(:)
complex(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_zmasum
end interface
@ -230,30 +245,33 @@ module psb_z_psblas_mod
#endif
interface psb_genrm2
function psb_znrm2(x, desc_a, info, jx)
function psb_znrm2(x, desc_a, info, jx,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) psb_znrm2
complex(psb_dpk_), intent (in) :: x(:,:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), optional, intent (in) :: jx
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_znrm2
function psb_znrm2v(x, desc_a, info)
function psb_znrm2v(x, desc_a, info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) psb_znrm2v
complex(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_znrm2v
function psb_znrm2_vect(x, desc_a, info) result(res)
function psb_znrm2_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) :: res
type(psb_z_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_znrm2_vect
end interface
@ -264,25 +282,27 @@ module psb_z_psblas_mod
#endif
interface psb_genrm2s
subroutine psb_znrm2vs(res,x,desc_a,info)
subroutine psb_znrm2vs(res,x,desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_), intent (out) :: res
complex(psb_dpk_), intent (in) :: x(:)
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end subroutine psb_znrm2vs
end interface
interface psb_spnrmi
function psb_znrmi(a, desc_a,info)
function psb_znrmi(a, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) :: psb_znrmi
type(psb_zspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_znrmi
end interface
@ -293,13 +313,14 @@ module psb_z_psblas_mod
#endif
interface psb_spnrm1
function psb_zspnrm1(a, desc_a,info)
function psb_zspnrm1(a, desc_a,info,global)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_z_vect_type, psb_zspmat_type
real(psb_dpk_) :: psb_zspnrm1
real(psb_dpk_) :: psb_zspnrm1
type(psb_zspmat_type), intent (in) :: a
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_zspnrm1
end interface

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_camax(x,desc_a, info, jx) result(res)
function psb_camax(x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_camax
implicit none
@ -54,11 +54,13 @@ function psb_camax(x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_camax'
@ -83,6 +85,12 @@ function psb_camax(x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
@ -108,7 +116,7 @@ function psb_camax(x,desc_a, info, jx) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -163,7 +171,7 @@ end function psb_camax
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_camaxv (x,desc_a, info) result(res)
function psb_camaxv (x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_camaxv
implicit none
@ -172,12 +180,13 @@ function psb_camaxv (x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_camaxv'
@ -195,6 +204,12 @@ function psb_camaxv (x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -223,7 +238,7 @@ function psb_camaxv (x,desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -234,7 +249,7 @@ function psb_camaxv (x,desc_a, info) result(res)
end function psb_camaxv
function psb_camax_vect(x, desc_a, info) result(res)
function psb_camax_vect(x, desc_a, info,global) result(res)
use psb_penv_mod
use psb_serial_mod
use psb_desc_mod
@ -247,11 +262,13 @@ function psb_camax_vect(x, desc_a, info) result(res)
type(psb_c_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_camaxv'
@ -274,6 +291,12 @@ function psb_camax_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -300,7 +323,7 @@ function psb_camax_vect(x, desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -358,7 +381,7 @@ end function psb_camax_vect
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_camaxvs(res,x,desc_a, info)
subroutine psb_camaxvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_camaxvs
implicit none
@ -367,11 +390,13 @@ subroutine psb_camaxvs(res,x,desc_a, info)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_), intent(out) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_camaxvs'
@ -389,6 +414,12 @@ subroutine psb_camaxvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
ijx=1
@ -416,7 +447,7 @@ subroutine psb_camaxvs(res,x,desc_a, info)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -470,7 +501,7 @@ end subroutine psb_camaxvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_cmamaxs(res,x,desc_a, info,jx)
subroutine psb_cmamaxs(res,x,desc_a, info,jx,global)
use psb_base_mod, psb_protect_name => psb_cmamaxs
implicit none
@ -480,11 +511,13 @@ subroutine psb_cmamaxs(res,x,desc_a, info,jx)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_spk_), intent(out) :: res(:)
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx, i, k
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_cmamaxs'
@ -508,6 +541,12 @@ subroutine psb_cmamaxs(res,x,desc_a, info,jx)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
k = min(size(x,2),size(res,1))
ldx = size(x,1)
@ -534,7 +573,7 @@ subroutine psb_cmamaxs(res,x,desc_a, info,jx)
end if
! compute global max
call psb_amx(ictxt, res(1:k))
if (global_) call psb_amx(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_casum (x,desc_a, info, jx) result(res)
function psb_casum (x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_casum
implicit none
@ -54,11 +54,13 @@ function psb_casum (x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, &
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_casum'
@ -83,6 +85,12 @@ function psb_casum (x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
! check vector correctness
@ -115,7 +123,7 @@ function psb_casum (x,desc_a, info, jx) result(res)
res = szero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -126,7 +134,7 @@ function psb_casum (x,desc_a, info, jx) result(res)
end function psb_casum
function psb_casum_vect(x, desc_a, info) result(res)
function psb_casum_vect(x, desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_casum_vect
implicit none
@ -134,11 +142,13 @@ function psb_casum_vect(x, desc_a, info) result(res)
type(psb_c_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, imax
& err_act, iix, jjx, imax, i, idx, ndm
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_casumv'
@ -162,6 +172,11 @@ function psb_casum_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -184,12 +199,21 @@ function psb_casum_vect(x, desc_a, info) result(res)
! compute local max
if ((desc_a%get_local_rows() > 0).and.(m /= 0)) then
res = x%asum(desc_a%get_local_rows())
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
! adjust res because overlapped elements are computed more than once
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*abs(x%v%v(idx))
end do
end if
else
res = szero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -244,7 +268,7 @@ end function psb_casum_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_casumv(x,desc_a, info) result(res)
function psb_casumv(x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_casumv
implicit none
@ -253,11 +277,13 @@ function psb_casumv(x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_casumv'
@ -274,6 +300,12 @@ function psb_casumv(x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
@ -310,7 +342,7 @@ function psb_casumv(x,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -365,7 +397,7 @@ end function psb_casumv
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_casumvs(res,x,desc_a, info)
subroutine psb_casumvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_casumvs
implicit none
@ -374,11 +406,13 @@ subroutine psb_casumvs(res,x,desc_a, info)
real(psb_spk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_casumvs'
@ -395,6 +429,12 @@ subroutine psb_casumvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -431,7 +471,7 @@ subroutine psb_casumvs(res,x,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt,res)
if (global_) call psb_sum(ictxt,res)
call psb_erractionrestore(err_act)
return

@ -48,7 +48,7 @@
! jx - integer(optional). The column offset for sub( X ).
! jy - integer(optional). The column offset for sub( Y ).
!
function psb_cdot_vect(x, y, desc_a,info) result(res)
function psb_cdot_vect(x, y, desc_a,info,global) result(res)
use psb_desc_mod
use psb_c_base_mat_mod
use psb_check_mod
@ -61,11 +61,13 @@ function psb_cdot_vect(x, y, desc_a,info) result(res)
type(psb_c_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_cdot_vect'
@ -92,6 +94,11 @@ function psb_cdot_vect(x, y, desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
ijx = ione
@ -123,17 +130,21 @@ function psb_cdot_vect(x, y, desc_a,info) result(res)
res = x%dot(nr,y)
! FIXME
! adjust dot_local because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dot_local = dot_local - (real(ndm-1)/real(ndm))*(x(idx)*y(idx))
!!$ end do
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
if (y%is_dev()) call y%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*(x%v%v(idx)*y%v%v(idx))
end do
end if
else
res = czero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -144,7 +155,7 @@ function psb_cdot_vect(x, y, desc_a,info) result(res)
end function psb_cdot_vect
function psb_cdot(x, y,desc_a, info, jx, jy) result(res)
function psb_cdot(x, y,desc_a, info, jx, jy,global) result(res)
use psb_base_mod, psb_protect_name => psb_cdot
implicit none
@ -153,12 +164,14 @@ function psb_cdot(x, y,desc_a, info, jx, jy) result(res)
integer(psb_ipk_), intent(in), optional :: jx, jy
integer(psb_ipk_), intent(out) :: info
complex(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
complex(psb_spk_) :: cdotc
logical :: global_
character(len=20) :: name, ch_err
name='psb_cdot'
@ -194,6 +207,12 @@ function psb_cdot(x, y,desc_a, info, jx, jy) result(res)
goto 9999
end if
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
lldx = size(x,1)
lldy = size(y,1)
@ -229,7 +248,7 @@ function psb_cdot(x, y,desc_a, info, jx, jy) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -285,7 +304,7 @@ end function psb_cdot
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_cdotv(x, y,desc_a, info) result(res)
function psb_cdotv(x, y,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_cdotv
implicit none
@ -293,11 +312,13 @@ function psb_cdotv(x, y,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
complex(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
complex(psb_spk_) :: cdotc
character(len=20) :: name, ch_err
@ -315,6 +336,12 @@ function psb_cdotv(x, y,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
jx = ione
@ -353,7 +380,7 @@ function psb_cdotv(x, y,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
@ -410,7 +437,7 @@ end function psb_cdotv
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_cdotvs(res, x, y,desc_a, info)
subroutine psb_cdotvs(res, x, y,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_cdotvs
implicit none
@ -418,11 +445,13 @@ subroutine psb_cdotvs(res, x, y,desc_a, info)
complex(psb_spk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i,nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
complex(psb_spk_) :: cdotc
character(len=20) :: name, ch_err
@ -440,6 +469,12 @@ subroutine psb_cdotvs(res, x, y,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
m = desc_a%get_global_rows()
@ -476,7 +511,7 @@ subroutine psb_cdotvs(res, x, y,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -533,7 +568,7 @@ end subroutine psb_cdotvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_cmdots(res, x, y, desc_a, info)
subroutine psb_cmdots(res, x, y, desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_cmdots
implicit none
@ -541,11 +576,13 @@ subroutine psb_cmdots(res, x, y, desc_a, info)
complex(psb_spk_), intent(out) :: res(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, j, k, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
complex(psb_spk_) :: cdotc
character(len=20) :: name, ch_err
@ -563,6 +600,11 @@ subroutine psb_cmdots(res, x, y, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
@ -612,7 +654,7 @@ subroutine psb_cmdots(res, x, y, desc_a, info)
! compute global sum
call psb_sum(ictxt, res(1:k))
if (global_) call psb_sum(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset for sub( X ).
!
function psb_cnrm2(x, desc_a, info, jx) result(res)
function psb_cnrm2(x, desc_a, info, jx,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -56,11 +56,13 @@ function psb_cnrm2(x, desc_a, info, jx) result(res)
integer(psb_ipk_), intent(in), optional :: jx
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
real(psb_spk_) :: scnrm2, dd
character(len=20) :: name, ch_err
@ -85,6 +87,12 @@ function psb_cnrm2(x, desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
call psb_chkvect(m,lone,ldx,ix,ijx,desc_a,info,iix,jjx)
@ -115,7 +123,7 @@ function psb_cnrm2(x, desc_a, info, jx) result(res)
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -169,7 +177,7 @@ end function psb_cnrm2
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_cnrm2v(x, desc_a, info) result(res)
function psb_cnrm2v(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -180,13 +188,14 @@ function psb_cnrm2v(x, desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
real(psb_spk_) :: scnrm2, dd
logical :: global_
character(len=20) :: name, ch_err
name='psb_cnrm2v'
@ -203,6 +212,11 @@ function psb_cnrm2v(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
m = desc_a%get_global_rows()
@ -234,8 +248,7 @@ function psb_cnrm2v(x, desc_a, info) result(res)
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -247,7 +260,7 @@ end function psb_cnrm2v
function psb_cnrm2_vect(x, desc_a, info) result(res)
function psb_cnrm2_vect(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -259,11 +272,13 @@ function psb_cnrm2_vect(x, desc_a, info) result(res)
type(psb_c_vect_type), intent (inout) :: x
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_spk_) :: snrm2, dd
character(len=20) :: name, ch_err
@ -287,6 +302,11 @@ function psb_cnrm2_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -308,18 +328,21 @@ function psb_cnrm2_vect(x, desc_a, info) result(res)
if (desc_a%get_local_rows() > 0) then
ndim = desc_a%get_local_rows()
res = x%nrm2(ndim)
!!$ ! adjust because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dd = dble(ndm-1)/dble(ndm)
!!$ nrm2 = nrm2 * sqrt(done - dd*(abs(x(idx))/nrm2)**2)
!!$ end do
else
! adjust because overlapped elements are computed more than once
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
dd = dble(ndm-1)/dble(ndm)
res = res - sqrt(cone - dd*(abs(x%v%v(idx))/res)**2)
end do
end if
else
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -330,7 +353,6 @@ function psb_cnrm2_vect(x, desc_a, info) result(res)
end function psb_cnrm2_vect
!!$
!!$ Parallel Sparse BLAS version 3.5
!!$ (C) Copyright 2006-2018
@ -374,7 +396,7 @@ end function psb_cnrm2_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_cnrm2vs(res, x, desc_a, info)
subroutine psb_cnrm2vs(res, x, desc_a, info,global)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -385,11 +407,13 @@ subroutine psb_cnrm2vs(res, x, desc_a, info)
real(psb_spk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_spk_) :: nrm2, scnrm2, dd
character(len=20) :: name, ch_err
@ -407,6 +431,12 @@ subroutine psb_cnrm2vs(res, x, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
m = desc_a%get_global_rows()
@ -439,7 +469,7 @@ subroutine psb_cnrm2vs(res, x, desc_a, info)
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_cnrmi(a,desc_a,info) result(res)
function psb_cnrmi(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_cnrmi
implicit none
@ -49,11 +49,13 @@ function psb_cnrmi(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
name='psb_cnrmi'
@ -70,6 +72,12 @@ function psb_cnrmi(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -102,7 +110,7 @@ function psb_cnrmi(a,desc_a,info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_cspnrm1(a,desc_a,info) result(res)
function psb_cspnrm1(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_cspnrm1
implicit none
@ -49,11 +49,13 @@ function psb_cspnrm1(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, nr,nc,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: ix, ijx, iy, ijy, m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
real(psb_spk_), allocatable :: v(:)
@ -71,6 +73,12 @@ function psb_cspnrm1(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -120,7 +128,7 @@ function psb_cspnrm1(a,desc_a,info) result(res)
res = szero
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_damax(x,desc_a, info, jx) result(res)
function psb_damax(x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_damax
implicit none
@ -54,11 +54,13 @@ function psb_damax(x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_damax'
@ -83,6 +85,12 @@ function psb_damax(x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
@ -108,7 +116,7 @@ function psb_damax(x,desc_a, info, jx) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -163,7 +171,7 @@ end function psb_damax
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_damaxv (x,desc_a, info) result(res)
function psb_damaxv (x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_damaxv
implicit none
@ -172,12 +180,13 @@ function psb_damaxv (x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_damaxv'
@ -195,6 +204,12 @@ function psb_damaxv (x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -223,7 +238,7 @@ function psb_damaxv (x,desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -234,7 +249,7 @@ function psb_damaxv (x,desc_a, info) result(res)
end function psb_damaxv
function psb_damax_vect(x, desc_a, info) result(res)
function psb_damax_vect(x, desc_a, info,global) result(res)
use psb_penv_mod
use psb_serial_mod
use psb_desc_mod
@ -247,11 +262,13 @@ function psb_damax_vect(x, desc_a, info) result(res)
type(psb_d_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_damaxv'
@ -274,6 +291,12 @@ function psb_damax_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -300,7 +323,7 @@ function psb_damax_vect(x, desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -358,7 +381,7 @@ end function psb_damax_vect
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_damaxvs(res,x,desc_a, info)
subroutine psb_damaxvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_damaxvs
implicit none
@ -367,11 +390,13 @@ subroutine psb_damaxvs(res,x,desc_a, info)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_), intent(out) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_damaxvs'
@ -389,6 +414,12 @@ subroutine psb_damaxvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
ijx=1
@ -416,7 +447,7 @@ subroutine psb_damaxvs(res,x,desc_a, info)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -470,7 +501,7 @@ end subroutine psb_damaxvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_dmamaxs(res,x,desc_a, info,jx)
subroutine psb_dmamaxs(res,x,desc_a, info,jx,global)
use psb_base_mod, psb_protect_name => psb_dmamaxs
implicit none
@ -480,11 +511,13 @@ subroutine psb_dmamaxs(res,x,desc_a, info,jx)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_dpk_), intent(out) :: res(:)
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx, i, k
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_dmamaxs'
@ -508,6 +541,12 @@ subroutine psb_dmamaxs(res,x,desc_a, info,jx)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
k = min(size(x,2),size(res,1))
ldx = size(x,1)
@ -534,7 +573,7 @@ subroutine psb_dmamaxs(res,x,desc_a, info,jx)
end if
! compute global max
call psb_amx(ictxt, res(1:k))
if (global_) call psb_amx(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_dasum (x,desc_a, info, jx) result(res)
function psb_dasum (x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_dasum
implicit none
@ -54,11 +54,13 @@ function psb_dasum (x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, &
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_dasum'
@ -83,6 +85,12 @@ function psb_dasum (x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
! check vector correctness
@ -115,7 +123,7 @@ function psb_dasum (x,desc_a, info, jx) result(res)
res = dzero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -126,7 +134,7 @@ function psb_dasum (x,desc_a, info, jx) result(res)
end function psb_dasum
function psb_dasum_vect(x, desc_a, info) result(res)
function psb_dasum_vect(x, desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_dasum_vect
implicit none
@ -134,11 +142,13 @@ function psb_dasum_vect(x, desc_a, info) result(res)
type(psb_d_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, imax
& err_act, iix, jjx, imax, i, idx, ndm
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_dasumv'
@ -162,6 +172,11 @@ function psb_dasum_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -184,12 +199,21 @@ function psb_dasum_vect(x, desc_a, info) result(res)
! compute local max
if ((desc_a%get_local_rows() > 0).and.(m /= 0)) then
res = x%asum(desc_a%get_local_rows())
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
! adjust res because overlapped elements are computed more than once
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*abs(x%v%v(idx))
end do
end if
else
res = dzero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -244,7 +268,7 @@ end function psb_dasum_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_dasumv(x,desc_a, info) result(res)
function psb_dasumv(x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_dasumv
implicit none
@ -253,11 +277,13 @@ function psb_dasumv(x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_dasumv'
@ -274,6 +300,12 @@ function psb_dasumv(x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
@ -310,7 +342,7 @@ function psb_dasumv(x,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -365,7 +397,7 @@ end function psb_dasumv
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_dasumvs(res,x,desc_a, info)
subroutine psb_dasumvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_dasumvs
implicit none
@ -374,11 +406,13 @@ subroutine psb_dasumvs(res,x,desc_a, info)
real(psb_dpk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_dasumvs'
@ -395,6 +429,12 @@ subroutine psb_dasumvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -431,7 +471,7 @@ subroutine psb_dasumvs(res,x,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt,res)
if (global_) call psb_sum(ictxt,res)
call psb_erractionrestore(err_act)
return

@ -48,7 +48,7 @@
! jx - integer(optional). The column offset for sub( X ).
! jy - integer(optional). The column offset for sub( Y ).
!
function psb_ddot_vect(x, y, desc_a,info) result(res)
function psb_ddot_vect(x, y, desc_a,info,global) result(res)
use psb_desc_mod
use psb_d_base_mat_mod
use psb_check_mod
@ -61,11 +61,13 @@ function psb_ddot_vect(x, y, desc_a,info) result(res)
type(psb_d_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_ddot_vect'
@ -92,6 +94,11 @@ function psb_ddot_vect(x, y, desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
ijx = ione
@ -123,17 +130,21 @@ function psb_ddot_vect(x, y, desc_a,info) result(res)
res = x%dot(nr,y)
! FIXME
! adjust dot_local because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dot_local = dot_local - (real(ndm-1)/real(ndm))*(x(idx)*y(idx))
!!$ end do
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
if (y%is_dev()) call y%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*(x%v%v(idx)*y%v%v(idx))
end do
end if
else
res = dzero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -144,7 +155,7 @@ function psb_ddot_vect(x, y, desc_a,info) result(res)
end function psb_ddot_vect
function psb_ddot(x, y,desc_a, info, jx, jy) result(res)
function psb_ddot(x, y,desc_a, info, jx, jy,global) result(res)
use psb_base_mod, psb_protect_name => psb_ddot
implicit none
@ -153,12 +164,14 @@ function psb_ddot(x, y,desc_a, info, jx, jy) result(res)
integer(psb_ipk_), intent(in), optional :: jx, jy
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
real(psb_dpk_) :: ddot
logical :: global_
character(len=20) :: name, ch_err
name='psb_ddot'
@ -194,6 +207,12 @@ function psb_ddot(x, y,desc_a, info, jx, jy) result(res)
goto 9999
end if
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
lldx = size(x,1)
lldy = size(y,1)
@ -229,7 +248,7 @@ function psb_ddot(x, y,desc_a, info, jx, jy) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -285,7 +304,7 @@ end function psb_ddot
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_ddotv(x, y,desc_a, info) result(res)
function psb_ddotv(x, y,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_ddotv
implicit none
@ -293,11 +312,13 @@ function psb_ddotv(x, y,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
real(psb_dpk_) :: ddot
character(len=20) :: name, ch_err
@ -315,6 +336,12 @@ function psb_ddotv(x, y,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
jx = ione
@ -353,7 +380,7 @@ function psb_ddotv(x, y,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
@ -410,7 +437,7 @@ end function psb_ddotv
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_ddotvs(res, x, y,desc_a, info)
subroutine psb_ddotvs(res, x, y,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_ddotvs
implicit none
@ -418,11 +445,13 @@ subroutine psb_ddotvs(res, x, y,desc_a, info)
real(psb_dpk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i,nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
real(psb_dpk_) :: ddot
character(len=20) :: name, ch_err
@ -440,6 +469,12 @@ subroutine psb_ddotvs(res, x, y,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
m = desc_a%get_global_rows()
@ -476,7 +511,7 @@ subroutine psb_ddotvs(res, x, y,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -533,7 +568,7 @@ end subroutine psb_ddotvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_dmdots(res, x, y, desc_a, info)
subroutine psb_dmdots(res, x, y, desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_dmdots
implicit none
@ -541,11 +576,13 @@ subroutine psb_dmdots(res, x, y, desc_a, info)
real(psb_dpk_), intent(out) :: res(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, j, k, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
real(psb_dpk_) :: ddot
character(len=20) :: name, ch_err
@ -563,6 +600,11 @@ subroutine psb_dmdots(res, x, y, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
@ -612,7 +654,7 @@ subroutine psb_dmdots(res, x, y, desc_a, info)
! compute global sum
call psb_sum(ictxt, res(1:k))
if (global_) call psb_sum(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset for sub( X ).
!
function psb_dnrm2(x, desc_a, info, jx) result(res)
function psb_dnrm2(x, desc_a, info, jx,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -56,11 +56,13 @@ function psb_dnrm2(x, desc_a, info, jx) result(res)
integer(psb_ipk_), intent(in), optional :: jx
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
real(psb_dpk_) :: dnrm2, dd
character(len=20) :: name, ch_err
@ -85,6 +87,12 @@ function psb_dnrm2(x, desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
call psb_chkvect(m,lone,ldx,ix,ijx,desc_a,info,iix,jjx)
@ -115,7 +123,7 @@ function psb_dnrm2(x, desc_a, info, jx) result(res)
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -169,7 +177,7 @@ end function psb_dnrm2
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_dnrm2v(x, desc_a, info) result(res)
function psb_dnrm2v(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -180,13 +188,14 @@ function psb_dnrm2v(x, desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
real(psb_dpk_) :: dnrm2, dd
logical :: global_
character(len=20) :: name, ch_err
name='psb_dnrm2v'
@ -203,6 +212,11 @@ function psb_dnrm2v(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
m = desc_a%get_global_rows()
@ -234,8 +248,7 @@ function psb_dnrm2v(x, desc_a, info) result(res)
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -247,7 +260,7 @@ end function psb_dnrm2v
function psb_dnrm2_vect(x, desc_a, info) result(res)
function psb_dnrm2_vect(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -259,11 +272,13 @@ function psb_dnrm2_vect(x, desc_a, info) result(res)
type(psb_d_vect_type), intent (inout) :: x
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_dpk_) :: snrm2, dd
character(len=20) :: name, ch_err
@ -287,6 +302,11 @@ function psb_dnrm2_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -308,18 +328,21 @@ function psb_dnrm2_vect(x, desc_a, info) result(res)
if (desc_a%get_local_rows() > 0) then
ndim = desc_a%get_local_rows()
res = x%nrm2(ndim)
!!$ ! adjust because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dd = dble(ndm-1)/dble(ndm)
!!$ nrm2 = nrm2 * sqrt(done - dd*(abs(x(idx))/nrm2)**2)
!!$ end do
else
! adjust because overlapped elements are computed more than once
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
dd = dble(ndm-1)/dble(ndm)
res = res - sqrt(done - dd*(abs(x%v%v(idx))/res)**2)
end do
end if
else
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -330,7 +353,6 @@ function psb_dnrm2_vect(x, desc_a, info) result(res)
end function psb_dnrm2_vect
!!$
!!$ Parallel Sparse BLAS version 3.5
!!$ (C) Copyright 2006-2018
@ -374,7 +396,7 @@ end function psb_dnrm2_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_dnrm2vs(res, x, desc_a, info)
subroutine psb_dnrm2vs(res, x, desc_a, info,global)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -385,11 +407,13 @@ subroutine psb_dnrm2vs(res, x, desc_a, info)
real(psb_dpk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_dpk_) :: nrm2, dnrm2, dd
character(len=20) :: name, ch_err
@ -407,6 +431,12 @@ subroutine psb_dnrm2vs(res, x, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
m = desc_a%get_global_rows()
@ -439,7 +469,7 @@ subroutine psb_dnrm2vs(res, x, desc_a, info)
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_dnrmi(a,desc_a,info) result(res)
function psb_dnrmi(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_dnrmi
implicit none
@ -49,11 +49,13 @@ function psb_dnrmi(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
name='psb_dnrmi'
@ -70,6 +72,12 @@ function psb_dnrmi(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -102,7 +110,7 @@ function psb_dnrmi(a,desc_a,info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_dspnrm1(a,desc_a,info) result(res)
function psb_dspnrm1(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_dspnrm1
implicit none
@ -49,11 +49,13 @@ function psb_dspnrm1(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, nr,nc,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: ix, ijx, iy, ijy, m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
real(psb_dpk_), allocatable :: v(:)
@ -71,6 +73,12 @@ function psb_dspnrm1(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -120,7 +128,7 @@ function psb_dspnrm1(a,desc_a,info) result(res)
res = dzero
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_samax(x,desc_a, info, jx) result(res)
function psb_samax(x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_samax
implicit none
@ -54,11 +54,13 @@ function psb_samax(x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_samax'
@ -83,6 +85,12 @@ function psb_samax(x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
@ -108,7 +116,7 @@ function psb_samax(x,desc_a, info, jx) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -163,7 +171,7 @@ end function psb_samax
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_samaxv (x,desc_a, info) result(res)
function psb_samaxv (x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_samaxv
implicit none
@ -172,12 +180,13 @@ function psb_samaxv (x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_samaxv'
@ -195,6 +204,12 @@ function psb_samaxv (x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -223,7 +238,7 @@ function psb_samaxv (x,desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -234,7 +249,7 @@ function psb_samaxv (x,desc_a, info) result(res)
end function psb_samaxv
function psb_samax_vect(x, desc_a, info) result(res)
function psb_samax_vect(x, desc_a, info,global) result(res)
use psb_penv_mod
use psb_serial_mod
use psb_desc_mod
@ -247,11 +262,13 @@ function psb_samax_vect(x, desc_a, info) result(res)
type(psb_s_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_samaxv'
@ -274,6 +291,12 @@ function psb_samax_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -300,7 +323,7 @@ function psb_samax_vect(x, desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -358,7 +381,7 @@ end function psb_samax_vect
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_samaxvs(res,x,desc_a, info)
subroutine psb_samaxvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_samaxvs
implicit none
@ -367,11 +390,13 @@ subroutine psb_samaxvs(res,x,desc_a, info)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_), intent(out) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_samaxvs'
@ -389,6 +414,12 @@ subroutine psb_samaxvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
ijx=1
@ -416,7 +447,7 @@ subroutine psb_samaxvs(res,x,desc_a, info)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -470,7 +501,7 @@ end subroutine psb_samaxvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_smamaxs(res,x,desc_a, info,jx)
subroutine psb_smamaxs(res,x,desc_a, info,jx,global)
use psb_base_mod, psb_protect_name => psb_smamaxs
implicit none
@ -480,11 +511,13 @@ subroutine psb_smamaxs(res,x,desc_a, info,jx)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_spk_), intent(out) :: res(:)
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx, i, k
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_smamaxs'
@ -508,6 +541,12 @@ subroutine psb_smamaxs(res,x,desc_a, info,jx)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
k = min(size(x,2),size(res,1))
ldx = size(x,1)
@ -534,7 +573,7 @@ subroutine psb_smamaxs(res,x,desc_a, info,jx)
end if
! compute global max
call psb_amx(ictxt, res(1:k))
if (global_) call psb_amx(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_sasum (x,desc_a, info, jx) result(res)
function psb_sasum (x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_sasum
implicit none
@ -54,11 +54,13 @@ function psb_sasum (x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, &
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_sasum'
@ -83,6 +85,12 @@ function psb_sasum (x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
! check vector correctness
@ -115,7 +123,7 @@ function psb_sasum (x,desc_a, info, jx) result(res)
res = szero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -126,7 +134,7 @@ function psb_sasum (x,desc_a, info, jx) result(res)
end function psb_sasum
function psb_sasum_vect(x, desc_a, info) result(res)
function psb_sasum_vect(x, desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_sasum_vect
implicit none
@ -134,11 +142,13 @@ function psb_sasum_vect(x, desc_a, info) result(res)
type(psb_s_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, imax
& err_act, iix, jjx, imax, i, idx, ndm
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_sasumv'
@ -162,6 +172,11 @@ function psb_sasum_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -184,12 +199,21 @@ function psb_sasum_vect(x, desc_a, info) result(res)
! compute local max
if ((desc_a%get_local_rows() > 0).and.(m /= 0)) then
res = x%asum(desc_a%get_local_rows())
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
! adjust res because overlapped elements are computed more than once
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*abs(x%v%v(idx))
end do
end if
else
res = szero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -244,7 +268,7 @@ end function psb_sasum_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_sasumv(x,desc_a, info) result(res)
function psb_sasumv(x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_sasumv
implicit none
@ -253,11 +277,13 @@ function psb_sasumv(x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_sasumv'
@ -274,6 +300,12 @@ function psb_sasumv(x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
@ -310,7 +342,7 @@ function psb_sasumv(x,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -365,7 +397,7 @@ end function psb_sasumv
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_sasumvs(res,x,desc_a, info)
subroutine psb_sasumvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_sasumvs
implicit none
@ -374,11 +406,13 @@ subroutine psb_sasumvs(res,x,desc_a, info)
real(psb_spk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_sasumvs'
@ -395,6 +429,12 @@ subroutine psb_sasumvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -431,7 +471,7 @@ subroutine psb_sasumvs(res,x,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt,res)
if (global_) call psb_sum(ictxt,res)
call psb_erractionrestore(err_act)
return

@ -48,7 +48,7 @@
! jx - integer(optional). The column offset for sub( X ).
! jy - integer(optional). The column offset for sub( Y ).
!
function psb_sdot_vect(x, y, desc_a,info) result(res)
function psb_sdot_vect(x, y, desc_a,info,global) result(res)
use psb_desc_mod
use psb_s_base_mat_mod
use psb_check_mod
@ -61,11 +61,13 @@ function psb_sdot_vect(x, y, desc_a,info) result(res)
type(psb_s_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_sdot_vect'
@ -92,6 +94,11 @@ function psb_sdot_vect(x, y, desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
ijx = ione
@ -123,17 +130,21 @@ function psb_sdot_vect(x, y, desc_a,info) result(res)
res = x%dot(nr,y)
! FIXME
! adjust dot_local because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dot_local = dot_local - (real(ndm-1)/real(ndm))*(x(idx)*y(idx))
!!$ end do
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
if (y%is_dev()) call y%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*(x%v%v(idx)*y%v%v(idx))
end do
end if
else
res = szero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -144,7 +155,7 @@ function psb_sdot_vect(x, y, desc_a,info) result(res)
end function psb_sdot_vect
function psb_sdot(x, y,desc_a, info, jx, jy) result(res)
function psb_sdot(x, y,desc_a, info, jx, jy,global) result(res)
use psb_base_mod, psb_protect_name => psb_sdot
implicit none
@ -153,12 +164,14 @@ function psb_sdot(x, y,desc_a, info, jx, jy) result(res)
integer(psb_ipk_), intent(in), optional :: jx, jy
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
real(psb_spk_) :: sdot
logical :: global_
character(len=20) :: name, ch_err
name='psb_sdot'
@ -194,6 +207,12 @@ function psb_sdot(x, y,desc_a, info, jx, jy) result(res)
goto 9999
end if
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
lldx = size(x,1)
lldy = size(y,1)
@ -229,7 +248,7 @@ function psb_sdot(x, y,desc_a, info, jx, jy) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -285,7 +304,7 @@ end function psb_sdot
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_sdotv(x, y,desc_a, info) result(res)
function psb_sdotv(x, y,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_sdotv
implicit none
@ -293,11 +312,13 @@ function psb_sdotv(x, y,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
real(psb_spk_) :: sdot
character(len=20) :: name, ch_err
@ -315,6 +336,12 @@ function psb_sdotv(x, y,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
jx = ione
@ -353,7 +380,7 @@ function psb_sdotv(x, y,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
@ -410,7 +437,7 @@ end function psb_sdotv
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_sdotvs(res, x, y,desc_a, info)
subroutine psb_sdotvs(res, x, y,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_sdotvs
implicit none
@ -418,11 +445,13 @@ subroutine psb_sdotvs(res, x, y,desc_a, info)
real(psb_spk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i,nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
real(psb_spk_) :: sdot
character(len=20) :: name, ch_err
@ -440,6 +469,12 @@ subroutine psb_sdotvs(res, x, y,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
m = desc_a%get_global_rows()
@ -476,7 +511,7 @@ subroutine psb_sdotvs(res, x, y,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -533,7 +568,7 @@ end subroutine psb_sdotvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_smdots(res, x, y, desc_a, info)
subroutine psb_smdots(res, x, y, desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_smdots
implicit none
@ -541,11 +576,13 @@ subroutine psb_smdots(res, x, y, desc_a, info)
real(psb_spk_), intent(out) :: res(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, j, k, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
real(psb_spk_) :: sdot
character(len=20) :: name, ch_err
@ -563,6 +600,11 @@ subroutine psb_smdots(res, x, y, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
@ -612,7 +654,7 @@ subroutine psb_smdots(res, x, y, desc_a, info)
! compute global sum
call psb_sum(ictxt, res(1:k))
if (global_) call psb_sum(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset for sub( X ).
!
function psb_snrm2(x, desc_a, info, jx) result(res)
function psb_snrm2(x, desc_a, info, jx,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -56,11 +56,13 @@ function psb_snrm2(x, desc_a, info, jx) result(res)
integer(psb_ipk_), intent(in), optional :: jx
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
real(psb_spk_) :: snrm2, dd
character(len=20) :: name, ch_err
@ -85,6 +87,12 @@ function psb_snrm2(x, desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
call psb_chkvect(m,lone,ldx,ix,ijx,desc_a,info,iix,jjx)
@ -115,7 +123,7 @@ function psb_snrm2(x, desc_a, info, jx) result(res)
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -169,7 +177,7 @@ end function psb_snrm2
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_snrm2v(x, desc_a, info) result(res)
function psb_snrm2v(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -180,13 +188,14 @@ function psb_snrm2v(x, desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
real(psb_spk_) :: snrm2, dd
logical :: global_
character(len=20) :: name, ch_err
name='psb_snrm2v'
@ -203,6 +212,11 @@ function psb_snrm2v(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
m = desc_a%get_global_rows()
@ -234,8 +248,7 @@ function psb_snrm2v(x, desc_a, info) result(res)
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -247,7 +260,7 @@ end function psb_snrm2v
function psb_snrm2_vect(x, desc_a, info) result(res)
function psb_snrm2_vect(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -259,11 +272,13 @@ function psb_snrm2_vect(x, desc_a, info) result(res)
type(psb_s_vect_type), intent (inout) :: x
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_spk_) :: snrm2, dd
character(len=20) :: name, ch_err
@ -287,6 +302,11 @@ function psb_snrm2_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -308,18 +328,21 @@ function psb_snrm2_vect(x, desc_a, info) result(res)
if (desc_a%get_local_rows() > 0) then
ndim = desc_a%get_local_rows()
res = x%nrm2(ndim)
!!$ ! adjust because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dd = dble(ndm-1)/dble(ndm)
!!$ nrm2 = nrm2 * sqrt(done - dd*(abs(x(idx))/nrm2)**2)
!!$ end do
else
! adjust because overlapped elements are computed more than once
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
dd = dble(ndm-1)/dble(ndm)
res = res - sqrt(sone - dd*(abs(x%v%v(idx))/res)**2)
end do
end if
else
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -330,7 +353,6 @@ function psb_snrm2_vect(x, desc_a, info) result(res)
end function psb_snrm2_vect
!!$
!!$ Parallel Sparse BLAS version 3.5
!!$ (C) Copyright 2006-2018
@ -374,7 +396,7 @@ end function psb_snrm2_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_snrm2vs(res, x, desc_a, info)
subroutine psb_snrm2vs(res, x, desc_a, info,global)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -385,11 +407,13 @@ subroutine psb_snrm2vs(res, x, desc_a, info)
real(psb_spk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_spk_) :: nrm2, snrm2, dd
character(len=20) :: name, ch_err
@ -407,6 +431,12 @@ subroutine psb_snrm2vs(res, x, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
m = desc_a%get_global_rows()
@ -439,7 +469,7 @@ subroutine psb_snrm2vs(res, x, desc_a, info)
res = szero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_snrmi(a,desc_a,info) result(res)
function psb_snrmi(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_snrmi
implicit none
@ -49,11 +49,13 @@ function psb_snrmi(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
name='psb_snrmi'
@ -70,6 +72,12 @@ function psb_snrmi(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -102,7 +110,7 @@ function psb_snrmi(a,desc_a,info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_sspnrm1(a,desc_a,info) result(res)
function psb_sspnrm1(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_sspnrm1
implicit none
@ -49,11 +49,13 @@ function psb_sspnrm1(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_spk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, nr,nc,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: ix, ijx, iy, ijy, m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
real(psb_spk_), allocatable :: v(:)
@ -71,6 +73,12 @@ function psb_sspnrm1(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -120,7 +128,7 @@ function psb_sspnrm1(a,desc_a,info) result(res)
res = szero
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_zamax(x,desc_a, info, jx) result(res)
function psb_zamax(x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_zamax
implicit none
@ -54,11 +54,13 @@ function psb_zamax(x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zamax'
@ -83,6 +85,12 @@ function psb_zamax(x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
@ -108,7 +116,7 @@ function psb_zamax(x,desc_a, info, jx) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -163,7 +171,7 @@ end function psb_zamax
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_zamaxv (x,desc_a, info) result(res)
function psb_zamaxv (x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_zamaxv
implicit none
@ -172,12 +180,13 @@ function psb_zamaxv (x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zamaxv'
@ -195,6 +204,12 @@ function psb_zamaxv (x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -223,7 +238,7 @@ function psb_zamaxv (x,desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -234,7 +249,7 @@ function psb_zamaxv (x,desc_a, info) result(res)
end function psb_zamaxv
function psb_zamax_vect(x, desc_a, info) result(res)
function psb_zamax_vect(x, desc_a, info,global) result(res)
use psb_penv_mod
use psb_serial_mod
use psb_desc_mod
@ -247,11 +262,13 @@ function psb_zamax_vect(x, desc_a, info) result(res)
type(psb_z_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zamaxv'
@ -274,6 +291,12 @@ function psb_zamax_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -300,7 +323,7 @@ function psb_zamax_vect(x, desc_a, info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -358,7 +381,7 @@ end function psb_zamax_vect
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_zamaxvs(res,x,desc_a, info)
subroutine psb_zamaxvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_zamaxvs
implicit none
@ -367,11 +390,13 @@ subroutine psb_zamaxvs(res,x,desc_a, info)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_), intent(out) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zamaxvs'
@ -389,6 +414,12 @@ subroutine psb_zamaxvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
ijx=1
@ -416,7 +447,7 @@ subroutine psb_zamaxvs(res,x,desc_a, info)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -470,7 +501,7 @@ end subroutine psb_zamaxvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_zmamaxs(res,x,desc_a, info,jx)
subroutine psb_zmamaxs(res,x,desc_a, info,jx,global)
use psb_base_mod, psb_protect_name => psb_zmamaxs
implicit none
@ -480,11 +511,13 @@ subroutine psb_zmamaxs(res,x,desc_a, info,jx)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_dpk_), intent(out) :: res(:)
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ldx, i, k
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zmamaxs'
@ -508,6 +541,12 @@ subroutine psb_zmamaxs(res,x,desc_a, info,jx)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
k = min(size(x,2),size(res,1))
ldx = size(x,1)
@ -534,7 +573,7 @@ subroutine psb_zmamaxs(res,x,desc_a, info,jx)
end if
! compute global max
call psb_amx(ictxt, res(1:k))
if (global_) call psb_amx(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset.
!
function psb_zasum (x,desc_a, info, jx) result(res)
function psb_zasum (x,desc_a, info, jx,global) result(res)
use psb_base_mod, psb_protect_name => psb_zasum
implicit none
@ -54,11 +54,13 @@ function psb_zasum (x,desc_a, info, jx) result(res)
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), optional, intent(in) :: jx
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, &
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zasum'
@ -83,6 +85,12 @@ function psb_zasum (x,desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
! check vector correctness
@ -115,7 +123,7 @@ function psb_zasum (x,desc_a, info, jx) result(res)
res = dzero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -126,7 +134,7 @@ function psb_zasum (x,desc_a, info, jx) result(res)
end function psb_zasum
function psb_zasum_vect(x, desc_a, info) result(res)
function psb_zasum_vect(x, desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_zasum_vect
implicit none
@ -134,11 +142,13 @@ function psb_zasum_vect(x, desc_a, info) result(res)
type(psb_z_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, imax
& err_act, iix, jjx, imax, i, idx, ndm
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zasumv'
@ -162,6 +172,11 @@ function psb_zasum_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -184,12 +199,21 @@ function psb_zasum_vect(x, desc_a, info) result(res)
! compute local max
if ((desc_a%get_local_rows() > 0).and.(m /= 0)) then
res = x%asum(desc_a%get_local_rows())
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
! adjust res because overlapped elements are computed more than once
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*abs(x%v%v(idx))
end do
end if
else
res = dzero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -244,7 +268,7 @@ end function psb_zasum_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_zasumv(x,desc_a, info) result(res)
function psb_zasumv(x,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_zasumv
implicit none
@ -253,11 +277,13 @@ function psb_zasumv(x,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zasumv'
@ -274,6 +300,12 @@ function psb_zasumv(x,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
@ -310,7 +342,7 @@ function psb_zasumv(x,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -365,7 +397,7 @@ end function psb_zasumv
! info - integer. Return code
! jx - integer(optional). The column offset.
!
subroutine psb_zasumvs(res,x,desc_a, info)
subroutine psb_zasumvs(res,x,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_zasumvs
implicit none
@ -374,11 +406,13 @@ subroutine psb_zasumvs(res,x,desc_a, info)
real(psb_dpk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, i, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zasumvs'
@ -395,6 +429,12 @@ subroutine psb_zasumvs(res,x,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -431,7 +471,7 @@ subroutine psb_zasumvs(res,x,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt,res)
if (global_) call psb_sum(ictxt,res)
call psb_erractionrestore(err_act)
return

@ -48,7 +48,7 @@
! jx - integer(optional). The column offset for sub( X ).
! jy - integer(optional). The column offset for sub( Y ).
!
function psb_zdot_vect(x, y, desc_a,info) result(res)
function psb_zdot_vect(x, y, desc_a,info,global) result(res)
use psb_desc_mod
use psb_z_base_mat_mod
use psb_check_mod
@ -61,11 +61,13 @@ function psb_zdot_vect(x, y, desc_a,info) result(res)
type(psb_z_vect_type), intent(inout) :: x, y
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
character(len=20) :: name, ch_err
name='psb_zdot_vect'
@ -92,6 +94,11 @@ function psb_zdot_vect(x, y, desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
ijx = ione
@ -123,17 +130,21 @@ function psb_zdot_vect(x, y, desc_a,info) result(res)
res = x%dot(nr,y)
! FIXME
! adjust dot_local because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dot_local = dot_local - (real(ndm-1)/real(ndm))*(x(idx)*y(idx))
!!$ end do
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
if (y%is_dev()) call y%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
res = res - (real(ndm-1)/real(ndm))*(x%v%v(idx)*y%v%v(idx))
end do
end if
else
res = zzero
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -144,7 +155,7 @@ function psb_zdot_vect(x, y, desc_a,info) result(res)
end function psb_zdot_vect
function psb_zdot(x, y,desc_a, info, jx, jy) result(res)
function psb_zdot(x, y,desc_a, info, jx, jy,global) result(res)
use psb_base_mod, psb_protect_name => psb_zdot
implicit none
@ -153,12 +164,14 @@ function psb_zdot(x, y,desc_a, info, jx, jy) result(res)
integer(psb_ipk_), intent(in), optional :: jx, jy
integer(psb_ipk_), intent(out) :: info
complex(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
complex(psb_dpk_) :: zdotc
logical :: global_
character(len=20) :: name, ch_err
name='psb_zdot'
@ -194,6 +207,12 @@ function psb_zdot(x, y,desc_a, info, jx, jy) result(res)
goto 9999
end if
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
lldx = size(x,1)
lldy = size(y,1)
@ -229,7 +248,7 @@ function psb_zdot(x, y,desc_a, info, jx, jy) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -285,7 +304,7 @@ end function psb_zdot
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_zdotv(x, y,desc_a, info) result(res)
function psb_zdotv(x, y,desc_a, info,global) result(res)
use psb_base_mod, psb_protect_name => psb_zdotv
implicit none
@ -293,11 +312,13 @@ function psb_zdotv(x, y,desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
complex(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
complex(psb_dpk_) :: zdotc
character(len=20) :: name, ch_err
@ -315,6 +336,12 @@ function psb_zdotv(x, y,desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
jx = ione
@ -353,7 +380,7 @@ function psb_zdotv(x, y,desc_a, info) result(res)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
@ -410,7 +437,7 @@ end function psb_zdotv
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_zdotvs(res, x, y,desc_a, info)
subroutine psb_zdotvs(res, x, y,desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_zdotvs
implicit none
@ -418,11 +445,13 @@ subroutine psb_zdotvs(res, x, y,desc_a, info)
complex(psb_dpk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i,nr, lldx, lldy
integer(psb_lpk_) :: ix, jx, iy, jy, m
logical :: global_
complex(psb_dpk_) :: zdotc
character(len=20) :: name, ch_err
@ -440,6 +469,12 @@ subroutine psb_zdotvs(res, x, y,desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
m = desc_a%get_global_rows()
@ -476,7 +511,7 @@ subroutine psb_zdotvs(res, x, y,desc_a, info)
end if
! compute global sum
call psb_sum(ictxt, res)
if (global_) call psb_sum(ictxt, res)
call psb_erractionrestore(err_act)
return
@ -533,7 +568,7 @@ end subroutine psb_zdotvs
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_zmdots(res, x, y, desc_a, info)
subroutine psb_zmdots(res, x, y, desc_a, info,global)
use psb_base_mod, psb_protect_name => psb_zmdots
implicit none
@ -541,11 +576,13 @@ subroutine psb_zmdots(res, x, y, desc_a, info)
complex(psb_dpk_), intent(out) :: res(:)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, idx, ndm,&
& err_act, iix, jjx, iiy, jjy, i, j, k, nr, lldx, lldy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
complex(psb_dpk_) :: zdotc
character(len=20) :: name, ch_err
@ -563,6 +600,11 @@ subroutine psb_zmdots(res, x, y, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = ione
iy = ione
@ -612,7 +654,7 @@ subroutine psb_zmdots(res, x, y, desc_a, info)
! compute global sum
call psb_sum(ictxt, res(1:k))
if (global_) call psb_sum(ictxt, res(1:k))
call psb_erractionrestore(err_act)
return

@ -44,7 +44,7 @@
! info - integer. Return code
! jx - integer(optional). The column offset for sub( X ).
!
function psb_znrm2(x, desc_a, info, jx) result(res)
function psb_znrm2(x, desc_a, info, jx,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -56,11 +56,13 @@ function psb_znrm2(x, desc_a, info, jx) result(res)
integer(psb_ipk_), intent(in), optional :: jx
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
logical :: global_
real(psb_dpk_) :: dznrm2, dd
character(len=20) :: name, ch_err
@ -85,6 +87,12 @@ function psb_znrm2(x, desc_a, info, jx) result(res)
ijx = 1
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
m = desc_a%get_global_rows()
ldx = size(x,1)
call psb_chkvect(m,lone,ldx,ix,ijx,desc_a,info,iix,jjx)
@ -115,7 +123,7 @@ function psb_znrm2(x, desc_a, info, jx) result(res)
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -169,7 +177,7 @@ end function psb_znrm2
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_znrm2v(x, desc_a, info) result(res)
function psb_znrm2v(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -180,13 +188,14 @@ function psb_znrm2v(x, desc_a, info) result(res)
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
real(psb_dpk_) :: dznrm2, dd
logical :: global_
character(len=20) :: name, ch_err
name='psb_znrm2v'
@ -203,6 +212,11 @@ function psb_znrm2v(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx=1
m = desc_a%get_global_rows()
@ -234,8 +248,7 @@ function psb_znrm2v(x, desc_a, info) result(res)
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -247,7 +260,7 @@ end function psb_znrm2v
function psb_znrm2_vect(x, desc_a, info) result(res)
function psb_znrm2_vect(x, desc_a, info,global) result(res)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -259,11 +272,13 @@ function psb_znrm2_vect(x, desc_a, info) result(res)
type(psb_z_vect_type), intent (inout) :: x
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_dpk_) :: snrm2, dd
character(len=20) :: name, ch_err
@ -287,6 +302,11 @@ function psb_znrm2_vect(x, desc_a, info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
@ -308,18 +328,21 @@ function psb_znrm2_vect(x, desc_a, info) result(res)
if (desc_a%get_local_rows() > 0) then
ndim = desc_a%get_local_rows()
res = x%nrm2(ndim)
!!$ ! adjust because overlapped elements are computed more than once
!!$ do i=1,size(desc_a%ovrlap_elem,1)
!!$ idx = desc_a%ovrlap_elem(i,1)
!!$ ndm = desc_a%ovrlap_elem(i,2)
!!$ dd = dble(ndm-1)/dble(ndm)
!!$ nrm2 = nrm2 * sqrt(done - dd*(abs(x(idx))/nrm2)**2)
!!$ end do
else
! adjust because overlapped elements are computed more than once
if (size(desc_a%ovrlap_elem,1)>0) then
if (x%is_dev()) call x%sync()
do i=1,size(desc_a%ovrlap_elem,1)
idx = desc_a%ovrlap_elem(i,1)
ndm = desc_a%ovrlap_elem(i,2)
dd = dble(ndm-1)/dble(ndm)
res = res - sqrt(zone - dd*(abs(x%v%v(idx))/res)**2)
end do
end if
else
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)
return
@ -330,7 +353,6 @@ function psb_znrm2_vect(x, desc_a, info) result(res)
end function psb_znrm2_vect
!!$
!!$ Parallel Sparse BLAS version 3.5
!!$ (C) Copyright 2006-2018
@ -374,7 +396,7 @@ end function psb_znrm2_vect
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
subroutine psb_znrm2vs(res, x, desc_a, info)
subroutine psb_znrm2vs(res, x, desc_a, info,global)
use psb_desc_mod
use psb_check_mod
use psb_error_mod
@ -385,11 +407,13 @@ subroutine psb_znrm2vs(res, x, desc_a, info)
real(psb_dpk_), intent(out) :: res
type(psb_desc_type), intent(in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, ndim, i, id, idx, ndm, ldx
integer(psb_lpk_) :: ix, jx, iy, ijy, m
logical :: global_
real(psb_dpk_) :: nrm2, dznrm2, dd
character(len=20) :: name, ch_err
@ -407,6 +431,12 @@ subroutine psb_znrm2vs(res, x, desc_a, info)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ix = 1
jx = 1
m = desc_a%get_global_rows()
@ -439,7 +469,7 @@ subroutine psb_znrm2vs(res, x, desc_a, info)
res = dzero
end if
call psb_nrm2(ictxt,res)
if (global_) call psb_nrm2(ictxt,res)
call psb_erractionrestore(err_act)

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_znrmi(a,desc_a,info) result(res)
function psb_znrmi(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_znrmi
implicit none
@ -49,11 +49,13 @@ function psb_znrmi(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
name='psb_znrmi'
@ -70,6 +72,12 @@ function psb_znrmi(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -102,7 +110,7 @@ function psb_znrmi(a,desc_a,info) result(res)
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

@ -41,7 +41,7 @@
! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. Return code
!
function psb_zspnrm1(a,desc_a,info) result(res)
function psb_zspnrm1(a,desc_a,info,global) result(res)
use psb_base_mod, psb_protect_name => psb_zspnrm1
implicit none
@ -49,11 +49,13 @@ function psb_zspnrm1(a,desc_a,info) result(res)
integer(psb_ipk_), intent(out) :: info
type(psb_desc_type), intent(in) :: desc_a
real(psb_dpk_) :: res
logical, intent(in), optional :: global
! locals
integer(psb_ipk_) :: ictxt, np, me, nr,nc,&
& err_act, iia, jja, mdim, ndim
integer(psb_lpk_) :: ix, ijx, iy, ijy, m, n, ia, ja
logical :: global_
character(len=20) :: name, ch_err
real(psb_dpk_), allocatable :: v(:)
@ -71,6 +73,12 @@ function psb_zspnrm1(a,desc_a,info) result(res)
goto 9999
endif
if (present(global)) then
global_ = global
else
global_ = .true.
end if
ia = 1
ja = 1
m = desc_a%get_global_rows()
@ -120,7 +128,7 @@ function psb_zspnrm1(a,desc_a,info) result(res)
res = dzero
end if
! compute global max
call psb_amx(ictxt, res)
if (global_) call psb_amx(ictxt, res)
call psb_erractionrestore(err_act)
return

Loading…
Cancel
Save