You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1370 lines
29 KiB
Fortran
1370 lines
29 KiB
Fortran
module psb_s_psblas_cbind_mod
|
|
use iso_c_binding
|
|
use psb_base_mod
|
|
use psb_objhandle_mod
|
|
use psb_base_string_cbind_mod
|
|
|
|
contains
|
|
|
|
function psb_c_sgeaxpby(alpha,xh,beta,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
real(c_float), value :: alpha,beta
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_geaxpby(alpha,xp,beta,yp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgeaxpby
|
|
|
|
function psb_c_sgeaxpbyz(alpha,xh,beta,yh,zh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh,zh
|
|
type(psb_c_descriptor) :: cdh
|
|
real(c_float), value :: alpha,beta
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp,zp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
if (c_associated(zh%item)) then
|
|
call c_f_pointer(zh%item,zp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_geaxpby(alpha,xp,beta,yp,zp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgeaxpbyz
|
|
|
|
function psb_c_sgemlt(xh,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_gemlt(xp,yp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgemlt
|
|
|
|
function psb_c_sgemlt2(alpha,xh,yh,beta,zh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh, zh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp,zp
|
|
integer(psb_c_ipk_) :: info
|
|
real(psb_spk_), intent(in), value :: alpha,beta
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(zh%item)) then
|
|
call c_f_pointer(zh%item,zp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_gemlt(alpha,xp,yp,beta,zp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgemlt2
|
|
|
|
function psb_c_sgediv(xh,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_gediv(xp,yp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgediv
|
|
|
|
function psb_c_sgediv2(xh,yh,zh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh,zh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp,zp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(zh%item)) then
|
|
call c_f_pointer(zh%item,zp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_gediv(xp,yp,zp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgediv2
|
|
|
|
function psb_c_sgediv_check(xh,yh,cdh, flag) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
logical(c_bool), value :: flag
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
logical :: fflag
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
fflag = flag
|
|
call psb_gediv(xp,yp,descp,info,fflag)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgediv_check
|
|
|
|
function psb_c_sgediv2_check(xh,yh,zh,cdh, flag) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh,zh
|
|
type(psb_c_descriptor) :: cdh
|
|
logical(c_bool), value :: flag
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp,zp
|
|
integer(psb_c_ipk_) :: info
|
|
logical :: fflag
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(zh%item)) then
|
|
call c_f_pointer(zh%item,zp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
fflag = flag
|
|
call psb_gediv(xp,yp,zp,descp,info,fflag)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgediv2_check
|
|
|
|
function psb_c_sgeinv(xh,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_geinv(xp,yp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgeinv
|
|
|
|
function psb_c_sgeinv_check(xh,yh,cdh, flag) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
logical(c_bool), value :: flag
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
logical :: fflag
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
fflag = flag
|
|
call psb_geinv(xp,yp,descp,info,fflag)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgeinv_check
|
|
|
|
function psb_c_sgeabs(xh,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_geabs(xp,yp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgeabs
|
|
|
|
function psb_c_sgecmp(xh,ch,zh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,zh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,zp
|
|
integer(psb_c_ipk_) :: info
|
|
real(c_float), value :: ch
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(zh%item)) then
|
|
call c_f_pointer(zh%item,zp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_gecmp(xp,ch,zp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgecmp
|
|
|
|
function psb_c_sgecmpmat(ah,bh,tol,cdh) bind(c) result(res)
|
|
implicit none
|
|
logical(c_bool) :: res
|
|
|
|
type(psb_c_sspmat) :: ah,bh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap,bp
|
|
integer(psb_c_ipk_) :: info
|
|
real(c_float), value :: tol
|
|
logical :: isequal
|
|
|
|
res = .false.
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(bh%item)) then
|
|
call c_f_pointer(bh%item,bp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_gecmp(ap,bp,tol,descp,isequal,info)
|
|
|
|
res = isequal
|
|
|
|
end function psb_c_sgecmpmat
|
|
|
|
function psb_c_sgecmpmat_val(ah,val,tol,cdh) bind(c) result(res)
|
|
implicit none
|
|
logical(c_bool) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
real(c_float), value :: val
|
|
real(c_float), value :: tol
|
|
logical :: isequal
|
|
|
|
res = .false.
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_gecmp(ap,val,tol,descp,isequal,info)
|
|
|
|
res = isequal
|
|
|
|
end function psb_c_sgecmpmat_val
|
|
|
|
function psb_c_sgeaddconst(xh,bh,zh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,zh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,zp
|
|
integer(psb_c_ipk_) :: info
|
|
real(c_float), value :: bh
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(zh%item)) then
|
|
call c_f_pointer(zh%item,zp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_geaddconst(xp,bh,zp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sgeaddconst
|
|
|
|
function psb_c_smask(ch,xh,mh,t,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_svector) :: ch,xh,mh
|
|
type(psb_c_descriptor) :: cdh
|
|
logical(c_bool) :: t
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: cp,xp,mp
|
|
integer(psb_c_ipk_) :: info
|
|
logical :: fp
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ch%item)) then
|
|
call c_f_pointer(ch%item,cp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(mh%item)) then
|
|
call c_f_pointer(mh%item,mp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_mask(cp,xp,mp,fp,descp,info)
|
|
|
|
t = fp
|
|
res = info
|
|
|
|
end function psb_c_smask
|
|
|
|
function psb_c_sminquotient(xh,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(psb_spk_) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_minquotient(xp,yp,descp,info)
|
|
|
|
|
|
end function psb_c_sminquotient
|
|
|
|
function psb_c_sgenrm2(xh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_genrm2(xp,descp,info)
|
|
|
|
end function psb_c_sgenrm2
|
|
|
|
function psb_c_sgenrmi(xh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp
|
|
type(psb_s_vect_type) :: yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_geall(yp,descp,info)
|
|
call psb_geabs(xp,yp,descp,info)
|
|
res = psb_geasum(yp,descp,info)
|
|
call psb_gefree(yp,descp,info)
|
|
|
|
end function psb_c_sgenrmi
|
|
|
|
function psb_c_sgenrm2_weight(xh,wh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh, wh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp, wp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(wh%item)) then
|
|
call c_f_pointer(wh%item,wp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_genrm2(xp,wp,descp,info)
|
|
|
|
end function psb_c_sgenrm2_weight
|
|
|
|
function psb_c_sgenrm2_weightmask(xh,wh,idvh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh, wh, idvh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp, wp, idvp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(wh%item)) then
|
|
call c_f_pointer(wh%item,wp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(idvh%item)) then
|
|
call c_f_pointer(idvh%item,idvp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_genrm2(xp,wp,idvp,descp,info)
|
|
|
|
end function psb_c_sgenrm2_weightmask
|
|
|
|
function psb_c_sgeamax(xh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_geamax(xp,descp,info)
|
|
|
|
end function psb_c_sgeamax
|
|
|
|
function psb_c_sgemin(xh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_gemin(xp,descp,info)
|
|
|
|
end function psb_c_sgemin
|
|
|
|
function psb_c_sgeasum(xh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_geasum(xp,descp,info)
|
|
|
|
end function psb_c_sgeasum
|
|
|
|
|
|
function psb_c_sspnrmi(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_spnrmi(ap,descp,info)
|
|
|
|
end function psb_c_sspnrmi
|
|
|
|
function psb_c_sgedot(xh,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
real(c_float) :: res
|
|
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1.0
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
res = psb_gedot(xp,yp,descp,info)
|
|
|
|
end function psb_c_sgedot
|
|
|
|
|
|
function psb_c_sspmm(alpha,ah,xh,beta,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
real(c_float), value :: alpha, beta
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_spmm(alpha,ap,xp,beta,yp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sspmm
|
|
|
|
|
|
function psb_c_sspmm_opt(alpha,ah,xh,beta,yh,cdh,trans,doswap) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
real(c_float), value :: alpha, beta
|
|
character(c_char) :: trans
|
|
logical(c_bool), value :: doswap
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
character :: ftrans
|
|
logical :: fdoswap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
fdoswap = doswap
|
|
ftrans = trans
|
|
call psb_spmm(alpha,ap,xp,beta,yp,descp,info,trans=ftrans,doswap=fdoswap)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sspmm_opt
|
|
|
|
|
|
function psb_c_sspsm(alpha,ah,xh,beta,yh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_svector) :: xh,yh
|
|
type(psb_c_descriptor) :: cdh
|
|
real(c_float), value :: alpha, beta
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_s_vect_type), pointer :: xp,yp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(xh%item)) then
|
|
call c_f_pointer(xh%item,xp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(yh%item)) then
|
|
call c_f_pointer(yh%item,yp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call psb_spsm(alpha,ap,xp,beta,yp,descp,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sspsm
|
|
|
|
function psb_c_snnz(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = 0
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = psb_nnz(ap,descp,info)
|
|
|
|
end function psb_c_snnz
|
|
|
|
function psb_c_sis_matupd(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
logical(c_bool) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = .false.
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = ap%is_upd()
|
|
end function
|
|
|
|
function psb_c_sis_matasb(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
logical(c_bool) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = .false.
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = ap%is_asb()
|
|
end function
|
|
|
|
function psb_c_sis_matbld(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
logical(c_bool) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = .false.
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
res = ap%is_bld()
|
|
end function
|
|
|
|
function psb_c_sset_matupd(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call ap%set_upd()
|
|
|
|
res = psb_success_
|
|
end function
|
|
|
|
function psb_c_sset_matasb(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
|
|
res = -1;
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call ap%set_asb()
|
|
|
|
res = psb_success_
|
|
|
|
end function
|
|
|
|
function psb_c_sset_matbld(ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call ap%set_bld()
|
|
|
|
res = psb_success_
|
|
end function
|
|
|
|
function psb_c_scopy_mat(ah,bh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
type(psb_c_sspmat) :: ah,bh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap,bp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(bh%item)) then
|
|
call c_f_pointer(bh%item,bp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call ap%clone(bp,info)
|
|
|
|
res = info
|
|
end function
|
|
|
|
function psb_c_sspscal(alpha,ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
real(c_float), value :: alpha
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call ap%scal(alpha,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sspscal
|
|
|
|
function psb_c_sspscalpid(alpha,ah,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
real(c_float), value :: alpha
|
|
type(psb_c_sspmat) :: ah
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call ap%scalpid(alpha,info)
|
|
|
|
res = info
|
|
|
|
end function psb_c_sspscalpid
|
|
|
|
function psb_c_sspaxpby(alpha,ah,beta,bh,cdh) bind(c) result(res)
|
|
implicit none
|
|
integer(psb_c_ipk_) :: res
|
|
|
|
real(c_float), value :: alpha
|
|
type(psb_c_sspmat) :: ah
|
|
real(c_float), value :: beta
|
|
type(psb_c_sspmat) :: bh
|
|
type(psb_c_descriptor) :: cdh
|
|
|
|
type(psb_desc_type), pointer :: descp
|
|
type(psb_sspmat_type), pointer :: ap,bp
|
|
integer(psb_c_ipk_) :: info
|
|
|
|
res = -1
|
|
if (c_associated(cdh%item)) then
|
|
call c_f_pointer(cdh%item,descp)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(ah%item)) then
|
|
call c_f_pointer(ah%item,ap)
|
|
else
|
|
return
|
|
end if
|
|
if (c_associated(bh%item)) then
|
|
call c_f_pointer(bh%item,bp)
|
|
else
|
|
return
|
|
end if
|
|
|
|
call ap%spaxpby(alpha,beta,bp,info)
|
|
|
|
res = info
|
|
end function psb_c_sspaxpby
|
|
|
|
end module psb_s_psblas_cbind_mod
|