mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-07 07:04:57 +00:00
Added psb_geabs, final output not working
This commit is contained in:
@@ -479,5 +479,16 @@ module psb_c_psblas_mod
|
||||
end subroutine psb_cinv_vect_check
|
||||
end interface
|
||||
|
||||
interface psb_geabs
|
||||
subroutine psb_cabs_vect(x,y,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
& psb_c_vect_type
|
||||
type(psb_c_vect_type), intent (inout) :: x
|
||||
type(psb_c_vect_type), intent (inout) :: y
|
||||
type(psb_desc_type), intent (in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_cabs_vect
|
||||
end interface
|
||||
|
||||
|
||||
end module psb_c_psblas_mod
|
||||
|
||||
@@ -479,6 +479,17 @@ module psb_d_psblas_mod
|
||||
end subroutine psb_dinv_vect_check
|
||||
end interface
|
||||
|
||||
interface psb_geabs
|
||||
subroutine psb_dabs_vect(x,y,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
& psb_d_vect_type
|
||||
type(psb_d_vect_type), intent (inout) :: x
|
||||
type(psb_d_vect_type), intent (inout) :: y
|
||||
type(psb_desc_type), intent (in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_dabs_vect
|
||||
end interface
|
||||
|
||||
interface psb_gecmp
|
||||
subroutine psb_dcmp_vect(x,c,z,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
|
||||
@@ -479,6 +479,17 @@ module psb_s_psblas_mod
|
||||
end subroutine psb_sinv_vect_check
|
||||
end interface
|
||||
|
||||
interface psb_geabs
|
||||
subroutine psb_sabs_vect(x,y,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
& psb_s_vect_type
|
||||
type(psb_s_vect_type), intent (inout) :: x
|
||||
type(psb_s_vect_type), intent (inout) :: y
|
||||
type(psb_desc_type), intent (in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_sabs_vect
|
||||
end interface
|
||||
|
||||
interface psb_gecmp
|
||||
subroutine psb_scmp_vect(x,c,z,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
|
||||
@@ -479,5 +479,16 @@ module psb_z_psblas_mod
|
||||
end subroutine psb_zinv_vect_check
|
||||
end interface
|
||||
|
||||
interface psb_geabs
|
||||
subroutine psb_zabs_vect(x,y,desc_a,info)
|
||||
import :: psb_desc_type, psb_ipk_, &
|
||||
& psb_z_vect_type
|
||||
type(psb_z_vect_type), intent (inout) :: x
|
||||
type(psb_z_vect_type), intent (inout) :: y
|
||||
type(psb_desc_type), intent (in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_zabs_vect
|
||||
end interface
|
||||
|
||||
|
||||
end module psb_z_psblas_mod
|
||||
|
||||
@@ -2770,7 +2770,7 @@ contains
|
||||
|
||||
if (x%is_dev()) call x%sync()
|
||||
if (allocated(x%v)) then
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),cone,x,czero,info)
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),czero,x,cone,info)
|
||||
call y%absval()
|
||||
end if
|
||||
|
||||
|
||||
@@ -2828,7 +2828,7 @@ contains
|
||||
|
||||
if (x%is_dev()) call x%sync()
|
||||
if (allocated(x%v)) then
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),done,x,dzero,info)
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),dzero,x,done,info)
|
||||
call y%absval()
|
||||
end if
|
||||
|
||||
|
||||
@@ -2828,7 +2828,7 @@ contains
|
||||
|
||||
if (x%is_dev()) call x%sync()
|
||||
if (allocated(x%v)) then
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),sone,x,szero,info)
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),szero,x,sone,info)
|
||||
call y%absval()
|
||||
end if
|
||||
|
||||
|
||||
@@ -2770,7 +2770,7 @@ contains
|
||||
|
||||
if (x%is_dev()) call x%sync()
|
||||
if (allocated(x%v)) then
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),zone,x,zzero,info)
|
||||
call y%axpby(min(x%get_nrows(),y%get_nrows()),zzero,x,zone,info)
|
||||
call y%absval()
|
||||
end if
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ OBJS= psb_ddot.o psb_damax.o psb_dasum.o psb_daxpby.o\
|
||||
psb_cmlt_vect.o psb_dmlt_vect.o psb_zmlt_vect.o psb_smlt_vect.o\
|
||||
psb_cdiv_vect.o psb_ddiv_vect.o psb_zdiv_vect.o psb_sdiv_vect.o\
|
||||
psb_cinv_vect.o psb_dinv_vect.o psb_zinv_vect.o psb_sinv_vect.o\
|
||||
psb_dcmp_vect.o psb_scmp_vect.o
|
||||
psb_dcmp_vect.o psb_scmp_vect.o \
|
||||
psb_cabs_vect.o psb_dabs_vect.o psb_sabs_vect.o \
|
||||
psb_zabs_vect.o
|
||||
|
||||
LIBDIR=..
|
||||
INCDIR=..
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
!
|
||||
! 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_cabs_vect
|
||||
|
||||
subroutine psb_cabs_vect(x,y,desc_a,info)
|
||||
use psb_base_mod, psb_protect_name => psb_cabs_vect
|
||||
implicit none
|
||||
type(psb_c_vect_type), intent (inout) :: x
|
||||
type(psb_c_vect_type), intent (inout) :: y
|
||||
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, m
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
name='psb_c_abs_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(x%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (.not.allocated(y%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
ix = ione
|
||||
iy = ione
|
||||
|
||||
m = desc_a%get_global_rows()
|
||||
|
||||
! check vector correctness
|
||||
call psb_chkvect(m,lone,x%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(m,lone,y%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 y%absval(x)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_cabs_vect
|
||||
@@ -0,0 +1,105 @@
|
||||
!
|
||||
! 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_dabs_vect
|
||||
|
||||
subroutine psb_dabs_vect(x,y,desc_a,info)
|
||||
use psb_base_mod, psb_protect_name => psb_dabs_vect
|
||||
implicit none
|
||||
type(psb_d_vect_type), intent (inout) :: x
|
||||
type(psb_d_vect_type), intent (inout) :: y
|
||||
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, m
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
name='psb_d_abs_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(x%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (.not.allocated(y%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
ix = ione
|
||||
iy = ione
|
||||
|
||||
m = desc_a%get_global_rows()
|
||||
|
||||
! check vector correctness
|
||||
call psb_chkvect(m,lone,x%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(m,lone,y%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 y%absval(x)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dabs_vect
|
||||
@@ -0,0 +1,105 @@
|
||||
!
|
||||
! 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_sabs_vect
|
||||
|
||||
subroutine psb_sabs_vect(x,y,desc_a,info)
|
||||
use psb_base_mod, psb_protect_name => psb_sabs_vect
|
||||
implicit none
|
||||
type(psb_s_vect_type), intent (inout) :: x
|
||||
type(psb_s_vect_type), intent (inout) :: y
|
||||
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, m
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
name='psb_s_abs_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(x%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (.not.allocated(y%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
ix = ione
|
||||
iy = ione
|
||||
|
||||
m = desc_a%get_global_rows()
|
||||
|
||||
! check vector correctness
|
||||
call psb_chkvect(m,lone,x%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(m,lone,y%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 y%absval(x)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sabs_vect
|
||||
@@ -0,0 +1,105 @@
|
||||
!
|
||||
! 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_zabs_vect
|
||||
|
||||
subroutine psb_zabs_vect(x,y,desc_a,info)
|
||||
use psb_base_mod, psb_protect_name => psb_zabs_vect
|
||||
implicit none
|
||||
type(psb_z_vect_type), intent (inout) :: x
|
||||
type(psb_z_vect_type), intent (inout) :: y
|
||||
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, m
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
name='psb_z_abs_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(x%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (.not.allocated(y%v)) then
|
||||
info = psb_err_invalid_vect_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
ix = ione
|
||||
iy = ione
|
||||
|
||||
m = desc_a%get_global_rows()
|
||||
|
||||
! check vector correctness
|
||||
call psb_chkvect(m,lone,x%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(m,lone,y%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 y%absval(x)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zabs_vect
|
||||
@@ -46,7 +46,7 @@ program vecoperation
|
||||
! descriptor
|
||||
type(psb_desc_type) :: desc_a
|
||||
! vector
|
||||
type(psb_d_vect_type) :: x,y,z
|
||||
type(psb_d_vect_type) :: x,y,z,absz
|
||||
! blacs parameters
|
||||
integer(psb_ipk_) :: ictxt, iam, np
|
||||
! other variables
|
||||
@@ -115,12 +115,16 @@ program vecoperation
|
||||
call psb_geall(x,desc_a,info)
|
||||
call psb_geall(y,desc_a,info)
|
||||
call psb_geall(z,desc_a,info)
|
||||
call psb_geall(absz,desc_a,info)
|
||||
! Put entries into the vectors
|
||||
do ii=1,nlr
|
||||
zt(1) = 1.0
|
||||
zt(1) = 1.0_psb_dpk_
|
||||
call psb_geins(ib,myidx(ii:),zt(1:),x,desc_a,info)
|
||||
zt(1) = 2.0
|
||||
zt(1) = 2.0_psb_dpk_
|
||||
call psb_geins(ib,myidx(ii:),zt(1:),y,desc_a,info)
|
||||
zt(1) = -10.0_psb_dpk_
|
||||
call psb_geins(ib,myidx(ii:),zt(1:),z,desc_a,info)
|
||||
call psb_geins(ib,myidx(ii:),zt(1:),absz,desc_a,info)
|
||||
end do
|
||||
! Assemble
|
||||
call psb_cdasb(desc_a,info)
|
||||
@@ -132,6 +136,8 @@ program vecoperation
|
||||
end if
|
||||
if (info == psb_success_) call psb_geasb(x,desc_a,info)
|
||||
if (info == psb_success_) call psb_geasb(y,desc_a,info)
|
||||
if (info == psb_success_) call psb_geasb(z,desc_a,info)
|
||||
if (info == psb_success_) call psb_geasb(absz,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='vec asb rout.'
|
||||
@@ -198,6 +204,21 @@ program vecoperation
|
||||
write(psb_out_unit,'("z = ",es12.1)')vz(:)
|
||||
end if
|
||||
|
||||
call psb_geaxpby(-1.0_psb_dpk_, x, 0.0_psb_dpk_, x, desc_a, info)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("abs : z = |x|")')
|
||||
vx = x%get_vect()
|
||||
write(psb_out_unit,'("x = ",es12.1)')vx(:)
|
||||
end if
|
||||
|
||||
call psb_geabs(x,absz,desc_a,info)
|
||||
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("info = ",I1)')info
|
||||
vz = absz%get_vect()
|
||||
write(psb_out_unit,'("|x| = ",es12.1)')vz(:)
|
||||
end if
|
||||
|
||||
c = 1.0/2.0;
|
||||
call psb_gecmp(x,c,z,desc_a,info);
|
||||
|
||||
@@ -214,6 +235,8 @@ program vecoperation
|
||||
!
|
||||
call psb_gefree(x,desc_a,info)
|
||||
call psb_gefree(y,desc_a,info)
|
||||
call psb_gefree(z,desc_a,info)
|
||||
call psb_gefree(absz,desc_a,info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
|
||||
Reference in New Issue
Block a user