|
|
@ -602,3 +602,102 @@ subroutine psb_dmamaxs(res,x,desc_a, info,jx,global)
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end subroutine psb_dmamaxs
|
|
|
|
end subroutine psb_dmamaxs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
! Function: psb_dmin_vect
|
|
|
|
|
|
|
|
! Computes the minimum value of X.
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
! mini := min(X(i))
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
! Arguments:
|
|
|
|
|
|
|
|
! x - type(psb_d_vect_type) The input vector.
|
|
|
|
|
|
|
|
! desc_a - type(psb_desc_type). The communication descriptor.
|
|
|
|
|
|
|
|
! info - integer. Return code
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function psb_dmin_vect(x, desc_a, info,global) result(res)
|
|
|
|
|
|
|
|
use psb_penv_mod
|
|
|
|
|
|
|
|
use psb_serial_mod
|
|
|
|
|
|
|
|
use psb_desc_mod
|
|
|
|
|
|
|
|
use psb_check_mod
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
use psb_d_vect_mod
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
real(psb_dpk_) :: res
|
|
|
|
|
|
|
|
type(psb_d_vect_type), intent (inout) :: x
|
|
|
|
|
|
|
|
type(psb_desc_type), intent (in) :: desc_a
|
|
|
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
|
|
|
logical, intent(in), optional :: global
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! locals
|
|
|
|
|
|
|
|
integer(psb_ipk_) :: ictxt, np, me,&
|
|
|
|
|
|
|
|
& err_act, iix, jjx
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: ix, jx, iy, ijy, m
|
|
|
|
|
|
|
|
logical :: global_
|
|
|
|
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
name='psb_dmin_vect'
|
|
|
|
|
|
|
|
info=psb_success_
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
|
|
if (psb_errstatus_fatal()) then
|
|
|
|
|
|
|
|
info = psb_err_internal_error_ ; goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ictxt=desc_a%get_context()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_info(ictxt, me, np)
|
|
|
|
|
|
|
|
if (np == -1) 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 (present(global)) then
|
|
|
|
|
|
|
|
global_ = global
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
global_ = .true.
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ix = 1
|
|
|
|
|
|
|
|
jx = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m = desc_a%get_global_rows()
|
|
|
|
|
|
|
|
call psb_chkvect(m,lone,x%get_nrows(),ix,jx,desc_a,info,iix,jjx)
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
|
|
|
ch_err='psb_chkvect'
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (iix /= 1) then
|
|
|
|
|
|
|
|
info=psb_err_ix_n1_iy_n1_unsupported_
|
|
|
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! compute local max
|
|
|
|
|
|
|
|
if ((desc_a%get_local_rows() > 0).and.(m /= 0)) then
|
|
|
|
|
|
|
|
res = x%minreal(desc_a%get_local_rows())
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
res = dzero
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! compute global min
|
|
|
|
|
|
|
|
if (global_) call psb_min(ictxt, res)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9999 call psb_error_handler(ictxt,err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end function psb_dmin_vect
|
|
|
|