Added Element-by-Element divison

merge-paraggr-newops
cirdans-home 5 years ago
parent f66d19e54b
commit ce6383b7ff

@ -439,4 +439,15 @@ module psb_c_psblas_mod
end subroutine psb_cmlt_vect
end interface
interface psb_gediv
subroutine psb_cdiv_vect(x,y,desc_a,info)
import :: psb_desc_type, psb_ipk_, &
& psb_c_vect_type
type(psb_c_vect_type), intent (inout) :: x
type(psb_c_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_cdiv_vect
end interface
end module psb_c_psblas_mod

@ -439,4 +439,15 @@ module psb_d_psblas_mod
end subroutine psb_dmlt_vect
end interface
interface psb_gediv
subroutine psb_ddiv_vect(x,y,desc_a,info)
import :: psb_desc_type, psb_ipk_, &
& psb_d_vect_type
type(psb_d_vect_type), intent (inout) :: x
type(psb_d_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_ddiv_vect
end interface
end module psb_d_psblas_mod

@ -439,4 +439,15 @@ module psb_s_psblas_mod
end subroutine psb_smlt_vect
end interface
interface psb_gediv
subroutine psb_sdiv_vect(x,y,desc_a,info)
import :: psb_desc_type, psb_ipk_, &
& psb_s_vect_type
type(psb_s_vect_type), intent (inout) :: x
type(psb_s_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_sdiv_vect
end interface
end module psb_s_psblas_mod

@ -439,4 +439,15 @@ module psb_z_psblas_mod
end subroutine psb_zmlt_vect
end interface
interface psb_gediv
subroutine psb_zdiv_vect(x,y,desc_a,info)
import :: psb_desc_type, psb_ipk_, &
& psb_z_vect_type
type(psb_z_vect_type), intent (inout) :: x
type(psb_z_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
end subroutine psb_zdiv_vect
end interface
end module psb_z_psblas_mod

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
!
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@ -15,7 +15,7 @@
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@ -27,15 +27,15 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
!
! package: psb_c_vect_mod
!
! This module contains the definition of the psb_c_vect type which
! is the outer container for dense vectors.
! Therefore all methods simply invoke the corresponding methods of the
! inner component.
! inner component.
!
module psb_c_vect_mod
@ -43,7 +43,7 @@ module psb_c_vect_mod
use psb_i_vect_mod
type psb_c_vect_type
class(psb_c_base_vect_type), allocatable :: v
class(psb_c_base_vect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => c_vect_get_nrows
procedure, pass(x) :: sizeof => c_vect_sizeof
@ -94,13 +94,16 @@ module psb_c_vect_mod
procedure, pass(z) :: mlt_av => c_vect_mlt_av
generic, public :: mlt => mlt_v, mlt_a, mlt_a_2,&
& mlt_v_2, mlt_av, mlt_va
procedure, pass(x) :: div_v => c_vect_div_v
procedure, pass(z) :: div_a2 => c_vect_div_a2
generic, public :: div => div_v, div_a2
procedure, pass(x) :: scal => c_vect_scal
procedure, pass(x) :: absval1 => c_vect_absval1
procedure, pass(x) :: absval2 => c_vect_absval2
generic, public :: absval => absval1, absval2
procedure, pass(x) :: nrm2 => c_vect_nrm2
procedure, pass(x) :: amax => c_vect_amax
procedure, pass(x) :: asum => c_vect_asum
procedure, pass(x) :: asum => c_vect_asum
end type psb_c_vect_type
public :: psb_c_vect
@ -122,7 +125,7 @@ module psb_c_vect_mod
private :: c_vect_dot_v, c_vect_dot_a, c_vect_axpby_v, c_vect_axpby_a, &
& c_vect_mlt_v, c_vect_mlt_a, c_vect_mlt_a_2, c_vect_mlt_v_2, &
& c_vect_mlt_va, c_vect_mlt_av, c_vect_scal, c_vect_absval1, &
& c_vect_absval2, c_vect_nrm2, c_vect_amax, c_vect_asum
& c_vect_absval2, c_vect_nrm2, c_vect_amax, c_vect_asum
@ -141,11 +144,11 @@ module psb_c_vect_mod
contains
subroutine psb_c_set_vect_default(v)
implicit none
subroutine psb_c_set_vect_default(v)
implicit none
class(psb_c_base_vect_type), intent(in) :: v
if (allocated(psb_c_base_vect_default)) then
if (allocated(psb_c_base_vect_default)) then
deallocate(psb_c_base_vect_default)
end if
allocate(psb_c_base_vect_default, mold=v)
@ -153,7 +156,7 @@ contains
end subroutine psb_c_set_vect_default
function psb_c_get_vect_default(v) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(in) :: v
class(psb_c_base_vect_type), pointer :: res
@ -163,10 +166,10 @@ contains
function psb_c_get_base_vect_default() result(res)
implicit none
implicit none
class(psb_c_base_vect_type), pointer :: res
if (.not.allocated(psb_c_base_vect_default)) then
if (.not.allocated(psb_c_base_vect_default)) then
allocate(psb_c_base_vect_type :: psb_c_base_vect_default)
end if
@ -176,14 +179,14 @@ contains
subroutine c_vect_clone(x,y,info)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine c_vect_clone
@ -198,7 +201,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_c_get_base_vect_default())
@ -220,7 +223,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_c_get_base_vect_default())
@ -241,7 +244,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_c_get_base_vect_default())
@ -304,7 +307,7 @@ contains
end function size_const
function c_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -312,7 +315,7 @@ contains
end function c_vect_get_nrows
function c_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -320,7 +323,7 @@ contains
end function c_vect_sizeof
function c_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -329,7 +332,7 @@ contains
subroutine c_vect_all(n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_base_vect_type), intent(in), optional :: mold
@ -338,12 +341,12 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_c_base_vect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(n,info)
else
info = psb_err_alloc_dealloc_
@ -353,12 +356,12 @@ contains
subroutine c_vect_reall(n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(n,info)
if (info == 0) &
@ -368,7 +371,7 @@ contains
subroutine c_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -378,7 +381,7 @@ contains
subroutine c_vect_asb(n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -424,12 +427,12 @@ contains
subroutine c_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -438,7 +441,7 @@ contains
subroutine c_vect_ins_a(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -448,7 +451,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -459,7 +462,7 @@ contains
subroutine c_vect_ins_v(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
class(psb_i_vect_type), intent(inout) :: irl
@ -469,7 +472,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
info = psb_err_invalid_vect_state_
return
end if
@ -487,12 +490,12 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info,mold=psb_c_get_base_vect_default())
end if
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -503,7 +506,7 @@ contains
subroutine c_vect_sync(x)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -512,7 +515,7 @@ contains
end subroutine c_vect_sync
subroutine c_vect_set_sync(x)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -521,7 +524,7 @@ contains
end subroutine c_vect_set_sync
subroutine c_vect_set_host(x)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -530,7 +533,7 @@ contains
end subroutine c_vect_set_host
subroutine c_vect_set_dev(x)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -539,7 +542,7 @@ contains
end subroutine c_vect_set_dev
function c_vect_is_sync(x) result(res)
implicit none
implicit none
logical :: res
class(psb_c_vect_type), intent(inout) :: x
@ -550,7 +553,7 @@ contains
end function c_vect_is_sync
function c_vect_is_host(x) result(res)
implicit none
implicit none
logical :: res
class(psb_c_vect_type), intent(inout) :: x
@ -561,11 +564,11 @@ contains
end function c_vect_is_host
function c_vect_is_dev(x) result(res)
implicit none
implicit none
logical :: res
class(psb_c_vect_type), intent(inout) :: x
res = .false.
res = .false.
if (allocated(x%v)) &
& res = x%v%is_dev()
@ -573,7 +576,7 @@ contains
function c_vect_dot_v(n,x,y) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x, y
integer(psb_ipk_), intent(in) :: n
complex(psb_spk_) :: res
@ -585,7 +588,7 @@ contains
end function c_vect_dot_v
function c_vect_dot_a(n,x,y) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
complex(psb_spk_), intent(in) :: y(:)
integer(psb_ipk_), intent(in) :: n
@ -599,14 +602,14 @@ contains
subroutine c_vect_axpby_v(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_vect_type), intent(inout) :: y
complex(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,info)
else
info = psb_err_invalid_vect_state_
@ -616,7 +619,7 @@ contains
subroutine c_vect_axpby_a(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
complex(psb_spk_), intent(in) :: x(:)
class(psb_c_vect_type), intent(inout) :: y
@ -631,10 +634,10 @@ contains
subroutine c_vect_mlt_v(x, y, info)
use psi_serial_mod
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -645,7 +648,7 @@ contains
subroutine c_vect_mlt_a(x, y, info)
use psi_serial_mod
implicit none
implicit none
complex(psb_spk_), intent(in) :: x(:)
class(psb_c_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
@ -661,7 +664,7 @@ contains
subroutine c_vect_mlt_a_2(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
complex(psb_spk_), intent(in) :: alpha,beta
complex(psb_spk_), intent(in) :: y(:)
complex(psb_spk_), intent(in) :: x(:)
@ -669,7 +672,7 @@ contains
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
info = 0
if (allocated(z%v)) &
& call z%v%mlt(alpha,x,y,beta,info)
@ -677,12 +680,12 @@ contains
subroutine c_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
use psi_serial_mod
implicit none
implicit none
complex(psb_spk_), intent(in) :: alpha,beta
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_vect_type), intent(inout) :: y
class(psb_c_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
character(len=1), intent(in), optional :: conjgx, conjgy
integer(psb_ipk_) :: i, n
@ -696,12 +699,12 @@ contains
subroutine c_vect_mlt_av(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
complex(psb_spk_), intent(in) :: alpha,beta
complex(psb_spk_), intent(in) :: x(:)
class(psb_c_vect_type), intent(inout) :: y
class(psb_c_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -712,12 +715,12 @@ contains
subroutine c_vect_mlt_va(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
complex(psb_spk_), intent(in) :: alpha,beta
complex(psb_spk_), intent(in) :: y(:)
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -727,9 +730,38 @@ contains
end subroutine c_vect_mlt_va
subroutine c_vect_div_v(x, y, info)
use psi_serial_mod
implicit none
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(x%v).and.allocated(y%v)) &
& call x%v%div(y%v,info)
end subroutine c_vect_div_v
subroutine c_vect_div_a2(x, y, z, info)
use psi_serial_mod
implicit none
complex(psb_spk_), intent(in) :: x(:)
complex(psb_spk_), intent(in) :: y(:)
class(psb_c_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(z%v)) &
& call z%v%div(x,y,info)
end subroutine c_vect_div_a2
subroutine c_vect_scal(alpha, x)
use psi_serial_mod
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
complex(psb_spk_), intent (in) :: alpha
@ -749,19 +781,19 @@ contains
class(psb_c_vect_type), intent(inout) :: x
class(psb_c_vect_type), intent(inout) :: y
if (allocated(x%v)) then
if (allocated(x%v)) then
if (.not.allocated(y%v)) call y%bld(psb_size(x%v%v))
call x%v%absval(y%v)
end if
end subroutine c_vect_absval2
function c_vect_nrm2(n,x) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%nrm2(n)
else
res = szero
@ -770,12 +802,12 @@ contains
end function c_vect_nrm2
function c_vect_amax(n,x) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%amax(n)
else
res = szero
@ -784,12 +816,12 @@ contains
end function c_vect_amax
function c_vect_asum(n,x) result(res)
implicit none
implicit none
class(psb_c_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%asum(n)
else
res = szero
@ -812,7 +844,7 @@ module psb_c_multivect_mod
!private
type psb_c_multivect_type
class(psb_c_base_multivect_type), allocatable :: v
class(psb_c_base_multivect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => c_vect_get_nrows
procedure, pass(x) :: get_ncols => c_vect_get_ncols
@ -886,11 +918,11 @@ module psb_c_multivect_mod
contains
subroutine psb_c_set_multivect_default(v)
implicit none
subroutine psb_c_set_multivect_default(v)
implicit none
class(psb_c_base_multivect_type), intent(in) :: v
if (allocated(psb_c_base_multivect_default)) then
if (allocated(psb_c_base_multivect_default)) then
deallocate(psb_c_base_multivect_default)
end if
allocate(psb_c_base_multivect_default, mold=v)
@ -898,7 +930,7 @@ contains
end subroutine psb_c_set_multivect_default
function psb_c_get_multivect_default(v) result(res)
implicit none
implicit none
class(psb_c_multivect_type), intent(in) :: v
class(psb_c_base_multivect_type), pointer :: res
@ -908,10 +940,10 @@ contains
function psb_c_get_base_multivect_default() result(res)
implicit none
implicit none
class(psb_c_base_multivect_type), pointer :: res
if (.not.allocated(psb_c_base_multivect_default)) then
if (.not.allocated(psb_c_base_multivect_default)) then
allocate(psb_c_base_multivect_type :: psb_c_base_multivect_default)
end if
@ -921,14 +953,14 @@ contains
subroutine c_vect_clone(x,y,info)
implicit none
implicit none
class(psb_c_multivect_type), intent(inout) :: x
class(psb_c_multivect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine c_vect_clone
@ -941,7 +973,7 @@ contains
class(psb_c_base_multivect_type), pointer :: mld
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_c_get_base_multivect_default())
@ -959,7 +991,7 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_c_get_base_multivect_default())
@ -1019,7 +1051,7 @@ contains
end function size_const
function c_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_c_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1027,7 +1059,7 @@ contains
end function c_vect_get_nrows
function c_vect_get_ncols(x) result(res)
implicit none
implicit none
class(psb_c_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1035,7 +1067,7 @@ contains
end function c_vect_get_ncols
function c_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_c_multivect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -1043,7 +1075,7 @@ contains
end function c_vect_sizeof
function c_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_c_multivect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -1052,18 +1084,18 @@ contains
subroutine c_vect_all(m,n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_c_multivect_type), intent(out) :: x
class(psb_c_base_multivect_type), intent(in), optional :: mold
integer(psb_ipk_), intent(out) :: info
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_c_base_multivect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(m,n,info)
else
info = psb_err_alloc_dealloc_
@ -1073,12 +1105,12 @@ contains
subroutine c_vect_reall(m,n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_c_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(m,n,info)
if (info == 0) &
@ -1088,7 +1120,7 @@ contains
subroutine c_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_c_multivect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -1098,7 +1130,7 @@ contains
subroutine c_vect_asb(m,n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_c_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -1109,7 +1141,7 @@ contains
end subroutine c_vect_asb
subroutine c_vect_sync(x)
implicit none
implicit none
class(psb_c_multivect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -1177,12 +1209,12 @@ contains
subroutine c_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_c_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -1191,7 +1223,7 @@ contains
subroutine c_vect_ins(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_c_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -1201,7 +1233,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -1217,12 +1249,12 @@ contains
class(psb_c_base_multivect_type), allocatable :: tmp
integer(psb_ipk_) :: info
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info, mold=psb_c_get_base_multivect_default())
endif
if (allocated(x%v)) then
endif
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -1232,7 +1264,7 @@ contains
!!$ function c_vect_dot_v(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_c_multivect_type), intent(inout) :: x, y
!!$ integer(psb_ipk_), intent(in) :: n
!!$ complex(psb_spk_) :: res
@ -1244,28 +1276,28 @@ contains
!!$ end function c_vect_dot_v
!!$
!!$ function c_vect_dot_a(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ complex(psb_spk_), intent(in) :: y(:)
!!$ integer(psb_ipk_), intent(in) :: n
!!$ complex(psb_spk_) :: res
!!$
!!$
!!$ res = czero
!!$ if (allocated(x%v)) &
!!$ & res = x%v%dot(n,y)
!!$
!!$
!!$ end function c_vect_dot_a
!!$
!!$
!!$ subroutine c_vect_axpby_v(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ class(psb_c_multivect_type), intent(inout) :: y
!!$ complex(psb_spk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$ call y%v%axpby(m,alpha,x%v,beta,info)
!!$ else
!!$ info = psb_err_invalid_vect_state_
@ -1275,25 +1307,25 @@ contains
!!$
!!$ subroutine c_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ complex(psb_spk_), intent(in) :: x(:)
!!$ class(psb_c_multivect_type), intent(inout) :: y
!!$ complex(psb_spk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$
!!$ if (allocated(y%v)) &
!!$ & call y%v%axpby(m,alpha,x,beta,info)
!!$
!!$
!!$ end subroutine c_vect_axpby_a
!!$
!!$
!!$
!!$ subroutine c_vect_mlt_v(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ class(psb_c_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1304,7 +1336,7 @@ contains
!!$
!!$ subroutine c_vect_mlt_a(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_spk_), intent(in) :: x(:)
!!$ class(psb_c_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
@ -1314,13 +1346,13 @@ contains
!!$ info = 0
!!$ if (allocated(y%v)) &
!!$ & call y%v%mlt(x,info)
!!$
!!$
!!$ end subroutine c_vect_mlt_a
!!$
!!$
!!$ subroutine c_vect_mlt_a_2(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_spk_), intent(in) :: alpha,beta
!!$ complex(psb_spk_), intent(in) :: y(:)
!!$ complex(psb_spk_), intent(in) :: x(:)
@ -1328,20 +1360,20 @@ contains
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$ info = 0
!!$ if (allocated(z%v)) &
!!$ & call z%v%mlt(alpha,x,y,beta,info)
!!$
!!$
!!$ end subroutine c_vect_mlt_a_2
!!$
!!$ subroutine c_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_spk_), intent(in) :: alpha,beta
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ class(psb_c_multivect_type), intent(inout) :: y
!!$ class(psb_c_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ character(len=1), intent(in), optional :: conjgx, conjgy
!!$
!!$ integer(psb_ipk_) :: i, n
@ -1355,12 +1387,12 @@ contains
!!$
!!$ subroutine c_vect_mlt_av(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_spk_), intent(in) :: alpha,beta
!!$ complex(psb_spk_), intent(in) :: x(:)
!!$ class(psb_c_multivect_type), intent(inout) :: y
!!$ class(psb_c_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1371,16 +1403,16 @@ contains
!!$
!!$ subroutine c_vect_mlt_va(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_spk_), intent(in) :: alpha,beta
!!$ complex(psb_spk_), intent(in) :: y(:)
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ class(psb_c_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$
!!$
!!$ if (allocated(z%v).and.allocated(x%v)) &
!!$ & call z%v%mlt(alpha,x%v,y,beta,info)
!!$
@ -1388,36 +1420,36 @@ contains
!!$
!!$ subroutine c_vect_scal(alpha, x)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ complex(psb_spk_), intent (in) :: alpha
!!$
!!$
!!$ if (allocated(x%v)) call x%v%scal(alpha)
!!$
!!$ end subroutine c_vect_scal
!!$
!!$
!!$ function c_vect_nrm2(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$
!!$ if (allocated(x%v)) then
!!$ res = x%v%nrm2(n)
!!$ else
!!$ res = szero
!!$ end if
!!$
!!$ end function c_vect_nrm2
!!$
!!$
!!$ function c_vect_amax(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%amax(n)
!!$ else
!!$ res = szero
@ -1426,12 +1458,12 @@ contains
!!$ end function c_vect_amax
!!$
!!$ function c_vect_asum(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_c_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%asum(n)
!!$ else
!!$ res = szero

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
!
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@ -15,7 +15,7 @@
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@ -27,15 +27,15 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
!
! package: psb_d_vect_mod
!
! This module contains the definition of the psb_d_vect type which
! is the outer container for dense vectors.
! Therefore all methods simply invoke the corresponding methods of the
! inner component.
! inner component.
!
module psb_d_vect_mod
@ -43,7 +43,7 @@ module psb_d_vect_mod
use psb_i_vect_mod
type psb_d_vect_type
class(psb_d_base_vect_type), allocatable :: v
class(psb_d_base_vect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => d_vect_get_nrows
procedure, pass(x) :: sizeof => d_vect_sizeof
@ -94,13 +94,16 @@ module psb_d_vect_mod
procedure, pass(z) :: mlt_av => d_vect_mlt_av
generic, public :: mlt => mlt_v, mlt_a, mlt_a_2,&
& mlt_v_2, mlt_av, mlt_va
procedure, pass(x) :: div_v => d_vect_div_v
procedure, pass(z) :: div_a2 => d_vect_div_a2
generic, public :: div => div_v, div_a2
procedure, pass(x) :: scal => d_vect_scal
procedure, pass(x) :: absval1 => d_vect_absval1
procedure, pass(x) :: absval2 => d_vect_absval2
generic, public :: absval => absval1, absval2
procedure, pass(x) :: nrm2 => d_vect_nrm2
procedure, pass(x) :: amax => d_vect_amax
procedure, pass(x) :: asum => d_vect_asum
procedure, pass(x) :: asum => d_vect_asum
end type psb_d_vect_type
public :: psb_d_vect
@ -122,7 +125,7 @@ module psb_d_vect_mod
private :: d_vect_dot_v, d_vect_dot_a, d_vect_axpby_v, d_vect_axpby_a, &
& d_vect_mlt_v, d_vect_mlt_a, d_vect_mlt_a_2, d_vect_mlt_v_2, &
& d_vect_mlt_va, d_vect_mlt_av, d_vect_scal, d_vect_absval1, &
& d_vect_absval2, d_vect_nrm2, d_vect_amax, d_vect_asum
& d_vect_absval2, d_vect_nrm2, d_vect_amax, d_vect_asum
@ -141,11 +144,11 @@ module psb_d_vect_mod
contains
subroutine psb_d_set_vect_default(v)
implicit none
subroutine psb_d_set_vect_default(v)
implicit none
class(psb_d_base_vect_type), intent(in) :: v
if (allocated(psb_d_base_vect_default)) then
if (allocated(psb_d_base_vect_default)) then
deallocate(psb_d_base_vect_default)
end if
allocate(psb_d_base_vect_default, mold=v)
@ -153,7 +156,7 @@ contains
end subroutine psb_d_set_vect_default
function psb_d_get_vect_default(v) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(in) :: v
class(psb_d_base_vect_type), pointer :: res
@ -163,10 +166,10 @@ contains
function psb_d_get_base_vect_default() result(res)
implicit none
implicit none
class(psb_d_base_vect_type), pointer :: res
if (.not.allocated(psb_d_base_vect_default)) then
if (.not.allocated(psb_d_base_vect_default)) then
allocate(psb_d_base_vect_type :: psb_d_base_vect_default)
end if
@ -176,14 +179,14 @@ contains
subroutine d_vect_clone(x,y,info)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine d_vect_clone
@ -198,7 +201,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_d_get_base_vect_default())
@ -220,7 +223,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_d_get_base_vect_default())
@ -241,7 +244,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_d_get_base_vect_default())
@ -304,7 +307,7 @@ contains
end function size_const
function d_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -312,7 +315,7 @@ contains
end function d_vect_get_nrows
function d_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -320,7 +323,7 @@ contains
end function d_vect_sizeof
function d_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -329,7 +332,7 @@ contains
subroutine d_vect_all(n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_base_vect_type), intent(in), optional :: mold
@ -338,12 +341,12 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_d_base_vect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(n,info)
else
info = psb_err_alloc_dealloc_
@ -353,12 +356,12 @@ contains
subroutine d_vect_reall(n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(n,info)
if (info == 0) &
@ -368,7 +371,7 @@ contains
subroutine d_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -378,7 +381,7 @@ contains
subroutine d_vect_asb(n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -424,12 +427,12 @@ contains
subroutine d_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -438,7 +441,7 @@ contains
subroutine d_vect_ins_a(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -448,7 +451,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -459,7 +462,7 @@ contains
subroutine d_vect_ins_v(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
class(psb_i_vect_type), intent(inout) :: irl
@ -469,7 +472,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
info = psb_err_invalid_vect_state_
return
end if
@ -487,12 +490,12 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info,mold=psb_d_get_base_vect_default())
end if
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -503,7 +506,7 @@ contains
subroutine d_vect_sync(x)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -512,7 +515,7 @@ contains
end subroutine d_vect_sync
subroutine d_vect_set_sync(x)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -521,7 +524,7 @@ contains
end subroutine d_vect_set_sync
subroutine d_vect_set_host(x)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -530,7 +533,7 @@ contains
end subroutine d_vect_set_host
subroutine d_vect_set_dev(x)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -539,7 +542,7 @@ contains
end subroutine d_vect_set_dev
function d_vect_is_sync(x) result(res)
implicit none
implicit none
logical :: res
class(psb_d_vect_type), intent(inout) :: x
@ -550,7 +553,7 @@ contains
end function d_vect_is_sync
function d_vect_is_host(x) result(res)
implicit none
implicit none
logical :: res
class(psb_d_vect_type), intent(inout) :: x
@ -561,11 +564,11 @@ contains
end function d_vect_is_host
function d_vect_is_dev(x) result(res)
implicit none
implicit none
logical :: res
class(psb_d_vect_type), intent(inout) :: x
res = .false.
res = .false.
if (allocated(x%v)) &
& res = x%v%is_dev()
@ -573,7 +576,7 @@ contains
function d_vect_dot_v(n,x,y) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x, y
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
@ -585,7 +588,7 @@ contains
end function d_vect_dot_v
function d_vect_dot_a(n,x,y) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
real(psb_dpk_), intent(in) :: y(:)
integer(psb_ipk_), intent(in) :: n
@ -599,14 +602,14 @@ contains
subroutine d_vect_axpby_v(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_vect_type), intent(inout) :: y
real(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,info)
else
info = psb_err_invalid_vect_state_
@ -616,7 +619,7 @@ contains
subroutine d_vect_axpby_a(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
real(psb_dpk_), intent(in) :: x(:)
class(psb_d_vect_type), intent(inout) :: y
@ -631,10 +634,10 @@ contains
subroutine d_vect_mlt_v(x, y, info)
use psi_serial_mod
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -645,7 +648,7 @@ contains
subroutine d_vect_mlt_a(x, y, info)
use psi_serial_mod
implicit none
implicit none
real(psb_dpk_), intent(in) :: x(:)
class(psb_d_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
@ -661,7 +664,7 @@ contains
subroutine d_vect_mlt_a_2(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
real(psb_dpk_), intent(in) :: alpha,beta
real(psb_dpk_), intent(in) :: y(:)
real(psb_dpk_), intent(in) :: x(:)
@ -669,7 +672,7 @@ contains
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
info = 0
if (allocated(z%v)) &
& call z%v%mlt(alpha,x,y,beta,info)
@ -677,12 +680,12 @@ contains
subroutine d_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
use psi_serial_mod
implicit none
implicit none
real(psb_dpk_), intent(in) :: alpha,beta
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_vect_type), intent(inout) :: y
class(psb_d_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
character(len=1), intent(in), optional :: conjgx, conjgy
integer(psb_ipk_) :: i, n
@ -696,12 +699,12 @@ contains
subroutine d_vect_mlt_av(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
real(psb_dpk_), intent(in) :: alpha,beta
real(psb_dpk_), intent(in) :: x(:)
class(psb_d_vect_type), intent(inout) :: y
class(psb_d_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -712,12 +715,12 @@ contains
subroutine d_vect_mlt_va(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
real(psb_dpk_), intent(in) :: alpha,beta
real(psb_dpk_), intent(in) :: y(:)
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -727,9 +730,38 @@ contains
end subroutine d_vect_mlt_va
subroutine d_vect_div_v(x, y, info)
use psi_serial_mod
implicit none
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(x%v).and.allocated(y%v)) &
& call x%v%div(y%v,info)
end subroutine d_vect_div_v
subroutine d_vect_div_a2(x, y, z, info)
use psi_serial_mod
implicit none
real(psb_dpk_), intent(in) :: x(:)
real(psb_dpk_), intent(in) :: y(:)
class(psb_d_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(z%v)) &
& call z%v%div(x,y,info)
end subroutine d_vect_div_a2
subroutine d_vect_scal(alpha, x)
use psi_serial_mod
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
real(psb_dpk_), intent (in) :: alpha
@ -749,19 +781,19 @@ contains
class(psb_d_vect_type), intent(inout) :: x
class(psb_d_vect_type), intent(inout) :: y
if (allocated(x%v)) then
if (allocated(x%v)) then
if (.not.allocated(y%v)) call y%bld(psb_size(x%v%v))
call x%v%absval(y%v)
end if
end subroutine d_vect_absval2
function d_vect_nrm2(n,x) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%nrm2(n)
else
res = dzero
@ -770,12 +802,12 @@ contains
end function d_vect_nrm2
function d_vect_amax(n,x) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%amax(n)
else
res = dzero
@ -784,12 +816,12 @@ contains
end function d_vect_amax
function d_vect_asum(n,x) result(res)
implicit none
implicit none
class(psb_d_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%asum(n)
else
res = dzero
@ -812,7 +844,7 @@ module psb_d_multivect_mod
!private
type psb_d_multivect_type
class(psb_d_base_multivect_type), allocatable :: v
class(psb_d_base_multivect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => d_vect_get_nrows
procedure, pass(x) :: get_ncols => d_vect_get_ncols
@ -886,11 +918,11 @@ module psb_d_multivect_mod
contains
subroutine psb_d_set_multivect_default(v)
implicit none
subroutine psb_d_set_multivect_default(v)
implicit none
class(psb_d_base_multivect_type), intent(in) :: v
if (allocated(psb_d_base_multivect_default)) then
if (allocated(psb_d_base_multivect_default)) then
deallocate(psb_d_base_multivect_default)
end if
allocate(psb_d_base_multivect_default, mold=v)
@ -898,7 +930,7 @@ contains
end subroutine psb_d_set_multivect_default
function psb_d_get_multivect_default(v) result(res)
implicit none
implicit none
class(psb_d_multivect_type), intent(in) :: v
class(psb_d_base_multivect_type), pointer :: res
@ -908,10 +940,10 @@ contains
function psb_d_get_base_multivect_default() result(res)
implicit none
implicit none
class(psb_d_base_multivect_type), pointer :: res
if (.not.allocated(psb_d_base_multivect_default)) then
if (.not.allocated(psb_d_base_multivect_default)) then
allocate(psb_d_base_multivect_type :: psb_d_base_multivect_default)
end if
@ -921,14 +953,14 @@ contains
subroutine d_vect_clone(x,y,info)
implicit none
implicit none
class(psb_d_multivect_type), intent(inout) :: x
class(psb_d_multivect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine d_vect_clone
@ -941,7 +973,7 @@ contains
class(psb_d_base_multivect_type), pointer :: mld
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_d_get_base_multivect_default())
@ -959,7 +991,7 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_d_get_base_multivect_default())
@ -1019,7 +1051,7 @@ contains
end function size_const
function d_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_d_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1027,7 +1059,7 @@ contains
end function d_vect_get_nrows
function d_vect_get_ncols(x) result(res)
implicit none
implicit none
class(psb_d_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1035,7 +1067,7 @@ contains
end function d_vect_get_ncols
function d_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_d_multivect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -1043,7 +1075,7 @@ contains
end function d_vect_sizeof
function d_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_d_multivect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -1052,18 +1084,18 @@ contains
subroutine d_vect_all(m,n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_d_multivect_type), intent(out) :: x
class(psb_d_base_multivect_type), intent(in), optional :: mold
integer(psb_ipk_), intent(out) :: info
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_d_base_multivect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(m,n,info)
else
info = psb_err_alloc_dealloc_
@ -1073,12 +1105,12 @@ contains
subroutine d_vect_reall(m,n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_d_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(m,n,info)
if (info == 0) &
@ -1088,7 +1120,7 @@ contains
subroutine d_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_d_multivect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -1098,7 +1130,7 @@ contains
subroutine d_vect_asb(m,n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_d_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -1109,7 +1141,7 @@ contains
end subroutine d_vect_asb
subroutine d_vect_sync(x)
implicit none
implicit none
class(psb_d_multivect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -1177,12 +1209,12 @@ contains
subroutine d_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_d_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -1191,7 +1223,7 @@ contains
subroutine d_vect_ins(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_d_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -1201,7 +1233,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -1217,12 +1249,12 @@ contains
class(psb_d_base_multivect_type), allocatable :: tmp
integer(psb_ipk_) :: info
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info, mold=psb_d_get_base_multivect_default())
endif
if (allocated(x%v)) then
endif
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -1232,7 +1264,7 @@ contains
!!$ function d_vect_dot_v(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_d_multivect_type), intent(inout) :: x, y
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
@ -1244,28 +1276,28 @@ contains
!!$ end function d_vect_dot_v
!!$
!!$ function d_vect_dot_a(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ real(psb_dpk_), intent(in) :: y(:)
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
!!$
!!$
!!$ res = dzero
!!$ if (allocated(x%v)) &
!!$ & res = x%v%dot(n,y)
!!$
!!$
!!$ end function d_vect_dot_a
!!$
!!$
!!$ subroutine d_vect_axpby_v(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ class(psb_d_multivect_type), intent(inout) :: y
!!$ real(psb_dpk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$ call y%v%axpby(m,alpha,x%v,beta,info)
!!$ else
!!$ info = psb_err_invalid_vect_state_
@ -1275,25 +1307,25 @@ contains
!!$
!!$ subroutine d_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ real(psb_dpk_), intent(in) :: x(:)
!!$ class(psb_d_multivect_type), intent(inout) :: y
!!$ real(psb_dpk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$
!!$ if (allocated(y%v)) &
!!$ & call y%v%axpby(m,alpha,x,beta,info)
!!$
!!$
!!$ end subroutine d_vect_axpby_a
!!$
!!$
!!$
!!$ subroutine d_vect_mlt_v(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ class(psb_d_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1304,7 +1336,7 @@ contains
!!$
!!$ subroutine d_vect_mlt_a(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_dpk_), intent(in) :: x(:)
!!$ class(psb_d_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
@ -1314,13 +1346,13 @@ contains
!!$ info = 0
!!$ if (allocated(y%v)) &
!!$ & call y%v%mlt(x,info)
!!$
!!$
!!$ end subroutine d_vect_mlt_a
!!$
!!$
!!$ subroutine d_vect_mlt_a_2(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_dpk_), intent(in) :: alpha,beta
!!$ real(psb_dpk_), intent(in) :: y(:)
!!$ real(psb_dpk_), intent(in) :: x(:)
@ -1328,20 +1360,20 @@ contains
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$ info = 0
!!$ if (allocated(z%v)) &
!!$ & call z%v%mlt(alpha,x,y,beta,info)
!!$
!!$
!!$ end subroutine d_vect_mlt_a_2
!!$
!!$ subroutine d_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_dpk_), intent(in) :: alpha,beta
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ class(psb_d_multivect_type), intent(inout) :: y
!!$ class(psb_d_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ character(len=1), intent(in), optional :: conjgx, conjgy
!!$
!!$ integer(psb_ipk_) :: i, n
@ -1355,12 +1387,12 @@ contains
!!$
!!$ subroutine d_vect_mlt_av(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_dpk_), intent(in) :: alpha,beta
!!$ real(psb_dpk_), intent(in) :: x(:)
!!$ class(psb_d_multivect_type), intent(inout) :: y
!!$ class(psb_d_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1371,16 +1403,16 @@ contains
!!$
!!$ subroutine d_vect_mlt_va(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_dpk_), intent(in) :: alpha,beta
!!$ real(psb_dpk_), intent(in) :: y(:)
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ class(psb_d_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$
!!$
!!$ if (allocated(z%v).and.allocated(x%v)) &
!!$ & call z%v%mlt(alpha,x%v,y,beta,info)
!!$
@ -1388,36 +1420,36 @@ contains
!!$
!!$ subroutine d_vect_scal(alpha, x)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ real(psb_dpk_), intent (in) :: alpha
!!$
!!$
!!$ if (allocated(x%v)) call x%v%scal(alpha)
!!$
!!$ end subroutine d_vect_scal
!!$
!!$
!!$ function d_vect_nrm2(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$
!!$ if (allocated(x%v)) then
!!$ res = x%v%nrm2(n)
!!$ else
!!$ res = dzero
!!$ end if
!!$
!!$ end function d_vect_nrm2
!!$
!!$
!!$ function d_vect_amax(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%amax(n)
!!$ else
!!$ res = dzero
@ -1426,12 +1458,12 @@ contains
!!$ end function d_vect_amax
!!$
!!$ function d_vect_asum(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_d_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%asum(n)
!!$ else
!!$ res = dzero

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
!
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@ -15,7 +15,7 @@
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@ -27,22 +27,22 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
!
! package: psb_i_vect_mod
!
! This module contains the definition of the psb_i_vect type which
! is the outer container for dense vectors.
! Therefore all methods simply invoke the corresponding methods of the
! inner component.
! inner component.
!
module psb_i_vect_mod
use psb_i_base_vect_mod
type psb_i_vect_type
class(psb_i_base_vect_type), allocatable :: v
class(psb_i_base_vect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => i_vect_get_nrows
procedure, pass(x) :: sizeof => i_vect_sizeof
@ -114,11 +114,11 @@ module psb_i_vect_mod
contains
subroutine psb_i_set_vect_default(v)
implicit none
subroutine psb_i_set_vect_default(v)
implicit none
class(psb_i_base_vect_type), intent(in) :: v
if (allocated(psb_i_base_vect_default)) then
if (allocated(psb_i_base_vect_default)) then
deallocate(psb_i_base_vect_default)
end if
allocate(psb_i_base_vect_default, mold=v)
@ -126,7 +126,7 @@ contains
end subroutine psb_i_set_vect_default
function psb_i_get_vect_default(v) result(res)
implicit none
implicit none
class(psb_i_vect_type), intent(in) :: v
class(psb_i_base_vect_type), pointer :: res
@ -136,10 +136,10 @@ contains
function psb_i_get_base_vect_default() result(res)
implicit none
implicit none
class(psb_i_base_vect_type), pointer :: res
if (.not.allocated(psb_i_base_vect_default)) then
if (.not.allocated(psb_i_base_vect_default)) then
allocate(psb_i_base_vect_type :: psb_i_base_vect_default)
end if
@ -149,14 +149,14 @@ contains
subroutine i_vect_clone(x,y,info)
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
class(psb_i_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine i_vect_clone
@ -171,7 +171,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_i_get_base_vect_default())
@ -193,7 +193,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_i_get_base_vect_default())
@ -214,7 +214,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_i_get_base_vect_default())
@ -277,7 +277,7 @@ contains
end function size_const
function i_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_i_vect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -285,7 +285,7 @@ contains
end function i_vect_get_nrows
function i_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_i_vect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -293,7 +293,7 @@ contains
end function i_vect_sizeof
function i_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_i_vect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -302,7 +302,7 @@ contains
subroutine i_vect_all(n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_i_vect_type), intent(inout) :: x
class(psb_i_base_vect_type), intent(in), optional :: mold
@ -311,12 +311,12 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_i_base_vect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(n,info)
else
info = psb_err_alloc_dealloc_
@ -326,12 +326,12 @@ contains
subroutine i_vect_reall(n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_i_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(n,info)
if (info == 0) &
@ -341,7 +341,7 @@ contains
subroutine i_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -351,7 +351,7 @@ contains
subroutine i_vect_asb(n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_i_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -397,12 +397,12 @@ contains
subroutine i_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -411,7 +411,7 @@ contains
subroutine i_vect_ins_a(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -421,7 +421,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -432,7 +432,7 @@ contains
subroutine i_vect_ins_v(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
class(psb_i_vect_type), intent(inout) :: irl
@ -442,7 +442,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
info = psb_err_invalid_vect_state_
return
end if
@ -460,12 +460,12 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info,mold=psb_i_get_base_vect_default())
end if
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -476,7 +476,7 @@ contains
subroutine i_vect_sync(x)
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -485,7 +485,7 @@ contains
end subroutine i_vect_sync
subroutine i_vect_set_sync(x)
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -494,7 +494,7 @@ contains
end subroutine i_vect_set_sync
subroutine i_vect_set_host(x)
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -503,7 +503,7 @@ contains
end subroutine i_vect_set_host
subroutine i_vect_set_dev(x)
implicit none
implicit none
class(psb_i_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -512,7 +512,7 @@ contains
end subroutine i_vect_set_dev
function i_vect_is_sync(x) result(res)
implicit none
implicit none
logical :: res
class(psb_i_vect_type), intent(inout) :: x
@ -523,7 +523,7 @@ contains
end function i_vect_is_sync
function i_vect_is_host(x) result(res)
implicit none
implicit none
logical :: res
class(psb_i_vect_type), intent(inout) :: x
@ -534,11 +534,11 @@ contains
end function i_vect_is_host
function i_vect_is_dev(x) result(res)
implicit none
implicit none
logical :: res
class(psb_i_vect_type), intent(inout) :: x
res = .false.
res = .false.
if (allocated(x%v)) &
& res = x%v%is_dev()
@ -559,7 +559,7 @@ module psb_i_multivect_mod
!private
type psb_i_multivect_type
class(psb_i_base_multivect_type), allocatable :: v
class(psb_i_base_multivect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => i_vect_get_nrows
procedure, pass(x) :: get_ncols => i_vect_get_ncols
@ -615,11 +615,11 @@ module psb_i_multivect_mod
contains
subroutine psb_i_set_multivect_default(v)
implicit none
subroutine psb_i_set_multivect_default(v)
implicit none
class(psb_i_base_multivect_type), intent(in) :: v
if (allocated(psb_i_base_multivect_default)) then
if (allocated(psb_i_base_multivect_default)) then
deallocate(psb_i_base_multivect_default)
end if
allocate(psb_i_base_multivect_default, mold=v)
@ -627,7 +627,7 @@ contains
end subroutine psb_i_set_multivect_default
function psb_i_get_multivect_default(v) result(res)
implicit none
implicit none
class(psb_i_multivect_type), intent(in) :: v
class(psb_i_base_multivect_type), pointer :: res
@ -637,10 +637,10 @@ contains
function psb_i_get_base_multivect_default() result(res)
implicit none
implicit none
class(psb_i_base_multivect_type), pointer :: res
if (.not.allocated(psb_i_base_multivect_default)) then
if (.not.allocated(psb_i_base_multivect_default)) then
allocate(psb_i_base_multivect_type :: psb_i_base_multivect_default)
end if
@ -650,14 +650,14 @@ contains
subroutine i_vect_clone(x,y,info)
implicit none
implicit none
class(psb_i_multivect_type), intent(inout) :: x
class(psb_i_multivect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine i_vect_clone
@ -670,7 +670,7 @@ contains
class(psb_i_base_multivect_type), pointer :: mld
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_i_get_base_multivect_default())
@ -688,7 +688,7 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_i_get_base_multivect_default())
@ -748,7 +748,7 @@ contains
end function size_const
function i_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_i_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -756,7 +756,7 @@ contains
end function i_vect_get_nrows
function i_vect_get_ncols(x) result(res)
implicit none
implicit none
class(psb_i_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -764,7 +764,7 @@ contains
end function i_vect_get_ncols
function i_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_i_multivect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -772,7 +772,7 @@ contains
end function i_vect_sizeof
function i_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_i_multivect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -781,18 +781,18 @@ contains
subroutine i_vect_all(m,n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_i_multivect_type), intent(out) :: x
class(psb_i_base_multivect_type), intent(in), optional :: mold
integer(psb_ipk_), intent(out) :: info
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_i_base_multivect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(m,n,info)
else
info = psb_err_alloc_dealloc_
@ -802,12 +802,12 @@ contains
subroutine i_vect_reall(m,n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_i_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(m,n,info)
if (info == 0) &
@ -817,7 +817,7 @@ contains
subroutine i_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_i_multivect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -827,7 +827,7 @@ contains
subroutine i_vect_asb(m,n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_i_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -838,7 +838,7 @@ contains
end subroutine i_vect_asb
subroutine i_vect_sync(x)
implicit none
implicit none
class(psb_i_multivect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -906,12 +906,12 @@ contains
subroutine i_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_i_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -920,7 +920,7 @@ contains
subroutine i_vect_ins(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_i_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -930,7 +930,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -946,12 +946,12 @@ contains
class(psb_i_base_multivect_type), allocatable :: tmp
integer(psb_ipk_) :: info
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info, mold=psb_i_get_base_multivect_default())
endif
if (allocated(x%v)) then
endif
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
!
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@ -15,7 +15,7 @@
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@ -27,15 +27,15 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
!
! package: psb_l_vect_mod
!
! This module contains the definition of the psb_l_vect type which
! is the outer container for dense vectors.
! Therefore all methods simply invoke the corresponding methods of the
! inner component.
! inner component.
!
module psb_l_vect_mod
@ -43,7 +43,7 @@ module psb_l_vect_mod
use psb_i_vect_mod
type psb_l_vect_type
class(psb_l_base_vect_type), allocatable :: v
class(psb_l_base_vect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => l_vect_get_nrows
procedure, pass(x) :: sizeof => l_vect_sizeof
@ -115,11 +115,11 @@ module psb_l_vect_mod
contains
subroutine psb_l_set_vect_default(v)
implicit none
subroutine psb_l_set_vect_default(v)
implicit none
class(psb_l_base_vect_type), intent(in) :: v
if (allocated(psb_l_base_vect_default)) then
if (allocated(psb_l_base_vect_default)) then
deallocate(psb_l_base_vect_default)
end if
allocate(psb_l_base_vect_default, mold=v)
@ -127,7 +127,7 @@ contains
end subroutine psb_l_set_vect_default
function psb_l_get_vect_default(v) result(res)
implicit none
implicit none
class(psb_l_vect_type), intent(in) :: v
class(psb_l_base_vect_type), pointer :: res
@ -137,10 +137,10 @@ contains
function psb_l_get_base_vect_default() result(res)
implicit none
implicit none
class(psb_l_base_vect_type), pointer :: res
if (.not.allocated(psb_l_base_vect_default)) then
if (.not.allocated(psb_l_base_vect_default)) then
allocate(psb_l_base_vect_type :: psb_l_base_vect_default)
end if
@ -150,14 +150,14 @@ contains
subroutine l_vect_clone(x,y,info)
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
class(psb_l_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine l_vect_clone
@ -172,7 +172,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_l_get_base_vect_default())
@ -194,7 +194,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_l_get_base_vect_default())
@ -215,7 +215,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_l_get_base_vect_default())
@ -278,7 +278,7 @@ contains
end function size_const
function l_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_l_vect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -286,7 +286,7 @@ contains
end function l_vect_get_nrows
function l_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_l_vect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -294,7 +294,7 @@ contains
end function l_vect_sizeof
function l_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_l_vect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -303,7 +303,7 @@ contains
subroutine l_vect_all(n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_l_vect_type), intent(inout) :: x
class(psb_l_base_vect_type), intent(in), optional :: mold
@ -312,12 +312,12 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_l_base_vect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(n,info)
else
info = psb_err_alloc_dealloc_
@ -327,12 +327,12 @@ contains
subroutine l_vect_reall(n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_l_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(n,info)
if (info == 0) &
@ -342,7 +342,7 @@ contains
subroutine l_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -352,7 +352,7 @@ contains
subroutine l_vect_asb(n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_l_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -398,12 +398,12 @@ contains
subroutine l_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -412,7 +412,7 @@ contains
subroutine l_vect_ins_a(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -422,7 +422,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -433,7 +433,7 @@ contains
subroutine l_vect_ins_v(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
class(psb_i_vect_type), intent(inout) :: irl
@ -443,7 +443,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
info = psb_err_invalid_vect_state_
return
end if
@ -461,12 +461,12 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info,mold=psb_l_get_base_vect_default())
end if
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -477,7 +477,7 @@ contains
subroutine l_vect_sync(x)
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -486,7 +486,7 @@ contains
end subroutine l_vect_sync
subroutine l_vect_set_sync(x)
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -495,7 +495,7 @@ contains
end subroutine l_vect_set_sync
subroutine l_vect_set_host(x)
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -504,7 +504,7 @@ contains
end subroutine l_vect_set_host
subroutine l_vect_set_dev(x)
implicit none
implicit none
class(psb_l_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -513,7 +513,7 @@ contains
end subroutine l_vect_set_dev
function l_vect_is_sync(x) result(res)
implicit none
implicit none
logical :: res
class(psb_l_vect_type), intent(inout) :: x
@ -524,7 +524,7 @@ contains
end function l_vect_is_sync
function l_vect_is_host(x) result(res)
implicit none
implicit none
logical :: res
class(psb_l_vect_type), intent(inout) :: x
@ -535,11 +535,11 @@ contains
end function l_vect_is_host
function l_vect_is_dev(x) result(res)
implicit none
implicit none
logical :: res
class(psb_l_vect_type), intent(inout) :: x
res = .false.
res = .false.
if (allocated(x%v)) &
& res = x%v%is_dev()
@ -560,7 +560,7 @@ module psb_l_multivect_mod
!private
type psb_l_multivect_type
class(psb_l_base_multivect_type), allocatable :: v
class(psb_l_base_multivect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => l_vect_get_nrows
procedure, pass(x) :: get_ncols => l_vect_get_ncols
@ -616,11 +616,11 @@ module psb_l_multivect_mod
contains
subroutine psb_l_set_multivect_default(v)
implicit none
subroutine psb_l_set_multivect_default(v)
implicit none
class(psb_l_base_multivect_type), intent(in) :: v
if (allocated(psb_l_base_multivect_default)) then
if (allocated(psb_l_base_multivect_default)) then
deallocate(psb_l_base_multivect_default)
end if
allocate(psb_l_base_multivect_default, mold=v)
@ -628,7 +628,7 @@ contains
end subroutine psb_l_set_multivect_default
function psb_l_get_multivect_default(v) result(res)
implicit none
implicit none
class(psb_l_multivect_type), intent(in) :: v
class(psb_l_base_multivect_type), pointer :: res
@ -638,10 +638,10 @@ contains
function psb_l_get_base_multivect_default() result(res)
implicit none
implicit none
class(psb_l_base_multivect_type), pointer :: res
if (.not.allocated(psb_l_base_multivect_default)) then
if (.not.allocated(psb_l_base_multivect_default)) then
allocate(psb_l_base_multivect_type :: psb_l_base_multivect_default)
end if
@ -651,14 +651,14 @@ contains
subroutine l_vect_clone(x,y,info)
implicit none
implicit none
class(psb_l_multivect_type), intent(inout) :: x
class(psb_l_multivect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine l_vect_clone
@ -671,7 +671,7 @@ contains
class(psb_l_base_multivect_type), pointer :: mld
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_l_get_base_multivect_default())
@ -689,7 +689,7 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_l_get_base_multivect_default())
@ -749,7 +749,7 @@ contains
end function size_const
function l_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_l_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -757,7 +757,7 @@ contains
end function l_vect_get_nrows
function l_vect_get_ncols(x) result(res)
implicit none
implicit none
class(psb_l_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -765,7 +765,7 @@ contains
end function l_vect_get_ncols
function l_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_l_multivect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -773,7 +773,7 @@ contains
end function l_vect_sizeof
function l_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_l_multivect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -782,18 +782,18 @@ contains
subroutine l_vect_all(m,n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_l_multivect_type), intent(out) :: x
class(psb_l_base_multivect_type), intent(in), optional :: mold
integer(psb_ipk_), intent(out) :: info
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_l_base_multivect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(m,n,info)
else
info = psb_err_alloc_dealloc_
@ -803,12 +803,12 @@ contains
subroutine l_vect_reall(m,n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_l_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(m,n,info)
if (info == 0) &
@ -818,7 +818,7 @@ contains
subroutine l_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_l_multivect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -828,7 +828,7 @@ contains
subroutine l_vect_asb(m,n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_l_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -839,7 +839,7 @@ contains
end subroutine l_vect_asb
subroutine l_vect_sync(x)
implicit none
implicit none
class(psb_l_multivect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -907,12 +907,12 @@ contains
subroutine l_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_l_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -921,7 +921,7 @@ contains
subroutine l_vect_ins(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_l_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -931,7 +931,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -947,12 +947,12 @@ contains
class(psb_l_base_multivect_type), allocatable :: tmp
integer(psb_ipk_) :: info
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info, mold=psb_l_get_base_multivect_default())
endif
if (allocated(x%v)) then
endif
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
!
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@ -15,7 +15,7 @@
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@ -27,15 +27,15 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
!
! package: psb_s_vect_mod
!
! This module contains the definition of the psb_s_vect type which
! is the outer container for dense vectors.
! Therefore all methods simply invoke the corresponding methods of the
! inner component.
! inner component.
!
module psb_s_vect_mod
@ -43,7 +43,7 @@ module psb_s_vect_mod
use psb_i_vect_mod
type psb_s_vect_type
class(psb_s_base_vect_type), allocatable :: v
class(psb_s_base_vect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => s_vect_get_nrows
procedure, pass(x) :: sizeof => s_vect_sizeof
@ -94,13 +94,16 @@ module psb_s_vect_mod
procedure, pass(z) :: mlt_av => s_vect_mlt_av
generic, public :: mlt => mlt_v, mlt_a, mlt_a_2,&
& mlt_v_2, mlt_av, mlt_va
procedure, pass(x) :: div_v => s_vect_div_v
procedure, pass(z) :: div_a2 => s_vect_div_a2
generic, public :: div => div_v, div_a2
procedure, pass(x) :: scal => s_vect_scal
procedure, pass(x) :: absval1 => s_vect_absval1
procedure, pass(x) :: absval2 => s_vect_absval2
generic, public :: absval => absval1, absval2
procedure, pass(x) :: nrm2 => s_vect_nrm2
procedure, pass(x) :: amax => s_vect_amax
procedure, pass(x) :: asum => s_vect_asum
procedure, pass(x) :: asum => s_vect_asum
end type psb_s_vect_type
public :: psb_s_vect
@ -122,7 +125,7 @@ module psb_s_vect_mod
private :: s_vect_dot_v, s_vect_dot_a, s_vect_axpby_v, s_vect_axpby_a, &
& s_vect_mlt_v, s_vect_mlt_a, s_vect_mlt_a_2, s_vect_mlt_v_2, &
& s_vect_mlt_va, s_vect_mlt_av, s_vect_scal, s_vect_absval1, &
& s_vect_absval2, s_vect_nrm2, s_vect_amax, s_vect_asum
& s_vect_absval2, s_vect_nrm2, s_vect_amax, s_vect_asum
@ -141,11 +144,11 @@ module psb_s_vect_mod
contains
subroutine psb_s_set_vect_default(v)
implicit none
subroutine psb_s_set_vect_default(v)
implicit none
class(psb_s_base_vect_type), intent(in) :: v
if (allocated(psb_s_base_vect_default)) then
if (allocated(psb_s_base_vect_default)) then
deallocate(psb_s_base_vect_default)
end if
allocate(psb_s_base_vect_default, mold=v)
@ -153,7 +156,7 @@ contains
end subroutine psb_s_set_vect_default
function psb_s_get_vect_default(v) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(in) :: v
class(psb_s_base_vect_type), pointer :: res
@ -163,10 +166,10 @@ contains
function psb_s_get_base_vect_default() result(res)
implicit none
implicit none
class(psb_s_base_vect_type), pointer :: res
if (.not.allocated(psb_s_base_vect_default)) then
if (.not.allocated(psb_s_base_vect_default)) then
allocate(psb_s_base_vect_type :: psb_s_base_vect_default)
end if
@ -176,14 +179,14 @@ contains
subroutine s_vect_clone(x,y,info)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine s_vect_clone
@ -198,7 +201,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_s_get_base_vect_default())
@ -220,7 +223,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_s_get_base_vect_default())
@ -241,7 +244,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_s_get_base_vect_default())
@ -304,7 +307,7 @@ contains
end function size_const
function s_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -312,7 +315,7 @@ contains
end function s_vect_get_nrows
function s_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -320,7 +323,7 @@ contains
end function s_vect_sizeof
function s_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -329,7 +332,7 @@ contains
subroutine s_vect_all(n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_base_vect_type), intent(in), optional :: mold
@ -338,12 +341,12 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_s_base_vect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(n,info)
else
info = psb_err_alloc_dealloc_
@ -353,12 +356,12 @@ contains
subroutine s_vect_reall(n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(n,info)
if (info == 0) &
@ -368,7 +371,7 @@ contains
subroutine s_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -378,7 +381,7 @@ contains
subroutine s_vect_asb(n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -424,12 +427,12 @@ contains
subroutine s_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -438,7 +441,7 @@ contains
subroutine s_vect_ins_a(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -448,7 +451,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -459,7 +462,7 @@ contains
subroutine s_vect_ins_v(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
class(psb_i_vect_type), intent(inout) :: irl
@ -469,7 +472,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
info = psb_err_invalid_vect_state_
return
end if
@ -487,12 +490,12 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info,mold=psb_s_get_base_vect_default())
end if
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -503,7 +506,7 @@ contains
subroutine s_vect_sync(x)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -512,7 +515,7 @@ contains
end subroutine s_vect_sync
subroutine s_vect_set_sync(x)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -521,7 +524,7 @@ contains
end subroutine s_vect_set_sync
subroutine s_vect_set_host(x)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -530,7 +533,7 @@ contains
end subroutine s_vect_set_host
subroutine s_vect_set_dev(x)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -539,7 +542,7 @@ contains
end subroutine s_vect_set_dev
function s_vect_is_sync(x) result(res)
implicit none
implicit none
logical :: res
class(psb_s_vect_type), intent(inout) :: x
@ -550,7 +553,7 @@ contains
end function s_vect_is_sync
function s_vect_is_host(x) result(res)
implicit none
implicit none
logical :: res
class(psb_s_vect_type), intent(inout) :: x
@ -561,11 +564,11 @@ contains
end function s_vect_is_host
function s_vect_is_dev(x) result(res)
implicit none
implicit none
logical :: res
class(psb_s_vect_type), intent(inout) :: x
res = .false.
res = .false.
if (allocated(x%v)) &
& res = x%v%is_dev()
@ -573,7 +576,7 @@ contains
function s_vect_dot_v(n,x,y) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x, y
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
@ -585,7 +588,7 @@ contains
end function s_vect_dot_v
function s_vect_dot_a(n,x,y) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
real(psb_spk_), intent(in) :: y(:)
integer(psb_ipk_), intent(in) :: n
@ -599,14 +602,14 @@ contains
subroutine s_vect_axpby_v(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_vect_type), intent(inout) :: y
real(psb_spk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,info)
else
info = psb_err_invalid_vect_state_
@ -616,7 +619,7 @@ contains
subroutine s_vect_axpby_a(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
real(psb_spk_), intent(in) :: x(:)
class(psb_s_vect_type), intent(inout) :: y
@ -631,10 +634,10 @@ contains
subroutine s_vect_mlt_v(x, y, info)
use psi_serial_mod
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -645,7 +648,7 @@ contains
subroutine s_vect_mlt_a(x, y, info)
use psi_serial_mod
implicit none
implicit none
real(psb_spk_), intent(in) :: x(:)
class(psb_s_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
@ -661,7 +664,7 @@ contains
subroutine s_vect_mlt_a_2(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
real(psb_spk_), intent(in) :: alpha,beta
real(psb_spk_), intent(in) :: y(:)
real(psb_spk_), intent(in) :: x(:)
@ -669,7 +672,7 @@ contains
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
info = 0
if (allocated(z%v)) &
& call z%v%mlt(alpha,x,y,beta,info)
@ -677,12 +680,12 @@ contains
subroutine s_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
use psi_serial_mod
implicit none
implicit none
real(psb_spk_), intent(in) :: alpha,beta
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_vect_type), intent(inout) :: y
class(psb_s_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
character(len=1), intent(in), optional :: conjgx, conjgy
integer(psb_ipk_) :: i, n
@ -696,12 +699,12 @@ contains
subroutine s_vect_mlt_av(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
real(psb_spk_), intent(in) :: alpha,beta
real(psb_spk_), intent(in) :: x(:)
class(psb_s_vect_type), intent(inout) :: y
class(psb_s_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -712,12 +715,12 @@ contains
subroutine s_vect_mlt_va(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
real(psb_spk_), intent(in) :: alpha,beta
real(psb_spk_), intent(in) :: y(:)
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -727,9 +730,38 @@ contains
end subroutine s_vect_mlt_va
subroutine s_vect_div_v(x, y, info)
use psi_serial_mod
implicit none
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(x%v).and.allocated(y%v)) &
& call x%v%div(y%v,info)
end subroutine s_vect_div_v
subroutine s_vect_div_a2(x, y, z, info)
use psi_serial_mod
implicit none
real(psb_spk_), intent(in) :: x(:)
real(psb_spk_), intent(in) :: y(:)
class(psb_s_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(z%v)) &
& call z%v%div(x,y,info)
end subroutine s_vect_div_a2
subroutine s_vect_scal(alpha, x)
use psi_serial_mod
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
real(psb_spk_), intent (in) :: alpha
@ -749,19 +781,19 @@ contains
class(psb_s_vect_type), intent(inout) :: x
class(psb_s_vect_type), intent(inout) :: y
if (allocated(x%v)) then
if (allocated(x%v)) then
if (.not.allocated(y%v)) call y%bld(psb_size(x%v%v))
call x%v%absval(y%v)
end if
end subroutine s_vect_absval2
function s_vect_nrm2(n,x) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%nrm2(n)
else
res = szero
@ -770,12 +802,12 @@ contains
end function s_vect_nrm2
function s_vect_amax(n,x) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%amax(n)
else
res = szero
@ -784,12 +816,12 @@ contains
end function s_vect_amax
function s_vect_asum(n,x) result(res)
implicit none
implicit none
class(psb_s_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%asum(n)
else
res = szero
@ -812,7 +844,7 @@ module psb_s_multivect_mod
!private
type psb_s_multivect_type
class(psb_s_base_multivect_type), allocatable :: v
class(psb_s_base_multivect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => s_vect_get_nrows
procedure, pass(x) :: get_ncols => s_vect_get_ncols
@ -886,11 +918,11 @@ module psb_s_multivect_mod
contains
subroutine psb_s_set_multivect_default(v)
implicit none
subroutine psb_s_set_multivect_default(v)
implicit none
class(psb_s_base_multivect_type), intent(in) :: v
if (allocated(psb_s_base_multivect_default)) then
if (allocated(psb_s_base_multivect_default)) then
deallocate(psb_s_base_multivect_default)
end if
allocate(psb_s_base_multivect_default, mold=v)
@ -898,7 +930,7 @@ contains
end subroutine psb_s_set_multivect_default
function psb_s_get_multivect_default(v) result(res)
implicit none
implicit none
class(psb_s_multivect_type), intent(in) :: v
class(psb_s_base_multivect_type), pointer :: res
@ -908,10 +940,10 @@ contains
function psb_s_get_base_multivect_default() result(res)
implicit none
implicit none
class(psb_s_base_multivect_type), pointer :: res
if (.not.allocated(psb_s_base_multivect_default)) then
if (.not.allocated(psb_s_base_multivect_default)) then
allocate(psb_s_base_multivect_type :: psb_s_base_multivect_default)
end if
@ -921,14 +953,14 @@ contains
subroutine s_vect_clone(x,y,info)
implicit none
implicit none
class(psb_s_multivect_type), intent(inout) :: x
class(psb_s_multivect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine s_vect_clone
@ -941,7 +973,7 @@ contains
class(psb_s_base_multivect_type), pointer :: mld
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_s_get_base_multivect_default())
@ -959,7 +991,7 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_s_get_base_multivect_default())
@ -1019,7 +1051,7 @@ contains
end function size_const
function s_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_s_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1027,7 +1059,7 @@ contains
end function s_vect_get_nrows
function s_vect_get_ncols(x) result(res)
implicit none
implicit none
class(psb_s_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1035,7 +1067,7 @@ contains
end function s_vect_get_ncols
function s_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_s_multivect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -1043,7 +1075,7 @@ contains
end function s_vect_sizeof
function s_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_s_multivect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -1052,18 +1084,18 @@ contains
subroutine s_vect_all(m,n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_s_multivect_type), intent(out) :: x
class(psb_s_base_multivect_type), intent(in), optional :: mold
integer(psb_ipk_), intent(out) :: info
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_s_base_multivect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(m,n,info)
else
info = psb_err_alloc_dealloc_
@ -1073,12 +1105,12 @@ contains
subroutine s_vect_reall(m,n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_s_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(m,n,info)
if (info == 0) &
@ -1088,7 +1120,7 @@ contains
subroutine s_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_s_multivect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -1098,7 +1130,7 @@ contains
subroutine s_vect_asb(m,n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_s_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -1109,7 +1141,7 @@ contains
end subroutine s_vect_asb
subroutine s_vect_sync(x)
implicit none
implicit none
class(psb_s_multivect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -1177,12 +1209,12 @@ contains
subroutine s_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_s_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -1191,7 +1223,7 @@ contains
subroutine s_vect_ins(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_s_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -1201,7 +1233,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -1217,12 +1249,12 @@ contains
class(psb_s_base_multivect_type), allocatable :: tmp
integer(psb_ipk_) :: info
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info, mold=psb_s_get_base_multivect_default())
endif
if (allocated(x%v)) then
endif
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -1232,7 +1264,7 @@ contains
!!$ function s_vect_dot_v(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_s_multivect_type), intent(inout) :: x, y
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
@ -1244,28 +1276,28 @@ contains
!!$ end function s_vect_dot_v
!!$
!!$ function s_vect_dot_a(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ real(psb_spk_), intent(in) :: y(:)
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
!!$
!!$
!!$ res = szero
!!$ if (allocated(x%v)) &
!!$ & res = x%v%dot(n,y)
!!$
!!$
!!$ end function s_vect_dot_a
!!$
!!$
!!$ subroutine s_vect_axpby_v(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ class(psb_s_multivect_type), intent(inout) :: y
!!$ real(psb_spk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$ call y%v%axpby(m,alpha,x%v,beta,info)
!!$ else
!!$ info = psb_err_invalid_vect_state_
@ -1275,25 +1307,25 @@ contains
!!$
!!$ subroutine s_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ real(psb_spk_), intent(in) :: x(:)
!!$ class(psb_s_multivect_type), intent(inout) :: y
!!$ real(psb_spk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$
!!$ if (allocated(y%v)) &
!!$ & call y%v%axpby(m,alpha,x,beta,info)
!!$
!!$
!!$ end subroutine s_vect_axpby_a
!!$
!!$
!!$
!!$ subroutine s_vect_mlt_v(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ class(psb_s_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1304,7 +1336,7 @@ contains
!!$
!!$ subroutine s_vect_mlt_a(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_spk_), intent(in) :: x(:)
!!$ class(psb_s_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
@ -1314,13 +1346,13 @@ contains
!!$ info = 0
!!$ if (allocated(y%v)) &
!!$ & call y%v%mlt(x,info)
!!$
!!$
!!$ end subroutine s_vect_mlt_a
!!$
!!$
!!$ subroutine s_vect_mlt_a_2(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_spk_), intent(in) :: alpha,beta
!!$ real(psb_spk_), intent(in) :: y(:)
!!$ real(psb_spk_), intent(in) :: x(:)
@ -1328,20 +1360,20 @@ contains
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$ info = 0
!!$ if (allocated(z%v)) &
!!$ & call z%v%mlt(alpha,x,y,beta,info)
!!$
!!$
!!$ end subroutine s_vect_mlt_a_2
!!$
!!$ subroutine s_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_spk_), intent(in) :: alpha,beta
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ class(psb_s_multivect_type), intent(inout) :: y
!!$ class(psb_s_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ character(len=1), intent(in), optional :: conjgx, conjgy
!!$
!!$ integer(psb_ipk_) :: i, n
@ -1355,12 +1387,12 @@ contains
!!$
!!$ subroutine s_vect_mlt_av(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_spk_), intent(in) :: alpha,beta
!!$ real(psb_spk_), intent(in) :: x(:)
!!$ class(psb_s_multivect_type), intent(inout) :: y
!!$ class(psb_s_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1371,16 +1403,16 @@ contains
!!$
!!$ subroutine s_vect_mlt_va(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ real(psb_spk_), intent(in) :: alpha,beta
!!$ real(psb_spk_), intent(in) :: y(:)
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ class(psb_s_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$
!!$
!!$ if (allocated(z%v).and.allocated(x%v)) &
!!$ & call z%v%mlt(alpha,x%v,y,beta,info)
!!$
@ -1388,36 +1420,36 @@ contains
!!$
!!$ subroutine s_vect_scal(alpha, x)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ real(psb_spk_), intent (in) :: alpha
!!$
!!$
!!$ if (allocated(x%v)) call x%v%scal(alpha)
!!$
!!$ end subroutine s_vect_scal
!!$
!!$
!!$ function s_vect_nrm2(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$
!!$ if (allocated(x%v)) then
!!$ res = x%v%nrm2(n)
!!$ else
!!$ res = szero
!!$ end if
!!$
!!$ end function s_vect_nrm2
!!$
!!$
!!$ function s_vect_amax(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%amax(n)
!!$ else
!!$ res = szero
@ -1426,12 +1458,12 @@ contains
!!$ end function s_vect_amax
!!$
!!$ function s_vect_asum(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_s_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_spk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%asum(n)
!!$ else
!!$ res = szero

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
!
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
@ -15,7 +15,7 @@
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@ -27,15 +27,15 @@
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
!
!
! package: psb_z_vect_mod
!
! This module contains the definition of the psb_z_vect type which
! is the outer container for dense vectors.
! Therefore all methods simply invoke the corresponding methods of the
! inner component.
! inner component.
!
module psb_z_vect_mod
@ -43,7 +43,7 @@ module psb_z_vect_mod
use psb_i_vect_mod
type psb_z_vect_type
class(psb_z_base_vect_type), allocatable :: v
class(psb_z_base_vect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => z_vect_get_nrows
procedure, pass(x) :: sizeof => z_vect_sizeof
@ -94,13 +94,16 @@ module psb_z_vect_mod
procedure, pass(z) :: mlt_av => z_vect_mlt_av
generic, public :: mlt => mlt_v, mlt_a, mlt_a_2,&
& mlt_v_2, mlt_av, mlt_va
procedure, pass(x) :: div_v => z_vect_div_v
procedure, pass(z) :: div_a2 => z_vect_div_a2
generic, public :: div => div_v, div_a2
procedure, pass(x) :: scal => z_vect_scal
procedure, pass(x) :: absval1 => z_vect_absval1
procedure, pass(x) :: absval2 => z_vect_absval2
generic, public :: absval => absval1, absval2
procedure, pass(x) :: nrm2 => z_vect_nrm2
procedure, pass(x) :: amax => z_vect_amax
procedure, pass(x) :: asum => z_vect_asum
procedure, pass(x) :: asum => z_vect_asum
end type psb_z_vect_type
public :: psb_z_vect
@ -122,7 +125,7 @@ module psb_z_vect_mod
private :: z_vect_dot_v, z_vect_dot_a, z_vect_axpby_v, z_vect_axpby_a, &
& z_vect_mlt_v, z_vect_mlt_a, z_vect_mlt_a_2, z_vect_mlt_v_2, &
& z_vect_mlt_va, z_vect_mlt_av, z_vect_scal, z_vect_absval1, &
& z_vect_absval2, z_vect_nrm2, z_vect_amax, z_vect_asum
& z_vect_absval2, z_vect_nrm2, z_vect_amax, z_vect_asum
@ -141,11 +144,11 @@ module psb_z_vect_mod
contains
subroutine psb_z_set_vect_default(v)
implicit none
subroutine psb_z_set_vect_default(v)
implicit none
class(psb_z_base_vect_type), intent(in) :: v
if (allocated(psb_z_base_vect_default)) then
if (allocated(psb_z_base_vect_default)) then
deallocate(psb_z_base_vect_default)
end if
allocate(psb_z_base_vect_default, mold=v)
@ -153,7 +156,7 @@ contains
end subroutine psb_z_set_vect_default
function psb_z_get_vect_default(v) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(in) :: v
class(psb_z_base_vect_type), pointer :: res
@ -163,10 +166,10 @@ contains
function psb_z_get_base_vect_default() result(res)
implicit none
implicit none
class(psb_z_base_vect_type), pointer :: res
if (.not.allocated(psb_z_base_vect_default)) then
if (.not.allocated(psb_z_base_vect_default)) then
allocate(psb_z_base_vect_type :: psb_z_base_vect_default)
end if
@ -176,14 +179,14 @@ contains
subroutine z_vect_clone(x,y,info)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine z_vect_clone
@ -198,7 +201,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_z_get_base_vect_default())
@ -220,7 +223,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_z_get_base_vect_default())
@ -241,7 +244,7 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_z_get_base_vect_default())
@ -304,7 +307,7 @@ contains
end function size_const
function z_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -312,7 +315,7 @@ contains
end function z_vect_get_nrows
function z_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -320,7 +323,7 @@ contains
end function z_vect_sizeof
function z_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -329,7 +332,7 @@ contains
subroutine z_vect_all(n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_base_vect_type), intent(in), optional :: mold
@ -338,12 +341,12 @@ contains
if (allocated(x%v)) &
& call x%free(info)
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_z_base_vect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(n,info)
else
info = psb_err_alloc_dealloc_
@ -353,12 +356,12 @@ contains
subroutine z_vect_reall(n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(n,info)
if (info == 0) &
@ -368,7 +371,7 @@ contains
subroutine z_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -378,7 +381,7 @@ contains
subroutine z_vect_asb(n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: n
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -424,12 +427,12 @@ contains
subroutine z_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -438,7 +441,7 @@ contains
subroutine z_vect_ins_a(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -448,7 +451,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -459,7 +462,7 @@ contains
subroutine z_vect_ins_v(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
class(psb_i_vect_type), intent(inout) :: irl
@ -469,7 +472,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then
info = psb_err_invalid_vect_state_
return
end if
@ -487,12 +490,12 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info,mold=psb_z_get_base_vect_default())
end if
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -503,7 +506,7 @@ contains
subroutine z_vect_sync(x)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -512,7 +515,7 @@ contains
end subroutine z_vect_sync
subroutine z_vect_set_sync(x)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -521,7 +524,7 @@ contains
end subroutine z_vect_set_sync
subroutine z_vect_set_host(x)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -530,7 +533,7 @@ contains
end subroutine z_vect_set_host
subroutine z_vect_set_dev(x)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -539,7 +542,7 @@ contains
end subroutine z_vect_set_dev
function z_vect_is_sync(x) result(res)
implicit none
implicit none
logical :: res
class(psb_z_vect_type), intent(inout) :: x
@ -550,7 +553,7 @@ contains
end function z_vect_is_sync
function z_vect_is_host(x) result(res)
implicit none
implicit none
logical :: res
class(psb_z_vect_type), intent(inout) :: x
@ -561,11 +564,11 @@ contains
end function z_vect_is_host
function z_vect_is_dev(x) result(res)
implicit none
implicit none
logical :: res
class(psb_z_vect_type), intent(inout) :: x
res = .false.
res = .false.
if (allocated(x%v)) &
& res = x%v%is_dev()
@ -573,7 +576,7 @@ contains
function z_vect_dot_v(n,x,y) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x, y
integer(psb_ipk_), intent(in) :: n
complex(psb_dpk_) :: res
@ -585,7 +588,7 @@ contains
end function z_vect_dot_v
function z_vect_dot_a(n,x,y) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
complex(psb_dpk_), intent(in) :: y(:)
integer(psb_ipk_), intent(in) :: n
@ -599,14 +602,14 @@ contains
subroutine z_vect_axpby_v(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_vect_type), intent(inout) :: y
complex(psb_dpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(out) :: info
if (allocated(x%v).and.allocated(y%v)) then
if (allocated(x%v).and.allocated(y%v)) then
call y%v%axpby(m,alpha,x%v,beta,info)
else
info = psb_err_invalid_vect_state_
@ -616,7 +619,7 @@ contains
subroutine z_vect_axpby_a(m,alpha, x, beta, y, info)
use psi_serial_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m
complex(psb_dpk_), intent(in) :: x(:)
class(psb_z_vect_type), intent(inout) :: y
@ -631,10 +634,10 @@ contains
subroutine z_vect_mlt_v(x, y, info)
use psi_serial_mod
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -645,7 +648,7 @@ contains
subroutine z_vect_mlt_a(x, y, info)
use psi_serial_mod
implicit none
implicit none
complex(psb_dpk_), intent(in) :: x(:)
class(psb_z_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
@ -661,7 +664,7 @@ contains
subroutine z_vect_mlt_a_2(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
complex(psb_dpk_), intent(in) :: alpha,beta
complex(psb_dpk_), intent(in) :: y(:)
complex(psb_dpk_), intent(in) :: x(:)
@ -669,7 +672,7 @@ contains
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
info = 0
if (allocated(z%v)) &
& call z%v%mlt(alpha,x,y,beta,info)
@ -677,12 +680,12 @@ contains
subroutine z_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
use psi_serial_mod
implicit none
implicit none
complex(psb_dpk_), intent(in) :: alpha,beta
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_vect_type), intent(inout) :: y
class(psb_z_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
character(len=1), intent(in), optional :: conjgx, conjgy
integer(psb_ipk_) :: i, n
@ -696,12 +699,12 @@ contains
subroutine z_vect_mlt_av(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
complex(psb_dpk_), intent(in) :: alpha,beta
complex(psb_dpk_), intent(in) :: x(:)
class(psb_z_vect_type), intent(inout) :: y
class(psb_z_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -712,12 +715,12 @@ contains
subroutine z_vect_mlt_va(alpha,x,y,beta,z,info)
use psi_serial_mod
implicit none
implicit none
complex(psb_dpk_), intent(in) :: alpha,beta
complex(psb_dpk_), intent(in) :: y(:)
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
@ -727,9 +730,38 @@ contains
end subroutine z_vect_mlt_va
subroutine z_vect_div_v(x, y, info)
use psi_serial_mod
implicit none
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_vect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(x%v).and.allocated(y%v)) &
& call x%v%div(y%v,info)
end subroutine z_vect_div_v
subroutine z_vect_div_a2(x, y, z, info)
use psi_serial_mod
implicit none
complex(psb_dpk_), intent(in) :: x(:)
complex(psb_dpk_), intent(in) :: y(:)
class(psb_z_vect_type), intent(inout) :: z
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_) :: i, n
info = 0
if (allocated(z%v)) &
& call z%v%div(x,y,info)
end subroutine z_vect_div_a2
subroutine z_vect_scal(alpha, x)
use psi_serial_mod
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
complex(psb_dpk_), intent (in) :: alpha
@ -749,19 +781,19 @@ contains
class(psb_z_vect_type), intent(inout) :: x
class(psb_z_vect_type), intent(inout) :: y
if (allocated(x%v)) then
if (allocated(x%v)) then
if (.not.allocated(y%v)) call y%bld(psb_size(x%v%v))
call x%v%absval(y%v)
end if
end subroutine z_vect_absval2
function z_vect_nrm2(n,x) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%nrm2(n)
else
res = dzero
@ -770,12 +802,12 @@ contains
end function z_vect_nrm2
function z_vect_amax(n,x) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%amax(n)
else
res = dzero
@ -784,12 +816,12 @@ contains
end function z_vect_amax
function z_vect_asum(n,x) result(res)
implicit none
implicit none
class(psb_z_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
if (allocated(x%v)) then
if (allocated(x%v)) then
res = x%v%asum(n)
else
res = dzero
@ -812,7 +844,7 @@ module psb_z_multivect_mod
!private
type psb_z_multivect_type
class(psb_z_base_multivect_type), allocatable :: v
class(psb_z_base_multivect_type), allocatable :: v
contains
procedure, pass(x) :: get_nrows => z_vect_get_nrows
procedure, pass(x) :: get_ncols => z_vect_get_ncols
@ -886,11 +918,11 @@ module psb_z_multivect_mod
contains
subroutine psb_z_set_multivect_default(v)
implicit none
subroutine psb_z_set_multivect_default(v)
implicit none
class(psb_z_base_multivect_type), intent(in) :: v
if (allocated(psb_z_base_multivect_default)) then
if (allocated(psb_z_base_multivect_default)) then
deallocate(psb_z_base_multivect_default)
end if
allocate(psb_z_base_multivect_default, mold=v)
@ -898,7 +930,7 @@ contains
end subroutine psb_z_set_multivect_default
function psb_z_get_multivect_default(v) result(res)
implicit none
implicit none
class(psb_z_multivect_type), intent(in) :: v
class(psb_z_base_multivect_type), pointer :: res
@ -908,10 +940,10 @@ contains
function psb_z_get_base_multivect_default() result(res)
implicit none
implicit none
class(psb_z_base_multivect_type), pointer :: res
if (.not.allocated(psb_z_base_multivect_default)) then
if (.not.allocated(psb_z_base_multivect_default)) then
allocate(psb_z_base_multivect_type :: psb_z_base_multivect_default)
end if
@ -921,14 +953,14 @@ contains
subroutine z_vect_clone(x,y,info)
implicit none
implicit none
class(psb_z_multivect_type), intent(inout) :: x
class(psb_z_multivect_type), intent(inout) :: y
integer(psb_ipk_), intent(out) :: info
info = psb_success_
call y%free(info)
if ((info==0).and.allocated(x%v)) then
if ((info==0).and.allocated(x%v)) then
call y%bld(x%get_vect(),mold=x%v)
end if
end subroutine z_vect_clone
@ -941,7 +973,7 @@ contains
class(psb_z_base_multivect_type), pointer :: mld
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_z_get_base_multivect_default())
@ -959,7 +991,7 @@ contains
integer(psb_ipk_) :: info
info = psb_success_
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(x%v,stat=info, mold=psb_z_get_base_multivect_default())
@ -1019,7 +1051,7 @@ contains
end function size_const
function z_vect_get_nrows(x) result(res)
implicit none
implicit none
class(psb_z_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1027,7 +1059,7 @@ contains
end function z_vect_get_nrows
function z_vect_get_ncols(x) result(res)
implicit none
implicit none
class(psb_z_multivect_type), intent(in) :: x
integer(psb_ipk_) :: res
res = 0
@ -1035,7 +1067,7 @@ contains
end function z_vect_get_ncols
function z_vect_sizeof(x) result(res)
implicit none
implicit none
class(psb_z_multivect_type), intent(in) :: x
integer(psb_epk_) :: res
res = 0
@ -1043,7 +1075,7 @@ contains
end function z_vect_sizeof
function z_vect_get_fmt(x) result(res)
implicit none
implicit none
class(psb_z_multivect_type), intent(in) :: x
character(len=5) :: res
res = 'NULL'
@ -1052,18 +1084,18 @@ contains
subroutine z_vect_all(m,n, x, info, mold)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_z_multivect_type), intent(out) :: x
class(psb_z_base_multivect_type), intent(in), optional :: mold
integer(psb_ipk_), intent(out) :: info
if (present(mold)) then
if (present(mold)) then
allocate(x%v,stat=info,mold=mold)
else
allocate(psb_z_base_multivect_type :: x%v,stat=info)
endif
if (info == 0) then
if (info == 0) then
call x%v%all(m,n,info)
else
info = psb_err_alloc_dealloc_
@ -1073,12 +1105,12 @@ contains
subroutine z_vect_reall(m,n, x, info)
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_z_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
info = 0
if (.not.allocated(x%v)) &
& call x%all(m,n,info)
if (info == 0) &
@ -1088,7 +1120,7 @@ contains
subroutine z_vect_zero(x)
use psi_serial_mod
implicit none
implicit none
class(psb_z_multivect_type), intent(inout) :: x
if (allocated(x%v)) call x%v%zero()
@ -1098,7 +1130,7 @@ contains
subroutine z_vect_asb(m,n, x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
integer(psb_ipk_), intent(in) :: m,n
class(psb_z_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
@ -1109,7 +1141,7 @@ contains
end subroutine z_vect_asb
subroutine z_vect_sync(x)
implicit none
implicit none
class(psb_z_multivect_type), intent(inout) :: x
if (allocated(x%v)) &
@ -1177,12 +1209,12 @@ contains
subroutine z_vect_free(x, info)
use psi_serial_mod
use psb_realloc_mod
implicit none
implicit none
class(psb_z_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(out) :: info
info = 0
if (allocated(x%v)) then
if (allocated(x%v)) then
call x%v%free(info)
if (info == 0) deallocate(x%v,stat=info)
end if
@ -1191,7 +1223,7 @@ contains
subroutine z_vect_ins(n,irl,val,dupl,x,info)
use psi_serial_mod
implicit none
implicit none
class(psb_z_multivect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n, dupl
integer(psb_ipk_), intent(in) :: irl(:)
@ -1201,7 +1233,7 @@ contains
integer(psb_ipk_) :: i
info = 0
if (.not.allocated(x%v)) then
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
return
end if
@ -1217,12 +1249,12 @@ contains
class(psb_z_base_multivect_type), allocatable :: tmp
integer(psb_ipk_) :: info
if (present(mold)) then
if (present(mold)) then
allocate(tmp,stat=info,mold=mold)
else
allocate(tmp,stat=info, mold=psb_z_get_base_multivect_default())
endif
if (allocated(x%v)) then
endif
if (allocated(x%v)) then
call x%v%sync()
if (info == psb_success_) call tmp%bld(x%v%v)
call x%v%free(info)
@ -1232,7 +1264,7 @@ contains
!!$ function z_vect_dot_v(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_z_multivect_type), intent(inout) :: x, y
!!$ integer(psb_ipk_), intent(in) :: n
!!$ complex(psb_dpk_) :: res
@ -1244,28 +1276,28 @@ contains
!!$ end function z_vect_dot_v
!!$
!!$ function z_vect_dot_a(n,x,y) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ complex(psb_dpk_), intent(in) :: y(:)
!!$ integer(psb_ipk_), intent(in) :: n
!!$ complex(psb_dpk_) :: res
!!$
!!$
!!$ res = zzero
!!$ if (allocated(x%v)) &
!!$ & res = x%v%dot(n,y)
!!$
!!$
!!$ end function z_vect_dot_a
!!$
!!$
!!$ subroutine z_vect_axpby_v(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ class(psb_z_multivect_type), intent(inout) :: y
!!$ complex(psb_dpk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$
!!$ if (allocated(x%v).and.allocated(y%v)) then
!!$ call y%v%axpby(m,alpha,x%v,beta,info)
!!$ else
!!$ info = psb_err_invalid_vect_state_
@ -1275,25 +1307,25 @@ contains
!!$
!!$ subroutine z_vect_axpby_a(m,alpha, x, beta, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ integer(psb_ipk_), intent(in) :: m
!!$ complex(psb_dpk_), intent(in) :: x(:)
!!$ class(psb_z_multivect_type), intent(inout) :: y
!!$ complex(psb_dpk_), intent (in) :: alpha, beta
!!$ integer(psb_ipk_), intent(out) :: info
!!$
!!$
!!$ if (allocated(y%v)) &
!!$ & call y%v%axpby(m,alpha,x,beta,info)
!!$
!!$
!!$ end subroutine z_vect_axpby_a
!!$
!!$
!!$
!!$ subroutine z_vect_mlt_v(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ class(psb_z_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1304,7 +1336,7 @@ contains
!!$
!!$ subroutine z_vect_mlt_a(x, y, info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_dpk_), intent(in) :: x(:)
!!$ class(psb_z_multivect_type), intent(inout) :: y
!!$ integer(psb_ipk_), intent(out) :: info
@ -1314,13 +1346,13 @@ contains
!!$ info = 0
!!$ if (allocated(y%v)) &
!!$ & call y%v%mlt(x,info)
!!$
!!$
!!$ end subroutine z_vect_mlt_a
!!$
!!$
!!$ subroutine z_vect_mlt_a_2(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_dpk_), intent(in) :: alpha,beta
!!$ complex(psb_dpk_), intent(in) :: y(:)
!!$ complex(psb_dpk_), intent(in) :: x(:)
@ -1328,20 +1360,20 @@ contains
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$ info = 0
!!$ if (allocated(z%v)) &
!!$ & call z%v%mlt(alpha,x,y,beta,info)
!!$
!!$
!!$ end subroutine z_vect_mlt_a_2
!!$
!!$ subroutine z_vect_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_dpk_), intent(in) :: alpha,beta
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ class(psb_z_multivect_type), intent(inout) :: y
!!$ class(psb_z_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ character(len=1), intent(in), optional :: conjgx, conjgy
!!$
!!$ integer(psb_ipk_) :: i, n
@ -1355,12 +1387,12 @@ contains
!!$
!!$ subroutine z_vect_mlt_av(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_dpk_), intent(in) :: alpha,beta
!!$ complex(psb_dpk_), intent(in) :: x(:)
!!$ class(psb_z_multivect_type), intent(inout) :: y
!!$ class(psb_z_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
@ -1371,16 +1403,16 @@ contains
!!$
!!$ subroutine z_vect_mlt_va(alpha,x,y,beta,z,info)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ complex(psb_dpk_), intent(in) :: alpha,beta
!!$ complex(psb_dpk_), intent(in) :: y(:)
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ class(psb_z_multivect_type), intent(inout) :: z
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_), intent(out) :: info
!!$ integer(psb_ipk_) :: i, n
!!$
!!$ info = 0
!!$
!!$
!!$ if (allocated(z%v).and.allocated(x%v)) &
!!$ & call z%v%mlt(alpha,x%v,y,beta,info)
!!$
@ -1388,36 +1420,36 @@ contains
!!$
!!$ subroutine z_vect_scal(alpha, x)
!!$ use psi_serial_mod
!!$ implicit none
!!$ implicit none
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ complex(psb_dpk_), intent (in) :: alpha
!!$
!!$
!!$ if (allocated(x%v)) call x%v%scal(alpha)
!!$
!!$ end subroutine z_vect_scal
!!$
!!$
!!$ function z_vect_nrm2(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$
!!$ if (allocated(x%v)) then
!!$ res = x%v%nrm2(n)
!!$ else
!!$ res = dzero
!!$ end if
!!$
!!$ end function z_vect_nrm2
!!$
!!$
!!$ function z_vect_amax(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%amax(n)
!!$ else
!!$ res = dzero
@ -1426,12 +1458,12 @@ contains
!!$ end function z_vect_amax
!!$
!!$ function z_vect_asum(n,x) result(res)
!!$ implicit none
!!$ implicit none
!!$ class(psb_z_multivect_type), intent(inout) :: x
!!$ integer(psb_ipk_), intent(in) :: n
!!$ real(psb_dpk_) :: res
!!$
!!$ if (allocated(x%v)) then
!!$ if (allocated(x%v)) then
!!$ res = x%v%asum(n)
!!$ else
!!$ res = dzero

@ -10,25 +10,26 @@ OBJS= psb_ddot.o psb_damax.o psb_dasum.o psb_daxpby.o\
psb_snrm2.o psb_snrmi.o psb_sspmm.o psb_sspsm.o\
psb_camax.o psb_casum.o psb_caxpby.o psb_cdot.o \
psb_cnrm2.o psb_cnrmi.o psb_cspmm.o psb_cspsm.o \
psb_cmlt_vect.o psb_dmlt_vect.o psb_zmlt_vect.o psb_smlt_vect.o
psb_cmlt_vect.o psb_dmlt_vect.o psb_zmlt_vect.o psb_smlt_vect.o\
psb_cdiv_vect.o psb_ddiv_vect.o psb_zdiv_vect.o psb_sdiv_vect.o
LIBDIR=..
INCDIR=..
MODDIR=../modules
FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR)
FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR)
lib: $(OBJS)
lib: $(OBJS)
$(AR) $(LIBDIR)/$(LIBNAME) $(OBJS)
$(RANLIB) $(LIBDIR)/$(LIBNAME)
#$(F90_PSDOBJS): $(MODS)
#$(F90_PSDOBJS): $(MODS)
veryclean: clean
/bin/rm -f $(LIBNAME)
clean:
clean:
/bin/rm -f $(OBJS) $(LOCAL_MODS)
veryclean: clean

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: psb_cdiv_vect
subroutine psb_cdiv_vect(x,y,desc_a,info)
use psb_base_mod, psb_protect_name => psb_cdiv_vect
implicit none
type(psb_c_vect_type), intent (inout) :: x
type(psb_c_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_c_div_vect'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ictxt=desc_a%get_context()
call psb_info(ictxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if(desc_a%get_local_rows() > 0) then
call x%div(y,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ictxt,err_act)
return
end subroutine psb_cdiv_vect

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: psb_ddiv_vect
subroutine psb_ddiv_vect(x,y,desc_a,info)
use psb_base_mod, psb_protect_name => psb_ddiv_vect
implicit none
type(psb_d_vect_type), intent (inout) :: x
type(psb_d_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_d_div_vect'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ictxt=desc_a%get_context()
call psb_info(ictxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if(desc_a%get_local_rows() > 0) then
call x%div(y,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ictxt,err_act)
return
end subroutine psb_ddiv_vect

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: psb_sdiv_vect
subroutine psb_sdiv_vect(x,y,desc_a,info)
use psb_base_mod, psb_protect_name => psb_sdiv_vect
implicit none
type(psb_s_vect_type), intent (inout) :: x
type(psb_s_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_s_div_vect'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ictxt=desc_a%get_context()
call psb_info(ictxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if(desc_a%get_local_rows() > 0) then
call x%div(y,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ictxt,err_act)
return
end subroutine psb_sdiv_vect

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
! File: psb_zdiv_vect
subroutine psb_zdiv_vect(x,y,desc_a,info)
use psb_base_mod, psb_protect_name => psb_zdiv_vect
implicit none
type(psb_z_vect_type), intent (inout) :: x
type(psb_z_vect_type), intent (inout) :: y
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
! locals
integer(psb_ipk_) :: ictxt, np, me,&
& err_act, iix, jjx, iiy, jjy
integer(psb_lpk_) :: ix, ijx, iy, ijy, m
character(len=20) :: name, ch_err
name='psb_z_div_vect'
if (psb_errstatus_fatal()) return
info=psb_success_
call psb_erractionsave(err_act)
ictxt=desc_a%get_context()
call psb_info(ictxt, me, np)
if (np == -ione) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(x%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
if (.not.allocated(y%v)) then
info = psb_err_invalid_vect_state_
call psb_errpush(info,name)
goto 9999
endif
ix = ione
iy = ione
m = desc_a%get_global_rows()
! check vector correctness
call psb_chkvect(m,lone,x%get_nrows(),ix,lone,desc_a,info,iix,jjx)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 1'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
call psb_chkvect(m,lone,y%get_nrows(),iy,lone,desc_a,info,iiy,jjy)
if(info /= psb_success_) then
info=psb_err_from_subroutine_
ch_err='psb_chkvect 2'
call psb_errpush(info,name,a_err=ch_err)
goto 9999
end if
if(desc_a%get_local_rows() > 0) then
call x%div(y,info)
end if
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(ictxt,err_act)
return
end subroutine psb_zdiv_vect

@ -55,6 +55,7 @@ program vecoperation
integer(psb_lpk_), allocatable :: myidx(:)
real(psb_dpk_) :: zt(1), dotresult, norm2, norm1, norminf
character(len=20) :: name,ch_err,readinput
real(psb_dpk_), allocatable :: vx(:), vy(:)
info=psb_success_
@ -139,6 +140,12 @@ program vecoperation
t2 = psb_wtime() - t1
if (iam == psb_root_) write(psb_out_unit,'("Overall vector creation time : ",es12.5)')t2
if (iam == psb_root_) then
vx = x%get_vect()
write(psb_out_unit,'("x = ",es12.1)')vx(:)
vy = y%get_vect()
write(psb_out_unit,'("y = ",es12.1)')vy(:)
end if
!
! Vector operations
@ -150,8 +157,33 @@ program vecoperation
norminf = psb_normi(x,desc_a,info)
if (iam == psb_root_) write(psb_out_unit,'("\|x\|_inf : ",es12.5," \|x\|_1 :",es12.5," \|x\|_2",es12.5)')norminf,norm1,norm2
call psb_geaxpby(1.0_psb_dpk_, x, 1.0_psb_dpk_, y, desc_a, info) ! \alpha x + \beta y
if (iam == psb_root_) then
vx = x%get_vect()
write(psb_out_unit,'("x = ",es12.1)')vx(:)
vy = y%get_vect()
write(psb_out_unit,'("y = ",es12.1)')vy(:)
end if
call psb_gemlt(x,y,desc_a,info)
if (iam == psb_root_) then
vx = x%get_vect()
write(psb_out_unit,'("x = ",es12.1)')vx(:)
vy = y%get_vect()
write(psb_out_unit,'("y = ",es12.1)')vy(:)
end if
call psb_gediv(x,y,desc_a,info)
if (iam == psb_root_) then
vx = x%get_vect()
write(psb_out_unit,'("x = ",es12.1)')vx(:)
vy = y%get_vect()
write(psb_out_unit,'("y = ",es12.1)')vy(:)
end if
!

Loading…
Cancel
Save