diff --git a/base/modules/serial/psb_c_base_mat_mod.f90 b/base/modules/serial/psb_c_base_mat_mod.f90 index 87b5f55e..52d9cd83 100644 --- a/base/modules/serial/psb_c_base_mat_mod.f90 +++ b/base/modules/serial/psb_c_base_mat_mod.f90 @@ -167,6 +167,7 @@ module psb_c_base_mat_mod procedure, pass(a) :: fix => psb_c_fix_coo procedure, pass(a) :: trim => psb_c_coo_trim procedure, pass(a) :: clean_zeros => psb_c_coo_clean_zeros + procedure, pass(a) :: clean_negidx => psb_c_coo_clean_negidx procedure, pass(a) :: print => psb_c_coo_print procedure, pass(a) :: free => c_coo_free procedure, pass(a) :: mold => psb_c_coo_mold @@ -1328,7 +1329,47 @@ module psb_c_base_mat_mod integer(psb_ipk_), intent(out) :: info end subroutine psb_c_coo_clean_zeros end interface - + + ! + !> + !! \memberof psb_c_coo_sparse_mat + !! \brief Take out any entries with negative row or column index + !! May happen when converting local/global numbering + !! \param info return code + !! + ! + interface + subroutine psb_c_coo_clean_negidx(a,info) + import + class(psb_c_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_c_coo_clean_negidx + end interface + + ! + !> Funtion: coo_clean_negidx_inner + !! \brief Take out any entries with negative row or column index + !! Used internally by coo_clean_negidx + !! \param nzin Number of entries on input to be handled + !! \param ia(:) Row indices + !! \param ja(:) Col indices + !! \param val(:) Coefficients + !! \param nzout Number of entries after sorting/duplicate handling + !! \param info return code + !! + ! + interface psb_coo_clean_negidx_inner + subroutine psb_c_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + import + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + complex(psb_spk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + end subroutine psb_c_coo_clean_negidx_inner + end interface psb_coo_clean_negidx_inner + + ! !> !! \memberof psb_c_coo_sparse_mat diff --git a/base/modules/serial/psb_d_base_mat_mod.f90 b/base/modules/serial/psb_d_base_mat_mod.f90 index cb160f83..36eab5b3 100644 --- a/base/modules/serial/psb_d_base_mat_mod.f90 +++ b/base/modules/serial/psb_d_base_mat_mod.f90 @@ -167,6 +167,7 @@ module psb_d_base_mat_mod procedure, pass(a) :: fix => psb_d_fix_coo procedure, pass(a) :: trim => psb_d_coo_trim procedure, pass(a) :: clean_zeros => psb_d_coo_clean_zeros + procedure, pass(a) :: clean_negidx => psb_d_coo_clean_negidx procedure, pass(a) :: print => psb_d_coo_print procedure, pass(a) :: free => d_coo_free procedure, pass(a) :: mold => psb_d_coo_mold @@ -1328,7 +1329,47 @@ module psb_d_base_mat_mod integer(psb_ipk_), intent(out) :: info end subroutine psb_d_coo_clean_zeros end interface - + + ! + !> + !! \memberof psb_d_coo_sparse_mat + !! \brief Take out any entries with negative row or column index + !! May happen when converting local/global numbering + !! \param info return code + !! + ! + interface + subroutine psb_d_coo_clean_negidx(a,info) + import + class(psb_d_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_d_coo_clean_negidx + end interface + + ! + !> Funtion: coo_clean_negidx_inner + !! \brief Take out any entries with negative row or column index + !! Used internally by coo_clean_negidx + !! \param nzin Number of entries on input to be handled + !! \param ia(:) Row indices + !! \param ja(:) Col indices + !! \param val(:) Coefficients + !! \param nzout Number of entries after sorting/duplicate handling + !! \param info return code + !! + ! + interface psb_coo_clean_negidx_inner + subroutine psb_d_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + import + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + real(psb_dpk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + end subroutine psb_d_coo_clean_negidx_inner + end interface psb_coo_clean_negidx_inner + + ! !> !! \memberof psb_d_coo_sparse_mat diff --git a/base/modules/serial/psb_s_base_mat_mod.f90 b/base/modules/serial/psb_s_base_mat_mod.f90 index 080153d3..f95d82ae 100644 --- a/base/modules/serial/psb_s_base_mat_mod.f90 +++ b/base/modules/serial/psb_s_base_mat_mod.f90 @@ -167,6 +167,7 @@ module psb_s_base_mat_mod procedure, pass(a) :: fix => psb_s_fix_coo procedure, pass(a) :: trim => psb_s_coo_trim procedure, pass(a) :: clean_zeros => psb_s_coo_clean_zeros + procedure, pass(a) :: clean_negidx => psb_s_coo_clean_negidx procedure, pass(a) :: print => psb_s_coo_print procedure, pass(a) :: free => s_coo_free procedure, pass(a) :: mold => psb_s_coo_mold @@ -1328,7 +1329,47 @@ module psb_s_base_mat_mod integer(psb_ipk_), intent(out) :: info end subroutine psb_s_coo_clean_zeros end interface - + + ! + !> + !! \memberof psb_s_coo_sparse_mat + !! \brief Take out any entries with negative row or column index + !! May happen when converting local/global numbering + !! \param info return code + !! + ! + interface + subroutine psb_s_coo_clean_negidx(a,info) + import + class(psb_s_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_s_coo_clean_negidx + end interface + + ! + !> Funtion: coo_clean_negidx_inner + !! \brief Take out any entries with negative row or column index + !! Used internally by coo_clean_negidx + !! \param nzin Number of entries on input to be handled + !! \param ia(:) Row indices + !! \param ja(:) Col indices + !! \param val(:) Coefficients + !! \param nzout Number of entries after sorting/duplicate handling + !! \param info return code + !! + ! + interface psb_coo_clean_negidx_inner + subroutine psb_s_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + import + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + real(psb_spk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + end subroutine psb_s_coo_clean_negidx_inner + end interface psb_coo_clean_negidx_inner + + ! !> !! \memberof psb_s_coo_sparse_mat diff --git a/base/modules/serial/psb_z_base_mat_mod.f90 b/base/modules/serial/psb_z_base_mat_mod.f90 index 0f22326b..29b99c10 100644 --- a/base/modules/serial/psb_z_base_mat_mod.f90 +++ b/base/modules/serial/psb_z_base_mat_mod.f90 @@ -167,6 +167,7 @@ module psb_z_base_mat_mod procedure, pass(a) :: fix => psb_z_fix_coo procedure, pass(a) :: trim => psb_z_coo_trim procedure, pass(a) :: clean_zeros => psb_z_coo_clean_zeros + procedure, pass(a) :: clean_negidx => psb_z_coo_clean_negidx procedure, pass(a) :: print => psb_z_coo_print procedure, pass(a) :: free => z_coo_free procedure, pass(a) :: mold => psb_z_coo_mold @@ -1328,7 +1329,47 @@ module psb_z_base_mat_mod integer(psb_ipk_), intent(out) :: info end subroutine psb_z_coo_clean_zeros end interface - + + ! + !> + !! \memberof psb_z_coo_sparse_mat + !! \brief Take out any entries with negative row or column index + !! May happen when converting local/global numbering + !! \param info return code + !! + ! + interface + subroutine psb_z_coo_clean_negidx(a,info) + import + class(psb_z_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_z_coo_clean_negidx + end interface + + ! + !> Funtion: coo_clean_negidx_inner + !! \brief Take out any entries with negative row or column index + !! Used internally by coo_clean_negidx + !! \param nzin Number of entries on input to be handled + !! \param ia(:) Row indices + !! \param ja(:) Col indices + !! \param val(:) Coefficients + !! \param nzout Number of entries after sorting/duplicate handling + !! \param info return code + !! + ! + interface psb_coo_clean_negidx_inner + subroutine psb_z_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + import + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + complex(psb_dpk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + end subroutine psb_z_coo_clean_negidx_inner + end interface psb_coo_clean_negidx_inner + + ! !> !! \memberof psb_z_coo_sparse_mat diff --git a/base/serial/impl/psb_c_coo_impl.f90 b/base/serial/impl/psb_c_coo_impl.f90 index 3d0db0b3..a48c1e41 100644 --- a/base/serial/impl/psb_c_coo_impl.f90 +++ b/base/serial/impl/psb_c_coo_impl.f90 @@ -354,6 +354,44 @@ subroutine psb_c_coo_clean_zeros(a, info) end subroutine psb_c_coo_clean_zeros +subroutine psb_c_coo_clean_negidx(a,info) + use psb_error_mod + use psb_c_base_mat_mod, psb_protect_name => psb_c_coo_clean_negidx + implicit none + class(psb_c_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: nz + call psb_coo_clean_negidx_inner(a%get_nzeros(),a%ia,a%ja,a%val,nz,info) + if (info == 0) call a%set_nzeros(nz) + +end subroutine psb_c_coo_clean_negidx + +subroutine psb_c_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + use psb_error_mod + use psb_c_base_mat_mod, psb_protect_name => psb_c_coo_clean_negidx_inner + implicit none + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + complex(psb_spk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: i + info = 0 + nzout = 0 + do i=1, nzin + if ((ia(i)>0).and.(ja(i)>0)) then + nzout = nzout + 1 + val(nzout) = val(i) + ia(nzout) = ia(i) + ja(nzout) = ja(i) + end if + end do + +end subroutine psb_c_coo_clean_negidx_inner subroutine psb_c_coo_allocate_mnnz(m,n,a,nz) use psb_c_base_mat_mod, psb_protect_name => psb_c_coo_allocate_mnnz diff --git a/base/serial/impl/psb_d_coo_impl.f90 b/base/serial/impl/psb_d_coo_impl.f90 index 89aa8b97..b8526b6e 100644 --- a/base/serial/impl/psb_d_coo_impl.f90 +++ b/base/serial/impl/psb_d_coo_impl.f90 @@ -354,6 +354,44 @@ subroutine psb_d_coo_clean_zeros(a, info) end subroutine psb_d_coo_clean_zeros +subroutine psb_d_coo_clean_negidx(a,info) + use psb_error_mod + use psb_d_base_mat_mod, psb_protect_name => psb_d_coo_clean_negidx + implicit none + class(psb_d_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: nz + call psb_coo_clean_negidx_inner(a%get_nzeros(),a%ia,a%ja,a%val,nz,info) + if (info == 0) call a%set_nzeros(nz) + +end subroutine psb_d_coo_clean_negidx + +subroutine psb_d_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + use psb_error_mod + use psb_d_base_mat_mod, psb_protect_name => psb_d_coo_clean_negidx_inner + implicit none + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + real(psb_dpk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: i + info = 0 + nzout = 0 + do i=1, nzin + if ((ia(i)>0).and.(ja(i)>0)) then + nzout = nzout + 1 + val(nzout) = val(i) + ia(nzout) = ia(i) + ja(nzout) = ja(i) + end if + end do + +end subroutine psb_d_coo_clean_negidx_inner subroutine psb_d_coo_allocate_mnnz(m,n,a,nz) use psb_d_base_mat_mod, psb_protect_name => psb_d_coo_allocate_mnnz diff --git a/base/serial/impl/psb_s_coo_impl.f90 b/base/serial/impl/psb_s_coo_impl.f90 index d327e12e..522665b0 100644 --- a/base/serial/impl/psb_s_coo_impl.f90 +++ b/base/serial/impl/psb_s_coo_impl.f90 @@ -354,6 +354,44 @@ subroutine psb_s_coo_clean_zeros(a, info) end subroutine psb_s_coo_clean_zeros +subroutine psb_s_coo_clean_negidx(a,info) + use psb_error_mod + use psb_s_base_mat_mod, psb_protect_name => psb_s_coo_clean_negidx + implicit none + class(psb_s_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: nz + call psb_coo_clean_negidx_inner(a%get_nzeros(),a%ia,a%ja,a%val,nz,info) + if (info == 0) call a%set_nzeros(nz) + +end subroutine psb_s_coo_clean_negidx + +subroutine psb_s_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + use psb_error_mod + use psb_s_base_mat_mod, psb_protect_name => psb_s_coo_clean_negidx_inner + implicit none + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + real(psb_spk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: i + info = 0 + nzout = 0 + do i=1, nzin + if ((ia(i)>0).and.(ja(i)>0)) then + nzout = nzout + 1 + val(nzout) = val(i) + ia(nzout) = ia(i) + ja(nzout) = ja(i) + end if + end do + +end subroutine psb_s_coo_clean_negidx_inner subroutine psb_s_coo_allocate_mnnz(m,n,a,nz) use psb_s_base_mat_mod, psb_protect_name => psb_s_coo_allocate_mnnz diff --git a/base/serial/impl/psb_z_coo_impl.f90 b/base/serial/impl/psb_z_coo_impl.f90 index d5ee9740..3f9c8dfd 100644 --- a/base/serial/impl/psb_z_coo_impl.f90 +++ b/base/serial/impl/psb_z_coo_impl.f90 @@ -354,6 +354,44 @@ subroutine psb_z_coo_clean_zeros(a, info) end subroutine psb_z_coo_clean_zeros +subroutine psb_z_coo_clean_negidx(a,info) + use psb_error_mod + use psb_z_base_mat_mod, psb_protect_name => psb_z_coo_clean_negidx + implicit none + class(psb_z_coo_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: nz + call psb_coo_clean_negidx_inner(a%get_nzeros(),a%ia,a%ja,a%val,nz,info) + if (info == 0) call a%set_nzeros(nz) + +end subroutine psb_z_coo_clean_negidx + +subroutine psb_z_coo_clean_negidx_inner(nzin,ia,ja,val,nzout,info) + use psb_error_mod + use psb_z_base_mat_mod, psb_protect_name => psb_z_coo_clean_negidx_inner + implicit none + integer(psb_ipk_), intent(in) :: nzin + integer(psb_ipk_), intent(inout) :: ia(:), ja(:) + complex(psb_dpk_), intent(inout) :: val(:) + integer(psb_ipk_), intent(out) :: nzout + integer(psb_ipk_), intent(out) :: info + ! + ! + integer(psb_ipk_) :: i + info = 0 + nzout = 0 + do i=1, nzin + if ((ia(i)>0).and.(ja(i)>0)) then + nzout = nzout + 1 + val(nzout) = val(i) + ia(nzout) = ia(i) + ja(nzout) = ja(i) + end if + end do + +end subroutine psb_z_coo_clean_negidx_inner subroutine psb_z_coo_allocate_mnnz(m,n,a,nz) use psb_z_base_mat_mod, psb_protect_name => psb_z_coo_allocate_mnnz diff --git a/docs/psblas-3.6.pdf b/docs/psblas-3.6.pdf index a48ca42e..c3fadb71 100644 --- a/docs/psblas-3.6.pdf +++ b/docs/psblas-3.6.pdf @@ -28674,8 +28674,8 @@ endobj 2051 0 obj << /Title (Parallel Sparse BLAS V. 3.6.1) /Subject (Parallel Sparse Basic Linear Algebra Subroutines) /Keywords (Computer Science Linear Algebra Fluid Dynamics Parallel Linux MPI PSBLAS Iterative Solvers Preconditioners) /Creator (pdfLaTeX) /Producer ($Id$) /Author()/Title()/Subject()/Creator(LaTeX with hyperref package)/Producer(pdfTeX-1.40.19)/Keywords() -/CreationDate (D:20191220094239Z) -/ModDate (D:20191220094239Z) +/CreationDate (D:20200408100040+02'00') +/ModDate (D:20200408100040+02'00') /Trapped /False /PTEX.Fullbanner (This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) kpathsea version 6.3.0) >> @@ -28947,7 +28947,7 @@ endobj /W [1 3 1] /Root 2050 0 R /Info 2051 0 R -/ID [<4A6A17F0317C1A73C4219CDB7A65A4CA> <4A6A17F0317C1A73C4219CDB7A65A4CA>] +/ID [<2EB8EB7CFE0690298AD950D6924620BC> <2EB8EB7CFE0690298AD950D6924620BC>] /Length 10265 >> stream @@ -28985,10 +28985,10 @@ uj     } #  !'$ %HQ+( )/, #!-30 (194 :578?: O;=>E@ cACDHRKF xGIJQL MOPXR SUVH-W]Y kZ\b^ ϕ_ac HS  !" "\H,     (# >$&'.) M*,-4/ SL023:5 Y689>; br<HT@E? dACDGLF wHJKNSM OQRYT UWX[`Z \^_a ubHU      ,! &&"%!=I#HV)&I6'+,/*MY-30XF156?=4Z79:;<H1@ABD>{CFHEGHWKIFJ[LMNPXZH\v]HOHHHHHHHH H -H H H HHHHHHHHQHTHHʝHTH){HGyHmHQHGH4H 4H!uH"~H#)H$H%JH&zH'jH(؟H)HXHYHZH[H\H]H^U{ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd  -    !"#$%&'()*+,-.// +H H H HHHHHHHHQHTHHʝHTH){HGyHmHQHGH4H 4H!uH"~H#)H$H%JH&zH'jH(؟H)HXHYHZH[H\H]H^U{ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcp  +    !"#$%&'()*+,-.// endstream endobj startxref -1302740 +1302752 %%EOF