|
|
@ -1028,9 +1028,23 @@ contains
|
|
|
|
real(psb_spk_) :: res
|
|
|
|
real(psb_spk_) :: res
|
|
|
|
integer(psb_ipk_) :: info
|
|
|
|
integer(psb_ipk_) :: info
|
|
|
|
|
|
|
|
|
|
|
|
if (allocated(x%v).and.allocated(w%v)) then
|
|
|
|
! Temp vectors
|
|
|
|
call w%v%mlt(x%v,info)
|
|
|
|
type(psb_c_vect_type) :: wtemp
|
|
|
|
res = w%v%nrm2(n)
|
|
|
|
|
|
|
|
|
|
|
|
if( allocated(w%v) ) then
|
|
|
|
|
|
|
|
! FIXME for GPU
|
|
|
|
|
|
|
|
allocate(wtemp%v, source=w%v, stat = info)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
info = -1
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
if (info /= 0 ) then
|
|
|
|
|
|
|
|
res = -sone
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (allocated(x%v)) then
|
|
|
|
|
|
|
|
call wtemp%v%mlt(x%v,info)
|
|
|
|
|
|
|
|
res = wtemp%v%nrm2(n)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
res = szero
|
|
|
|
res = szero
|
|
|
|
end if
|
|
|
|
end if
|
|
|
@ -1046,10 +1060,27 @@ contains
|
|
|
|
real(psb_spk_) :: res
|
|
|
|
real(psb_spk_) :: res
|
|
|
|
integer(psb_ipk_) :: info
|
|
|
|
integer(psb_ipk_) :: info
|
|
|
|
|
|
|
|
|
|
|
|
if (allocated(x%v).and.allocated(w%v).and.allocated(id%v)) then
|
|
|
|
! Temp vectors
|
|
|
|
where( abs(id%v%v) <= szero) x%v%v = szero
|
|
|
|
type(psb_c_vect_type) :: wtemp
|
|
|
|
call w%v%mlt(x%v,info)
|
|
|
|
|
|
|
|
res = w%v%nrm2(n)
|
|
|
|
if( allocated(w%v) ) then
|
|
|
|
|
|
|
|
! FIXME for GPU
|
|
|
|
|
|
|
|
allocate(wtemp%v, source=w%v, stat = info)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
info = -1
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
if (info /= 0 ) then
|
|
|
|
|
|
|
|
res = -sone
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (allocated(x%v).and.allocated(id%v)) then
|
|
|
|
|
|
|
|
call wtemp%sync() ! FIXME for GPU
|
|
|
|
|
|
|
|
where( abs(id%v%v) <= szero) wtemp%v%v = szero
|
|
|
|
|
|
|
|
call wtemp%set_host() ! FIXME for GPU
|
|
|
|
|
|
|
|
call wtemp%v%mlt(x%v,info)
|
|
|
|
|
|
|
|
res = wtemp%v%nrm2(n)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
res = szero
|
|
|
|
res = szero
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|