diff --git a/base/modules/serial/psb_c_csc_mat_mod.f90 b/base/modules/serial/psb_c_csc_mat_mod.f90 index 2bb7982c..871cb3b5 100644 --- a/base/modules/serial/psb_c_csc_mat_mod.f90 +++ b/base/modules/serial/psb_c_csc_mat_mod.f90 @@ -87,6 +87,7 @@ module psb_c_csc_mat_mod procedure, pass(a) :: mv_from_coo => psb_c_mv_csc_from_coo procedure, pass(a) :: mv_to_fmt => psb_c_mv_csc_to_fmt procedure, pass(a) :: mv_from_fmt => psb_c_mv_csc_from_fmt + procedure, pass(a) :: clean_zeros => psb_c_csc_clean_zeros procedure, pass(a) :: csput_a => psb_c_csc_csput_a procedure, pass(a) :: get_diag => psb_c_csc_get_diag procedure, pass(a) :: csgetptn => psb_c_csc_csgetptn @@ -256,6 +257,19 @@ module psb_c_csc_mat_mod end subroutine psb_c_mv_csc_from_fmt end interface + ! + !> + !! \memberof psb_c_csc_sparse_mat + !! \see psb_c_base_mat_mod::psb_c_base_clean_zeros + ! + interface + subroutine psb_c_csc_clean_zeros(a, info) + import :: psb_ipk_, psb_c_csc_sparse_mat + class(psb_c_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_c_csc_clean_zeros + end interface + !> \memberof psb_c_csc_sparse_mat !! \see psb_c_base_mat_mod::psb_c_base_cp_from interface diff --git a/base/modules/serial/psb_c_csr_mat_mod.f90 b/base/modules/serial/psb_c_csr_mat_mod.f90 index af4f3165..7452d5aa 100644 --- a/base/modules/serial/psb_c_csr_mat_mod.f90 +++ b/base/modules/serial/psb_c_csr_mat_mod.f90 @@ -90,6 +90,7 @@ module psb_c_csr_mat_mod procedure, pass(a) :: mv_from_coo => psb_c_mv_csr_from_coo procedure, pass(a) :: mv_to_fmt => psb_c_mv_csr_to_fmt procedure, pass(a) :: mv_from_fmt => psb_c_mv_csr_from_fmt + procedure, pass(a) :: clean_zeros => psb_c_csr_clean_zeros procedure, pass(a) :: csput_a => psb_c_csr_csput_a procedure, pass(a) :: get_diag => psb_c_csr_get_diag procedure, pass(a) :: csgetptn => psb_c_csr_csgetptn @@ -259,6 +260,19 @@ module psb_c_csr_mat_mod end subroutine psb_c_csr_triu end interface + ! + !> + !! \memberof psb_c_csr_sparse_mat + !! \see psb_c_base_mat_mod::psb_c_base_clean_zeros + ! + interface + subroutine psb_c_csr_clean_zeros(a, info) + import :: psb_ipk_, psb_c_csr_sparse_mat + class(psb_c_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_c_csr_clean_zeros + end interface + !> \memberof psb_c_csr_sparse_mat !! \see psb_c_base_mat_mod::psb_c_base_cp_to_coo diff --git a/base/modules/serial/psb_d_csc_mat_mod.f90 b/base/modules/serial/psb_d_csc_mat_mod.f90 index 7e4d555c..cc917ef9 100644 --- a/base/modules/serial/psb_d_csc_mat_mod.f90 +++ b/base/modules/serial/psb_d_csc_mat_mod.f90 @@ -87,6 +87,7 @@ module psb_d_csc_mat_mod procedure, pass(a) :: mv_from_coo => psb_d_mv_csc_from_coo procedure, pass(a) :: mv_to_fmt => psb_d_mv_csc_to_fmt procedure, pass(a) :: mv_from_fmt => psb_d_mv_csc_from_fmt + procedure, pass(a) :: clean_zeros => psb_d_csc_clean_zeros procedure, pass(a) :: csput_a => psb_d_csc_csput_a procedure, pass(a) :: get_diag => psb_d_csc_get_diag procedure, pass(a) :: csgetptn => psb_d_csc_csgetptn @@ -256,6 +257,19 @@ module psb_d_csc_mat_mod end subroutine psb_d_mv_csc_from_fmt end interface + ! + !> + !! \memberof psb_d_csc_sparse_mat + !! \see psb_d_base_mat_mod::psb_d_base_clean_zeros + ! + interface + subroutine psb_d_csc_clean_zeros(a, info) + import :: psb_ipk_, psb_d_csc_sparse_mat + class(psb_d_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_d_csc_clean_zeros + end interface + !> \memberof psb_d_csc_sparse_mat !! \see psb_d_base_mat_mod::psb_d_base_cp_from interface diff --git a/base/modules/serial/psb_d_csr_mat_mod.f90 b/base/modules/serial/psb_d_csr_mat_mod.f90 index 8ba73b15..ae5ddfd3 100644 --- a/base/modules/serial/psb_d_csr_mat_mod.f90 +++ b/base/modules/serial/psb_d_csr_mat_mod.f90 @@ -90,6 +90,7 @@ module psb_d_csr_mat_mod procedure, pass(a) :: mv_from_coo => psb_d_mv_csr_from_coo procedure, pass(a) :: mv_to_fmt => psb_d_mv_csr_to_fmt procedure, pass(a) :: mv_from_fmt => psb_d_mv_csr_from_fmt + procedure, pass(a) :: clean_zeros => psb_d_csr_clean_zeros procedure, pass(a) :: csput_a => psb_d_csr_csput_a procedure, pass(a) :: get_diag => psb_d_csr_get_diag procedure, pass(a) :: csgetptn => psb_d_csr_csgetptn @@ -259,6 +260,19 @@ module psb_d_csr_mat_mod end subroutine psb_d_csr_triu end interface + ! + !> + !! \memberof psb_d_csr_sparse_mat + !! \see psb_d_base_mat_mod::psb_d_base_clean_zeros + ! + interface + subroutine psb_d_csr_clean_zeros(a, info) + import :: psb_ipk_, psb_d_csr_sparse_mat + class(psb_d_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_d_csr_clean_zeros + end interface + !> \memberof psb_d_csr_sparse_mat !! \see psb_d_base_mat_mod::psb_d_base_cp_to_coo diff --git a/base/modules/serial/psb_s_csc_mat_mod.f90 b/base/modules/serial/psb_s_csc_mat_mod.f90 index 9e936153..7a636f58 100644 --- a/base/modules/serial/psb_s_csc_mat_mod.f90 +++ b/base/modules/serial/psb_s_csc_mat_mod.f90 @@ -87,6 +87,7 @@ module psb_s_csc_mat_mod procedure, pass(a) :: mv_from_coo => psb_s_mv_csc_from_coo procedure, pass(a) :: mv_to_fmt => psb_s_mv_csc_to_fmt procedure, pass(a) :: mv_from_fmt => psb_s_mv_csc_from_fmt + procedure, pass(a) :: clean_zeros => psb_s_csc_clean_zeros procedure, pass(a) :: csput_a => psb_s_csc_csput_a procedure, pass(a) :: get_diag => psb_s_csc_get_diag procedure, pass(a) :: csgetptn => psb_s_csc_csgetptn @@ -256,6 +257,19 @@ module psb_s_csc_mat_mod end subroutine psb_s_mv_csc_from_fmt end interface + ! + !> + !! \memberof psb_s_csc_sparse_mat + !! \see psb_s_base_mat_mod::psb_s_base_clean_zeros + ! + interface + subroutine psb_s_csc_clean_zeros(a, info) + import :: psb_ipk_, psb_s_csc_sparse_mat + class(psb_s_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_s_csc_clean_zeros + end interface + !> \memberof psb_s_csc_sparse_mat !! \see psb_s_base_mat_mod::psb_s_base_cp_from interface diff --git a/base/modules/serial/psb_s_csr_mat_mod.f90 b/base/modules/serial/psb_s_csr_mat_mod.f90 index 2266ff50..e48fb7c1 100644 --- a/base/modules/serial/psb_s_csr_mat_mod.f90 +++ b/base/modules/serial/psb_s_csr_mat_mod.f90 @@ -90,6 +90,7 @@ module psb_s_csr_mat_mod procedure, pass(a) :: mv_from_coo => psb_s_mv_csr_from_coo procedure, pass(a) :: mv_to_fmt => psb_s_mv_csr_to_fmt procedure, pass(a) :: mv_from_fmt => psb_s_mv_csr_from_fmt + procedure, pass(a) :: clean_zeros => psb_s_csr_clean_zeros procedure, pass(a) :: csput_a => psb_s_csr_csput_a procedure, pass(a) :: get_diag => psb_s_csr_get_diag procedure, pass(a) :: csgetptn => psb_s_csr_csgetptn @@ -259,6 +260,19 @@ module psb_s_csr_mat_mod end subroutine psb_s_csr_triu end interface + ! + !> + !! \memberof psb_s_csr_sparse_mat + !! \see psb_s_base_mat_mod::psb_s_base_clean_zeros + ! + interface + subroutine psb_s_csr_clean_zeros(a, info) + import :: psb_ipk_, psb_s_csr_sparse_mat + class(psb_s_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_s_csr_clean_zeros + end interface + !> \memberof psb_s_csr_sparse_mat !! \see psb_s_base_mat_mod::psb_s_base_cp_to_coo diff --git a/base/modules/serial/psb_z_csc_mat_mod.f90 b/base/modules/serial/psb_z_csc_mat_mod.f90 index 4c7e050d..bbc3c456 100644 --- a/base/modules/serial/psb_z_csc_mat_mod.f90 +++ b/base/modules/serial/psb_z_csc_mat_mod.f90 @@ -87,6 +87,7 @@ module psb_z_csc_mat_mod procedure, pass(a) :: mv_from_coo => psb_z_mv_csc_from_coo procedure, pass(a) :: mv_to_fmt => psb_z_mv_csc_to_fmt procedure, pass(a) :: mv_from_fmt => psb_z_mv_csc_from_fmt + procedure, pass(a) :: clean_zeros => psb_z_csc_clean_zeros procedure, pass(a) :: csput_a => psb_z_csc_csput_a procedure, pass(a) :: get_diag => psb_z_csc_get_diag procedure, pass(a) :: csgetptn => psb_z_csc_csgetptn @@ -256,6 +257,19 @@ module psb_z_csc_mat_mod end subroutine psb_z_mv_csc_from_fmt end interface + ! + !> + !! \memberof psb_z_csc_sparse_mat + !! \see psb_z_base_mat_mod::psb_z_base_clean_zeros + ! + interface + subroutine psb_z_csc_clean_zeros(a, info) + import :: psb_ipk_, psb_z_csc_sparse_mat + class(psb_z_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_z_csc_clean_zeros + end interface + !> \memberof psb_z_csc_sparse_mat !! \see psb_z_base_mat_mod::psb_z_base_cp_from interface diff --git a/base/modules/serial/psb_z_csr_mat_mod.f90 b/base/modules/serial/psb_z_csr_mat_mod.f90 index 7dc58c04..8312d960 100644 --- a/base/modules/serial/psb_z_csr_mat_mod.f90 +++ b/base/modules/serial/psb_z_csr_mat_mod.f90 @@ -90,6 +90,7 @@ module psb_z_csr_mat_mod procedure, pass(a) :: mv_from_coo => psb_z_mv_csr_from_coo procedure, pass(a) :: mv_to_fmt => psb_z_mv_csr_to_fmt procedure, pass(a) :: mv_from_fmt => psb_z_mv_csr_from_fmt + procedure, pass(a) :: clean_zeros => psb_z_csr_clean_zeros procedure, pass(a) :: csput_a => psb_z_csr_csput_a procedure, pass(a) :: get_diag => psb_z_csr_get_diag procedure, pass(a) :: csgetptn => psb_z_csr_csgetptn @@ -259,6 +260,19 @@ module psb_z_csr_mat_mod end subroutine psb_z_csr_triu end interface + ! + !> + !! \memberof psb_z_csr_sparse_mat + !! \see psb_z_base_mat_mod::psb_z_base_clean_zeros + ! + interface + subroutine psb_z_csr_clean_zeros(a, info) + import :: psb_ipk_, psb_z_csr_sparse_mat + class(psb_z_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + end subroutine psb_z_csr_clean_zeros + end interface + !> \memberof psb_z_csr_sparse_mat !! \see psb_z_base_mat_mod::psb_z_base_cp_to_coo diff --git a/base/serial/impl/psb_c_csc_impl.f90 b/base/serial/impl/psb_c_csc_impl.f90 index 4e76fe2b..23e8f4a8 100644 --- a/base/serial/impl/psb_c_csc_impl.f90 +++ b/base/serial/impl/psb_c_csc_impl.f90 @@ -2489,6 +2489,37 @@ subroutine psb_c_cp_csc_from_fmt(a,b,info) end subroutine psb_c_cp_csc_from_fmt +subroutine psb_c_csc_clean_zeros(a, info) + use psb_error_mod + use psb_c_csc_mat_mod, psb_protect_name => psb_c_csc_clean_zeros + implicit none + class(psb_c_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nc + integer(psb_ipk_), allocatable :: ilcp(:) + + info = 0 + call a%sync() + nc = a%get_ncols() + ilcp = a%icp(:) + a%icp(1) = 1 + j = a%icp(1) + do i=1, nc + do k = ilcp(i), ilcp(i+1) -1 + if (a%val(k) /= czero) then + a%val(j) = a%val(k) + a%ia(j) = a%ia(k) + j = j + 1 + end if + end do + a%icp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_c_csc_clean_zeros + + subroutine psb_c_csc_mold(a,b,info) use psb_c_csc_mat_mod, psb_protect_name => psb_c_csc_mold use psb_error_mod diff --git a/base/serial/impl/psb_c_csr_impl.f90 b/base/serial/impl/psb_c_csr_impl.f90 index bb0d5309..a4296c3e 100644 --- a/base/serial/impl/psb_c_csr_impl.f90 +++ b/base/serial/impl/psb_c_csr_impl.f90 @@ -1304,7 +1304,7 @@ function psb_c_csr_csnmi(a) result(res) if (a%is_dev()) call a%sync() do i = 1, a%get_nrows() - acc = dzero + acc = szero do j=a%irp(i),a%irp(i+1)-1 acc = acc + abs(a%val(j)) end do @@ -3321,6 +3321,36 @@ subroutine psb_c_cp_csr_from_fmt(a,b,info) end select end subroutine psb_c_cp_csr_from_fmt +subroutine psb_c_csr_clean_zeros(a, info) + use psb_error_mod + use psb_c_csr_mat_mod, psb_protect_name => psb_c_csr_clean_zeros + implicit none + class(psb_c_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nr + integer(psb_ipk_), allocatable :: ilrp(:) + + info = 0 + call a%sync() + nr = a%get_nrows() + ilrp = a%irp(:) + a%irp(1) = 1 + j = a%irp(1) + do i=1, nr + do k = ilrp(i), ilrp(i+1) -1 + if (a%val(k) /= czero) then + a%val(j) = a%val(k) + a%ja(j) = a%ja(k) + j = j + 1 + end if + end do + a%irp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_c_csr_clean_zeros + subroutine psb_ccsrspspmm(a,b,c,info) use psb_c_mat_mod use psb_serial_mod, psb_protect_name => psb_ccsrspspmm diff --git a/base/serial/impl/psb_d_csc_impl.f90 b/base/serial/impl/psb_d_csc_impl.f90 index 4b46bc9a..ef68164d 100644 --- a/base/serial/impl/psb_d_csc_impl.f90 +++ b/base/serial/impl/psb_d_csc_impl.f90 @@ -2489,6 +2489,37 @@ subroutine psb_d_cp_csc_from_fmt(a,b,info) end subroutine psb_d_cp_csc_from_fmt +subroutine psb_d_csc_clean_zeros(a, info) + use psb_error_mod + use psb_d_csc_mat_mod, psb_protect_name => psb_d_csc_clean_zeros + implicit none + class(psb_d_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nc + integer(psb_ipk_), allocatable :: ilcp(:) + + info = 0 + call a%sync() + nc = a%get_ncols() + ilcp = a%icp(:) + a%icp(1) = 1 + j = a%icp(1) + do i=1, nc + do k = ilcp(i), ilcp(i+1) -1 + if (a%val(k) /= dzero) then + a%val(j) = a%val(k) + a%ia(j) = a%ia(k) + j = j + 1 + end if + end do + a%icp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_d_csc_clean_zeros + + subroutine psb_d_csc_mold(a,b,info) use psb_d_csc_mat_mod, psb_protect_name => psb_d_csc_mold use psb_error_mod diff --git a/base/serial/impl/psb_d_csr_impl.f90 b/base/serial/impl/psb_d_csr_impl.f90 index 868f0fe6..c0f7cfcb 100644 --- a/base/serial/impl/psb_d_csr_impl.f90 +++ b/base/serial/impl/psb_d_csr_impl.f90 @@ -3321,6 +3321,36 @@ subroutine psb_d_cp_csr_from_fmt(a,b,info) end select end subroutine psb_d_cp_csr_from_fmt +subroutine psb_d_csr_clean_zeros(a, info) + use psb_error_mod + use psb_d_csr_mat_mod, psb_protect_name => psb_d_csr_clean_zeros + implicit none + class(psb_d_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nr + integer(psb_ipk_), allocatable :: ilrp(:) + + info = 0 + call a%sync() + nr = a%get_nrows() + ilrp = a%irp(:) + a%irp(1) = 1 + j = a%irp(1) + do i=1, nr + do k = ilrp(i), ilrp(i+1) -1 + if (a%val(k) /= dzero) then + a%val(j) = a%val(k) + a%ja(j) = a%ja(k) + j = j + 1 + end if + end do + a%irp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_d_csr_clean_zeros + subroutine psb_dcsrspspmm(a,b,c,info) use psb_d_mat_mod use psb_serial_mod, psb_protect_name => psb_dcsrspspmm diff --git a/base/serial/impl/psb_s_csc_impl.f90 b/base/serial/impl/psb_s_csc_impl.f90 index bf3fa900..6318db9d 100644 --- a/base/serial/impl/psb_s_csc_impl.f90 +++ b/base/serial/impl/psb_s_csc_impl.f90 @@ -2489,6 +2489,37 @@ subroutine psb_s_cp_csc_from_fmt(a,b,info) end subroutine psb_s_cp_csc_from_fmt +subroutine psb_s_csc_clean_zeros(a, info) + use psb_error_mod + use psb_s_csc_mat_mod, psb_protect_name => psb_s_csc_clean_zeros + implicit none + class(psb_s_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nc + integer(psb_ipk_), allocatable :: ilcp(:) + + info = 0 + call a%sync() + nc = a%get_ncols() + ilcp = a%icp(:) + a%icp(1) = 1 + j = a%icp(1) + do i=1, nc + do k = ilcp(i), ilcp(i+1) -1 + if (a%val(k) /= szero) then + a%val(j) = a%val(k) + a%ia(j) = a%ia(k) + j = j + 1 + end if + end do + a%icp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_s_csc_clean_zeros + + subroutine psb_s_csc_mold(a,b,info) use psb_s_csc_mat_mod, psb_protect_name => psb_s_csc_mold use psb_error_mod diff --git a/base/serial/impl/psb_s_csr_impl.f90 b/base/serial/impl/psb_s_csr_impl.f90 index 9a537360..ceb21bf3 100644 --- a/base/serial/impl/psb_s_csr_impl.f90 +++ b/base/serial/impl/psb_s_csr_impl.f90 @@ -1304,7 +1304,7 @@ function psb_s_csr_csnmi(a) result(res) if (a%is_dev()) call a%sync() do i = 1, a%get_nrows() - acc = dzero + acc = szero do j=a%irp(i),a%irp(i+1)-1 acc = acc + abs(a%val(j)) end do @@ -3321,6 +3321,36 @@ subroutine psb_s_cp_csr_from_fmt(a,b,info) end select end subroutine psb_s_cp_csr_from_fmt +subroutine psb_s_csr_clean_zeros(a, info) + use psb_error_mod + use psb_s_csr_mat_mod, psb_protect_name => psb_s_csr_clean_zeros + implicit none + class(psb_s_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nr + integer(psb_ipk_), allocatable :: ilrp(:) + + info = 0 + call a%sync() + nr = a%get_nrows() + ilrp = a%irp(:) + a%irp(1) = 1 + j = a%irp(1) + do i=1, nr + do k = ilrp(i), ilrp(i+1) -1 + if (a%val(k) /= szero) then + a%val(j) = a%val(k) + a%ja(j) = a%ja(k) + j = j + 1 + end if + end do + a%irp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_s_csr_clean_zeros + subroutine psb_scsrspspmm(a,b,c,info) use psb_s_mat_mod use psb_serial_mod, psb_protect_name => psb_scsrspspmm diff --git a/base/serial/impl/psb_z_csc_impl.f90 b/base/serial/impl/psb_z_csc_impl.f90 index 1abf68d3..bd14f8a3 100644 --- a/base/serial/impl/psb_z_csc_impl.f90 +++ b/base/serial/impl/psb_z_csc_impl.f90 @@ -2489,6 +2489,37 @@ subroutine psb_z_cp_csc_from_fmt(a,b,info) end subroutine psb_z_cp_csc_from_fmt +subroutine psb_z_csc_clean_zeros(a, info) + use psb_error_mod + use psb_z_csc_mat_mod, psb_protect_name => psb_z_csc_clean_zeros + implicit none + class(psb_z_csc_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nc + integer(psb_ipk_), allocatable :: ilcp(:) + + info = 0 + call a%sync() + nc = a%get_ncols() + ilcp = a%icp(:) + a%icp(1) = 1 + j = a%icp(1) + do i=1, nc + do k = ilcp(i), ilcp(i+1) -1 + if (a%val(k) /= zzero) then + a%val(j) = a%val(k) + a%ia(j) = a%ia(k) + j = j + 1 + end if + end do + a%icp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_z_csc_clean_zeros + + subroutine psb_z_csc_mold(a,b,info) use psb_z_csc_mat_mod, psb_protect_name => psb_z_csc_mold use psb_error_mod diff --git a/base/serial/impl/psb_z_csr_impl.f90 b/base/serial/impl/psb_z_csr_impl.f90 index 502b7c5b..f86b0872 100644 --- a/base/serial/impl/psb_z_csr_impl.f90 +++ b/base/serial/impl/psb_z_csr_impl.f90 @@ -3321,6 +3321,36 @@ subroutine psb_z_cp_csr_from_fmt(a,b,info) end select end subroutine psb_z_cp_csr_from_fmt +subroutine psb_z_csr_clean_zeros(a, info) + use psb_error_mod + use psb_z_csr_mat_mod, psb_protect_name => psb_z_csr_clean_zeros + implicit none + class(psb_z_csr_sparse_mat), intent(inout) :: a + integer(psb_ipk_) :: info + ! + integer(psb_ipk_) :: i, j, k, nr + integer(psb_ipk_), allocatable :: ilrp(:) + + info = 0 + call a%sync() + nr = a%get_nrows() + ilrp = a%irp(:) + a%irp(1) = 1 + j = a%irp(1) + do i=1, nr + do k = ilrp(i), ilrp(i+1) -1 + if (a%val(k) /= zzero) then + a%val(j) = a%val(k) + a%ja(j) = a%ja(k) + j = j + 1 + end if + end do + a%irp(i+1) = j + end do + call a%trim() + call a%set_host() +end subroutine psb_z_csr_clean_zeros + subroutine psb_zcsrspspmm(a,b,c,info) use psb_z_mat_mod use psb_serial_mod, psb_protect_name => psb_zcsrspspmm diff --git a/base/tools/psb_cd_renum_block.F90 b/base/tools/psb_cd_renum_block.F90 index 5fe559be..6f273369 100644 --- a/base/tools/psb_cd_renum_block.F90 +++ b/base/tools/psb_cd_renum_block.F90 @@ -31,7 +31,8 @@ ! ! ! Subroutine: psb_cd_renum_block -! Produces a clone of a descriptor. +! Produces a renumbered version of the input descriptor, with +! global indices in a BLOCK distribution. ! ! Arguments: ! desc_in - type(psb_desc_type). The communication descriptor to be cloned. @@ -120,9 +121,23 @@ subroutine psb_cd_renum_block(desc_in, desc_out, info) reflidx(1:n_col) = [(i,i=1,n_col)] gidx(1:n_row) = reflidx(1:n_row) + vnl(me) call psb_halo(gidx,desc_in,info) - if (info == 0) call blck_map%gen_block_map_init(ictxt,vnl(me),info) + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),': Done halo on gidx ',info + + if (info == 0) call blck_map%gen_block_map_init(ictxt,n_row,info) + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),': Done gen_block_map_init ',info,& + & blck_map%get_lr(),blck_map%get_lc(),vnl(me) + if (info == 0) call blck_map%g2l_ins(gidx,lidx,info,lidx=reflidx) + if (debug_level >= psb_debug_ext_) then + write(debug_unit,*) me,' ',trim(name),': Done g2l_ins ',info,size(gidx),size(lidx),size(reflidx) + write(debug_unit,*) me,' ',trim(name),': Done g2l_ins ',gidx(:),':',lidx(:),' :',reflidx(:) + end if + if (info == 0) call blck_map%asb(info) + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),': Done asb ',info if (info /= psb_success_) then info = psb_err_from_subroutine_ diff --git a/base/tools/psb_csphalo.F90 b/base/tools/psb_csphalo.F90 index 28cfe2e5..394c8a52 100644 --- a/base/tools/psb_csphalo.F90 +++ b/base/tools/psb_csphalo.F90 @@ -280,7 +280,7 @@ Subroutine psb_csphalo(a,desc_a,blk,info,rowcnv,colcnv,& call psb_errpush(info,name,a_err='psb_sp_getrow') goto 9999 end if - tot_elem=tot_elem+n_elem + tot_elem=tot_elem+ngtz Enddo ipx = ipx + 1 counter = counter+n_el_send+3 @@ -317,7 +317,7 @@ Subroutine psb_csphalo(a,desc_a,blk,info,rowcnv,colcnv,& #elif defined(SP_A2AV_MAT) call c_coo_my_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ipdxv,ictxt,icomm,info) -#elif +#else choke on me @! #endif if (info /= psb_success_) then diff --git a/base/tools/psb_dsphalo.F90 b/base/tools/psb_dsphalo.F90 index b35acd42..8ef8e3f5 100644 --- a/base/tools/psb_dsphalo.F90 +++ b/base/tools/psb_dsphalo.F90 @@ -280,7 +280,7 @@ Subroutine psb_dsphalo(a,desc_a,blk,info,rowcnv,colcnv,& call psb_errpush(info,name,a_err='psb_sp_getrow') goto 9999 end if - tot_elem=tot_elem+n_elem + tot_elem=tot_elem+ngtz Enddo ipx = ipx + 1 counter = counter+n_el_send+3 @@ -317,7 +317,7 @@ Subroutine psb_dsphalo(a,desc_a,blk,info,rowcnv,colcnv,& #elif defined(SP_A2AV_MAT) call d_coo_my_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ipdxv,ictxt,icomm,info) -#elif +#else choke on me @! #endif if (info /= psb_success_) then diff --git a/base/tools/psb_ssphalo.F90 b/base/tools/psb_ssphalo.F90 index 3714bdcb..c8945d41 100644 --- a/base/tools/psb_ssphalo.F90 +++ b/base/tools/psb_ssphalo.F90 @@ -280,7 +280,7 @@ Subroutine psb_ssphalo(a,desc_a,blk,info,rowcnv,colcnv,& call psb_errpush(info,name,a_err='psb_sp_getrow') goto 9999 end if - tot_elem=tot_elem+n_elem + tot_elem=tot_elem+ngtz Enddo ipx = ipx + 1 counter = counter+n_el_send+3 @@ -317,7 +317,7 @@ Subroutine psb_ssphalo(a,desc_a,blk,info,rowcnv,colcnv,& #elif defined(SP_A2AV_MAT) call s_coo_my_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ipdxv,ictxt,icomm,info) -#elif +#else choke on me @! #endif if (info /= psb_success_) then diff --git a/base/tools/psb_zsphalo.F90 b/base/tools/psb_zsphalo.F90 index b70d25a5..4f88ca5e 100644 --- a/base/tools/psb_zsphalo.F90 +++ b/base/tools/psb_zsphalo.F90 @@ -280,7 +280,7 @@ Subroutine psb_zsphalo(a,desc_a,blk,info,rowcnv,colcnv,& call psb_errpush(info,name,a_err='psb_sp_getrow') goto 9999 end if - tot_elem=tot_elem+n_elem + tot_elem=tot_elem+ngtz Enddo ipx = ipx + 1 counter = counter+n_el_send+3 @@ -317,7 +317,7 @@ Subroutine psb_zsphalo(a,desc_a,blk,info,rowcnv,colcnv,& #elif defined(SP_A2AV_MAT) call z_coo_my_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ipdxv,ictxt,icomm,info) -#elif +#else choke on me @! #endif if (info /= psb_success_) then diff --git a/docs/html/node134.html b/docs/html/node134.html new file mode 100644 index 00000000..fa6197a5 --- /dev/null +++ b/docs/html/node134.html @@ -0,0 +1,180 @@ + + + + +
++
+
+
http://www.cs.umn.edu/~karypis
.
++
+
+
+This document was generated using the +LaTeX2HTML translator Version 2018 (Released Feb 1, 2018) +
+Copyright © 1993, 1994, 1995, 1996,
+Nikos Drakos,
+Computer Based Learning Unit, University of Leeds.
+
+Copyright © 1997, 1998, 1999,
+Ross Moore,
+Mathematics Department, Macquarie University, Sydney.
+
+The command line arguments were:
+ latex2html -local_icons -noaddress -dir ../../html userhtml.tex
+
+The translation was initiated on 2019-01-07
+