Added minimum of realtype distributed vectors

This commit is contained in:
Cirdans-Home
2020-02-25 17:22:49 +01:00
parent 601b56f189
commit 0edb671d21
16 changed files with 454 additions and 160 deletions
+1
View File
@@ -183,6 +183,7 @@ module psb_c_psblas_mod
end subroutine psb_cmamaxs
end interface
interface psb_geasum
function psb_casum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
+12
View File
@@ -183,6 +183,18 @@ module psb_d_psblas_mod
end subroutine psb_dmamaxs
end interface
interface psb_gemin
function psb_dmin_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
& psb_d_vect_type, psb_dspmat_type
real(psb_dpk_) :: res
type(psb_d_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_dmin_vect
end interface
interface psb_geasum
function psb_dasum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
+12
View File
@@ -183,6 +183,18 @@ module psb_s_psblas_mod
end subroutine psb_smamaxs
end interface
interface psb_gemin
function psb_smin_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
& psb_s_vect_type, psb_sspmat_type
real(psb_spk_) :: res
type(psb_s_vect_type), intent (inout) :: x
type(psb_desc_type), intent (in) :: desc_a
integer(psb_ipk_), intent(out) :: info
logical, intent(in), optional :: global
end function psb_smin_vect
end interface
interface psb_geasum
function psb_sasum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_spk_, psb_ipk_, &
+1
View File
@@ -183,6 +183,7 @@ module psb_z_psblas_mod
end subroutine psb_zmamaxs
end interface
interface psb_geasum
function psb_zasum_vect(x, desc_a, info,global) result(res)
import :: psb_desc_type, psb_dpk_, psb_ipk_, &
@@ -1519,6 +1519,7 @@ contains
end function c_base_amax
!
!> Function base_asum
!! \memberof psb_c_base_vect_type
+1
View File
@@ -988,6 +988,7 @@ contains
end function c_vect_amax
function c_vect_asum(n,x) result(res)
implicit none
class(psb_c_vect_type), intent(inout) :: x
@@ -194,6 +194,7 @@ module psb_d_base_vect_mod
procedure, pass(z) :: acmp_v2 => d_base_acmp_v2
generic, public :: acmp => acmp_a2,acmp_v2
procedure, pass(x) :: minreal => d_base_min
procedure, pass(m) :: mask_v => d_base_mask_v
procedure, pass(m) :: mask_a => d_base_mask_a
generic, public :: mask => mask_a, mask_v
@@ -1522,6 +1523,22 @@ contains
end function d_base_amax
!
!> Function base_min
!! \memberof psb_d_base_vect_type
!! \brief min x(1:n)
!! \param n how many entries to consider
function d_base_min(n,x) result(res)
implicit none
class(psb_d_base_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_dpk_) :: res
if (x%is_dev()) call x%sync()
res = minval(x%v(1:n))
end function d_base_min
!
!> Function base_asum
!! \memberof psb_d_base_vect_type
+15
View File
@@ -118,6 +118,7 @@ module psb_d_vect_mod
procedure, pass(z) :: acmp_v2 => d_vect_acmp_v2
generic, public :: acmp => acmp_a2, acmp_v2
procedure, pass(x) :: minreal => d_vect_min
procedure, pass(m) :: mask_v => d_vect_mask_v
procedure, pass(m) :: mask_a => d_vect_mask_a
generic, public :: mask => mask_a, mask_v
@@ -991,6 +992,20 @@ contains
end function d_vect_amax
function d_vect_min(n,x) result(res)
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
res = x%v%minreal(n)
else
res = dzero
end if
end function d_vect_min
function d_vect_asum(n,x) result(res)
implicit none
class(psb_d_vect_type), intent(inout) :: x
@@ -194,6 +194,7 @@ module psb_s_base_vect_mod
procedure, pass(z) :: acmp_v2 => s_base_acmp_v2
generic, public :: acmp => acmp_a2,acmp_v2
procedure, pass(x) :: minreal => s_base_min
procedure, pass(m) :: mask_v => s_base_mask_v
procedure, pass(m) :: mask_a => s_base_mask_a
generic, public :: mask => mask_a, mask_v
@@ -1522,6 +1523,22 @@ contains
end function s_base_amax
!
!> Function base_min
!! \memberof psb_s_base_vect_type
!! \brief min x(1:n)
!! \param n how many entries to consider
function s_base_min(n,x) result(res)
implicit none
class(psb_s_base_vect_type), intent(inout) :: x
integer(psb_ipk_), intent(in) :: n
real(psb_spk_) :: res
if (x%is_dev()) call x%sync()
res = minval(x%v(1:n))
end function s_base_min
!
!> Function base_asum
!! \memberof psb_s_base_vect_type
+15
View File
@@ -118,6 +118,7 @@ module psb_s_vect_mod
procedure, pass(z) :: acmp_v2 => s_vect_acmp_v2
generic, public :: acmp => acmp_a2, acmp_v2
procedure, pass(x) :: minreal => s_vect_min
procedure, pass(m) :: mask_v => s_vect_mask_v
procedure, pass(m) :: mask_a => s_vect_mask_a
generic, public :: mask => mask_a, mask_v
@@ -991,6 +992,20 @@ contains
end function s_vect_amax
function s_vect_min(n,x) result(res)
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
res = x%v%minreal(n)
else
res = szero
end if
end function s_vect_min
function s_vect_asum(n,x) result(res)
implicit none
class(psb_s_vect_type), intent(inout) :: x
@@ -1519,6 +1519,7 @@ contains
end function z_base_amax
!
!> Function base_asum
!! \memberof psb_z_base_vect_type
+1
View File
@@ -988,6 +988,7 @@ contains
end function z_vect_amax
function z_vect_asum(n,x) result(res)
implicit none
class(psb_z_vect_type), intent(inout) :: x