mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-07 15:14:57 +00:00
Added generation of mask vector for constraint tests psb_mask
This commit is contained in:
@@ -523,4 +523,5 @@ module psb_c_psblas_mod
|
||||
end subroutine psb_ccmp_vect
|
||||
end interface
|
||||
|
||||
|
||||
end module psb_c_psblas_mod
|
||||
|
||||
@@ -523,4 +523,17 @@ module psb_d_psblas_mod
|
||||
end subroutine psb_dcmp_vect
|
||||
end interface
|
||||
|
||||
interface psb_mask
|
||||
subroutine psb_dmask_vect(c,x,m,t,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
& psb_d_vect_type, psb_dpk_
|
||||
type(psb_d_vect_type), intent (inout) :: c
|
||||
type(psb_d_vect_type), intent (inout) :: x
|
||||
type(psb_d_vect_type), intent (inout) :: m
|
||||
logical, intent(out) :: t
|
||||
type(psb_desc_type), intent (in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_dmask_vect
|
||||
end interface
|
||||
|
||||
end module psb_d_psblas_mod
|
||||
|
||||
@@ -523,4 +523,17 @@ module psb_s_psblas_mod
|
||||
end subroutine psb_scmp_vect
|
||||
end interface
|
||||
|
||||
interface psb_mask
|
||||
subroutine psb_smask_vect(c,x,m,t,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
& psb_s_vect_type, psb_spk_
|
||||
type(psb_s_vect_type), intent (inout) :: c
|
||||
type(psb_s_vect_type), intent (inout) :: x
|
||||
type(psb_s_vect_type), intent (inout) :: m
|
||||
logical, intent(out) :: t
|
||||
type(psb_desc_type), intent (in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_smask_vect
|
||||
end interface
|
||||
|
||||
end module psb_s_psblas_mod
|
||||
|
||||
@@ -523,4 +523,5 @@ module psb_z_psblas_mod
|
||||
end subroutine psb_zcmp_vect
|
||||
end interface
|
||||
|
||||
|
||||
end module psb_z_psblas_mod
|
||||
|
||||
@@ -194,6 +194,7 @@ module psb_c_base_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => c_base_acmp_v2
|
||||
generic, public :: acmp => acmp_a2,acmp_v2
|
||||
|
||||
|
||||
end type psb_c_base_vect_type
|
||||
|
||||
public :: psb_c_base_vect
|
||||
@@ -1718,6 +1719,7 @@ contains
|
||||
|
||||
end subroutine c_base_sctb_buf
|
||||
|
||||
|
||||
end module psb_c_base_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ module psb_c_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => c_vect_acmp_v2
|
||||
generic, public :: acmp => acmp_a2, acmp_v2
|
||||
|
||||
|
||||
end type psb_c_vect_type
|
||||
|
||||
public :: psb_c_vect
|
||||
@@ -1002,6 +1003,7 @@ contains
|
||||
end function c_vect_asum
|
||||
|
||||
|
||||
|
||||
end module psb_c_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -194,6 +194,10 @@ module psb_d_base_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => d_base_acmp_v2
|
||||
generic, public :: acmp => acmp_a2,acmp_v2
|
||||
|
||||
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
|
||||
|
||||
end type psb_d_base_vect_type
|
||||
|
||||
public :: psb_d_base_vect
|
||||
@@ -1718,6 +1722,99 @@ contains
|
||||
|
||||
end subroutine d_base_sctb_buf
|
||||
|
||||
!
|
||||
!> Function base_mask_a
|
||||
!! \memberof psb_d_base_vect_type
|
||||
!! \brief Peform constraint tests looking at the value of c
|
||||
!! \param x The array to be compared
|
||||
!! \param c The array containing the information on the type of test to be
|
||||
!! performed, if c(i) = 2 ">0", if c(i) = 1 ">=0", if c(i) = 0 no test, if
|
||||
!! c(i) =-1 "<=0", if c(i) = -2 "< 0"
|
||||
!! \param m The vector containing the result of the comparison 1.0 for a
|
||||
!! failed test, and 0.0 for a passed one.
|
||||
!! \param t logical resulting from an and operation on all the tests
|
||||
!! \param info return code
|
||||
!
|
||||
subroutine d_base_mask_a(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
real(psb_dpk_), intent(inout) :: c(:)
|
||||
real(psb_dpk_), intent(inout) :: x(:)
|
||||
class(psb_d_base_vect_type), intent(inout) :: m
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(out) :: t
|
||||
integer(psb_ipk_) :: i, n
|
||||
|
||||
if (m%is_dev()) call m%sync()
|
||||
t = .true.
|
||||
|
||||
n = size(x)
|
||||
do i = 1, n, 1
|
||||
if (c(i).eq.2_psb_dpk_) then
|
||||
if ( x(i) > dzero ) then
|
||||
m%v(i) = 0_psb_dpk_
|
||||
else
|
||||
m%v(i) = 1_psb_dpk_
|
||||
t = .false.
|
||||
end if
|
||||
elseif (c(i).eq.1_psb_dpk_) then
|
||||
if ( x(i) >= dzero ) then
|
||||
m%v(i) = 0_psb_dpk_
|
||||
else
|
||||
m%v(i) = 1_psb_dpk_
|
||||
t = .false.
|
||||
end if
|
||||
elseif (c(i).eq.-1_psb_dpk_) then
|
||||
if ( x(i) <= dzero ) then
|
||||
m%v(i) = 0_psb_dpk_
|
||||
else
|
||||
m%v(i) = 1_psb_dpk_
|
||||
t = .false.
|
||||
end if
|
||||
elseif (c(i).eq.-2_psb_dpk_) then
|
||||
if ( x(i) < dzero ) then
|
||||
m%v(i) = 0_psb_dpk_
|
||||
else
|
||||
m%v(i) = 1_psb_dpk_
|
||||
t = .false.
|
||||
end if
|
||||
else
|
||||
m%v(i) = 0_psb_dpk_
|
||||
end if
|
||||
end do
|
||||
info = 0
|
||||
|
||||
end subroutine d_base_mask_a
|
||||
!
|
||||
!> Function base_mask_v
|
||||
!! \memberof psb_d_base_vect_type
|
||||
!! \brief Peform constraint tests looking at the value of c
|
||||
!! \param x The vector to be compared
|
||||
!! \param c The vector containing the information on the type of test to be
|
||||
!! performed, if c(i) = 2 ">0", if c(i) = 1 ">=0", if c(i) = 0 no test, if
|
||||
!! c(i) =-1 "<=0", if c(i) = -2 "< 0"
|
||||
!! \param m The vector containing the result of the comparison 1.0 for a
|
||||
!! failed test, and 0.0 for a passed one.
|
||||
!! \param t logical resulting from an and operation on all the tests
|
||||
!! \param info return code
|
||||
!
|
||||
subroutine d_base_mask_v(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
class(psb_d_base_vect_type), intent(inout) :: c
|
||||
class(psb_d_base_vect_type), intent(inout) :: x
|
||||
class(psb_d_base_vect_type), intent(inout) :: m
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(out) :: t
|
||||
|
||||
info = 0
|
||||
if (x%is_dev()) call x%sync()
|
||||
if (c%is_dev()) call c%sync()
|
||||
|
||||
call m%mask(x%v,c%v,t,info)
|
||||
end subroutine d_base_mask_v
|
||||
|
||||
|
||||
end module psb_d_base_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -118,6 +118,10 @@ module psb_d_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => d_vect_acmp_v2
|
||||
generic, public :: acmp => acmp_a2, acmp_v2
|
||||
|
||||
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
|
||||
|
||||
end type psb_d_vect_type
|
||||
|
||||
public :: psb_d_vect
|
||||
@@ -1002,6 +1006,36 @@ contains
|
||||
end function d_vect_asum
|
||||
|
||||
|
||||
subroutine d_vect_mask_a(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
real(psb_dpk_), intent(inout) :: c(:)
|
||||
real(psb_dpk_), intent(inout) :: x(:)
|
||||
logical, intent(out) :: t;
|
||||
class(psb_d_vect_type), intent(inout) :: m
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
info = 0
|
||||
if (allocated(m%v)) &
|
||||
& call m%mask(c,x,t,info)
|
||||
|
||||
end subroutine d_vect_mask_a
|
||||
|
||||
subroutine d_vect_mask_v(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
class(psb_d_vect_type), intent(inout) :: c
|
||||
class(psb_d_vect_type), intent(inout) :: x
|
||||
class(psb_d_vect_type), intent(inout) :: m
|
||||
logical, intent(out) :: t;
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
info = 0
|
||||
if (allocated(x%v).and.allocated(c%v)) &
|
||||
& call m%v%mask(x%v,c%v,t,info)
|
||||
|
||||
end subroutine d_vect_mask_v
|
||||
|
||||
end module psb_d_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ module psb_i_base_vect_mod
|
||||
|
||||
|
||||
|
||||
|
||||
end type psb_i_base_vect_type
|
||||
|
||||
public :: psb_i_base_vect
|
||||
@@ -974,6 +975,7 @@ contains
|
||||
|
||||
end subroutine i_base_sctb_buf
|
||||
|
||||
|
||||
end module psb_i_base_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ module psb_i_vect_mod
|
||||
procedure, pass(x) :: set_sync => i_vect_set_sync
|
||||
|
||||
|
||||
|
||||
end type psb_i_vect_type
|
||||
|
||||
public :: psb_i_vect
|
||||
@@ -551,6 +552,7 @@ contains
|
||||
end function i_vect_is_dev
|
||||
|
||||
|
||||
|
||||
end module psb_i_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ module psb_l_base_vect_mod
|
||||
|
||||
|
||||
|
||||
|
||||
end type psb_l_base_vect_type
|
||||
|
||||
public :: psb_l_base_vect
|
||||
@@ -975,6 +976,7 @@ contains
|
||||
|
||||
end subroutine l_base_sctb_buf
|
||||
|
||||
|
||||
end module psb_l_base_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ module psb_l_vect_mod
|
||||
procedure, pass(x) :: set_sync => l_vect_set_sync
|
||||
|
||||
|
||||
|
||||
end type psb_l_vect_type
|
||||
|
||||
public :: psb_l_vect
|
||||
@@ -552,6 +553,7 @@ contains
|
||||
end function l_vect_is_dev
|
||||
|
||||
|
||||
|
||||
end module psb_l_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -194,6 +194,10 @@ module psb_s_base_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => s_base_acmp_v2
|
||||
generic, public :: acmp => acmp_a2,acmp_v2
|
||||
|
||||
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
|
||||
|
||||
end type psb_s_base_vect_type
|
||||
|
||||
public :: psb_s_base_vect
|
||||
@@ -1718,6 +1722,99 @@ contains
|
||||
|
||||
end subroutine s_base_sctb_buf
|
||||
|
||||
!
|
||||
!> Function base_mask_a
|
||||
!! \memberof psb_s_base_vect_type
|
||||
!! \brief Peform constraint tests looking at the value of c
|
||||
!! \param x The array to be compared
|
||||
!! \param c The array containing the information on the type of test to be
|
||||
!! performed, if c(i) = 2 ">0", if c(i) = 1 ">=0", if c(i) = 0 no test, if
|
||||
!! c(i) =-1 "<=0", if c(i) = -2 "< 0"
|
||||
!! \param m The vector containing the result of the comparison 1.0 for a
|
||||
!! failed test, and 0.0 for a passed one.
|
||||
!! \param t logical resulting from an and operation on all the tests
|
||||
!! \param info return code
|
||||
!
|
||||
subroutine s_base_mask_a(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
real(psb_spk_), intent(inout) :: c(:)
|
||||
real(psb_spk_), intent(inout) :: x(:)
|
||||
class(psb_s_base_vect_type), intent(inout) :: m
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(out) :: t
|
||||
integer(psb_ipk_) :: i, n
|
||||
|
||||
if (m%is_dev()) call m%sync()
|
||||
t = .true.
|
||||
|
||||
n = size(x)
|
||||
do i = 1, n, 1
|
||||
if (c(i).eq.2_psb_spk_) then
|
||||
if ( x(i) > szero ) then
|
||||
m%v(i) = 0_psb_spk_
|
||||
else
|
||||
m%v(i) = 1_psb_spk_
|
||||
t = .false.
|
||||
end if
|
||||
elseif (c(i).eq.1_psb_spk_) then
|
||||
if ( x(i) >= szero ) then
|
||||
m%v(i) = 0_psb_spk_
|
||||
else
|
||||
m%v(i) = 1_psb_spk_
|
||||
t = .false.
|
||||
end if
|
||||
elseif (c(i).eq.-1_psb_spk_) then
|
||||
if ( x(i) <= szero ) then
|
||||
m%v(i) = 0_psb_spk_
|
||||
else
|
||||
m%v(i) = 1_psb_spk_
|
||||
t = .false.
|
||||
end if
|
||||
elseif (c(i).eq.-2_psb_spk_) then
|
||||
if ( x(i) < szero ) then
|
||||
m%v(i) = 0_psb_spk_
|
||||
else
|
||||
m%v(i) = 1_psb_spk_
|
||||
t = .false.
|
||||
end if
|
||||
else
|
||||
m%v(i) = 0_psb_spk_
|
||||
end if
|
||||
end do
|
||||
info = 0
|
||||
|
||||
end subroutine s_base_mask_a
|
||||
!
|
||||
!> Function base_mask_v
|
||||
!! \memberof psb_s_base_vect_type
|
||||
!! \brief Peform constraint tests looking at the value of c
|
||||
!! \param x The vector to be compared
|
||||
!! \param c The vector containing the information on the type of test to be
|
||||
!! performed, if c(i) = 2 ">0", if c(i) = 1 ">=0", if c(i) = 0 no test, if
|
||||
!! c(i) =-1 "<=0", if c(i) = -2 "< 0"
|
||||
!! \param m The vector containing the result of the comparison 1.0 for a
|
||||
!! failed test, and 0.0 for a passed one.
|
||||
!! \param t logical resulting from an and operation on all the tests
|
||||
!! \param info return code
|
||||
!
|
||||
subroutine s_base_mask_v(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
class(psb_s_base_vect_type), intent(inout) :: c
|
||||
class(psb_s_base_vect_type), intent(inout) :: x
|
||||
class(psb_s_base_vect_type), intent(inout) :: m
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(out) :: t
|
||||
|
||||
info = 0
|
||||
if (x%is_dev()) call x%sync()
|
||||
if (c%is_dev()) call c%sync()
|
||||
|
||||
call m%mask(x%v,c%v,t,info)
|
||||
end subroutine s_base_mask_v
|
||||
|
||||
|
||||
end module psb_s_base_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -118,6 +118,10 @@ module psb_s_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => s_vect_acmp_v2
|
||||
generic, public :: acmp => acmp_a2, acmp_v2
|
||||
|
||||
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
|
||||
|
||||
end type psb_s_vect_type
|
||||
|
||||
public :: psb_s_vect
|
||||
@@ -1002,6 +1006,36 @@ contains
|
||||
end function s_vect_asum
|
||||
|
||||
|
||||
subroutine s_vect_mask_a(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
real(psb_spk_), intent(inout) :: c(:)
|
||||
real(psb_spk_), intent(inout) :: x(:)
|
||||
logical, intent(out) :: t;
|
||||
class(psb_s_vect_type), intent(inout) :: m
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
info = 0
|
||||
if (allocated(m%v)) &
|
||||
& call m%mask(c,x,t,info)
|
||||
|
||||
end subroutine s_vect_mask_a
|
||||
|
||||
subroutine s_vect_mask_v(c,x,m,t,info)
|
||||
use psi_serial_mod
|
||||
implicit none
|
||||
class(psb_s_vect_type), intent(inout) :: c
|
||||
class(psb_s_vect_type), intent(inout) :: x
|
||||
class(psb_s_vect_type), intent(inout) :: m
|
||||
logical, intent(out) :: t;
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
info = 0
|
||||
if (allocated(x%v).and.allocated(c%v)) &
|
||||
& call m%v%mask(x%v,c%v,t,info)
|
||||
|
||||
end subroutine s_vect_mask_v
|
||||
|
||||
end module psb_s_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@ module psb_z_base_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => z_base_acmp_v2
|
||||
generic, public :: acmp => acmp_a2,acmp_v2
|
||||
|
||||
|
||||
end type psb_z_base_vect_type
|
||||
|
||||
public :: psb_z_base_vect
|
||||
@@ -1718,6 +1719,7 @@ contains
|
||||
|
||||
end subroutine z_base_sctb_buf
|
||||
|
||||
|
||||
end module psb_z_base_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ module psb_z_vect_mod
|
||||
procedure, pass(z) :: acmp_v2 => z_vect_acmp_v2
|
||||
generic, public :: acmp => acmp_a2, acmp_v2
|
||||
|
||||
|
||||
end type psb_z_vect_type
|
||||
|
||||
public :: psb_z_vect
|
||||
@@ -1002,6 +1003,7 @@ contains
|
||||
end function z_vect_asum
|
||||
|
||||
|
||||
|
||||
end module psb_z_vect_mod
|
||||
|
||||
|
||||
|
||||
@@ -103,3 +103,4 @@ subroutine psb_ccmp_vect(x,c,z,desc_a,info)
|
||||
return
|
||||
|
||||
end subroutine psb_ccmp_vect
|
||||
|
||||
|
||||
@@ -103,3 +103,124 @@ subroutine psb_dcmp_vect(x,c,z,desc_a,info)
|
||||
return
|
||||
|
||||
end subroutine psb_dcmp_vect
|
||||
|
||||
!
|
||||
! 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_dmask_vect
|
||||
|
||||
subroutine psb_dmask_vect(c,x,m,t,desc_a,info)
|
||||
use psb_base_mod, psb_protect_name => psb_dmask_vect
|
||||
implicit none
|
||||
type(psb_d_vect_type), intent (inout) :: c
|
||||
type(psb_d_vect_type), intent (inout) :: x
|
||||
type(psb_d_vect_type), intent (inout) :: m
|
||||
logical, intent(out) :: t
|
||||
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, mm
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
name='psb_d_mask_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(c%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
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(m%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
ix = ione
|
||||
iy = ione
|
||||
|
||||
mm = desc_a%get_global_rows()
|
||||
|
||||
! check vector correctness
|
||||
call psb_chkvect(mm,lone,c%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(mm,lone,x%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
|
||||
call psb_chkvect(mm,lone,m%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 m%mask(c,x,t,info)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dmask_vect
|
||||
|
||||
|
||||
|
||||
@@ -103,3 +103,124 @@ subroutine psb_scmp_vect(x,c,z,desc_a,info)
|
||||
return
|
||||
|
||||
end subroutine psb_scmp_vect
|
||||
|
||||
!
|
||||
! 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_smask_vect
|
||||
|
||||
subroutine psb_smask_vect(c,x,m,t,desc_a,info)
|
||||
use psb_base_mod, psb_protect_name => psb_smask_vect
|
||||
implicit none
|
||||
type(psb_s_vect_type), intent (inout) :: c
|
||||
type(psb_s_vect_type), intent (inout) :: x
|
||||
type(psb_s_vect_type), intent (inout) :: m
|
||||
logical, intent(out) :: t
|
||||
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, mm
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
name='psb_s_mask_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(c%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
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(m%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
ix = ione
|
||||
iy = ione
|
||||
|
||||
mm = desc_a%get_global_rows()
|
||||
|
||||
! check vector correctness
|
||||
call psb_chkvect(mm,lone,c%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(mm,lone,x%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
|
||||
call psb_chkvect(mm,lone,m%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 m%mask(c,x,t,info)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_smask_vect
|
||||
|
||||
|
||||
|
||||
@@ -103,3 +103,4 @@ subroutine psb_zcmp_vect(x,c,z,desc_a,info)
|
||||
return
|
||||
|
||||
end subroutine psb_zcmp_vect
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ program vecoperation
|
||||
character(len=20) :: name,ch_err,readinput
|
||||
real(psb_dpk_), allocatable :: vx(:), vy(:), vz(:)
|
||||
real(psb_dpk_) :: c
|
||||
logical :: t
|
||||
|
||||
info=psb_success_
|
||||
|
||||
@@ -225,6 +226,8 @@ program vecoperation
|
||||
write(psb_out_unit,'("z = ",es12.1)')vz(:)
|
||||
end if
|
||||
|
||||
call psb_mask(z,x,absz,t,desc_a,info)
|
||||
|
||||
write(psb_out_unit,'("Computation of vector norms:")')
|
||||
norm1 = psb_norm1(x,desc_a,info)
|
||||
norm2 = psb_norm2(x,desc_a,info)
|
||||
|
||||
Reference in New Issue
Block a user