From adc5aebd6b4e9d20345d43eac920e0f3f51a8c24 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Wed, 27 May 2020 10:50:06 +0200 Subject: [PATCH] In L1-GS only add nonzero D1 entries. --- mlprec/impl/solver/mld_c_bwgs_solver_bld.f90 | 22 +++++++++++++------- mlprec/impl/solver/mld_c_gs_solver_bld.f90 | 22 +++++++++++++------- mlprec/impl/solver/mld_d_bwgs_solver_bld.f90 | 22 +++++++++++++------- mlprec/impl/solver/mld_d_gs_solver_bld.f90 | 22 +++++++++++++------- mlprec/impl/solver/mld_s_bwgs_solver_bld.f90 | 22 +++++++++++++------- mlprec/impl/solver/mld_s_gs_solver_bld.f90 | 22 +++++++++++++------- mlprec/impl/solver/mld_z_bwgs_solver_bld.f90 | 22 +++++++++++++------- mlprec/impl/solver/mld_z_gs_solver_bld.f90 | 22 +++++++++++++------- 8 files changed, 112 insertions(+), 64 deletions(-) diff --git a/mlprec/impl/solver/mld_c_bwgs_solver_bld.f90 b/mlprec/impl/solver/mld_c_bwgs_solver_bld.f90 index 9e5427b1..6e95e810 100644 --- a/mlprec/impl/solver/mld_c_bwgs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_c_bwgs_solver_bld.f90 @@ -95,11 +95,14 @@ subroutine mld_c_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -109,11 +112,14 @@ subroutine mld_c_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block diff --git a/mlprec/impl/solver/mld_c_gs_solver_bld.f90 b/mlprec/impl/solver/mld_c_gs_solver_bld.f90 index babca9be..44ef6238 100644 --- a/mlprec/impl/solver/mld_c_gs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_c_gs_solver_bld.f90 @@ -93,11 +93,14 @@ subroutine mld_c_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -107,11 +110,14 @@ subroutine mld_c_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block diff --git a/mlprec/impl/solver/mld_d_bwgs_solver_bld.f90 b/mlprec/impl/solver/mld_d_bwgs_solver_bld.f90 index 3001c937..be169157 100644 --- a/mlprec/impl/solver/mld_d_bwgs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_d_bwgs_solver_bld.f90 @@ -95,11 +95,14 @@ subroutine mld_d_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -109,11 +112,14 @@ subroutine mld_d_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block diff --git a/mlprec/impl/solver/mld_d_gs_solver_bld.f90 b/mlprec/impl/solver/mld_d_gs_solver_bld.f90 index 510e33ae..86863a78 100644 --- a/mlprec/impl/solver/mld_d_gs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_d_gs_solver_bld.f90 @@ -93,11 +93,14 @@ subroutine mld_d_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -107,11 +110,14 @@ subroutine mld_d_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block diff --git a/mlprec/impl/solver/mld_s_bwgs_solver_bld.f90 b/mlprec/impl/solver/mld_s_bwgs_solver_bld.f90 index cf68ac5b..2da1aadc 100644 --- a/mlprec/impl/solver/mld_s_bwgs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_s_bwgs_solver_bld.f90 @@ -95,11 +95,14 @@ subroutine mld_s_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -109,11 +112,14 @@ subroutine mld_s_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block diff --git a/mlprec/impl/solver/mld_s_gs_solver_bld.f90 b/mlprec/impl/solver/mld_s_gs_solver_bld.f90 index 086136b1..476dd245 100644 --- a/mlprec/impl/solver/mld_s_gs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_s_gs_solver_bld.f90 @@ -93,11 +93,14 @@ subroutine mld_s_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -107,11 +110,14 @@ subroutine mld_s_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= szero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block diff --git a/mlprec/impl/solver/mld_z_bwgs_solver_bld.f90 b/mlprec/impl/solver/mld_z_bwgs_solver_bld.f90 index 7e58bb27..f763219d 100644 --- a/mlprec/impl/solver/mld_z_bwgs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_z_bwgs_solver_bld.f90 @@ -95,11 +95,14 @@ subroutine mld_z_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -109,11 +112,14 @@ subroutine mld_z_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block diff --git a/mlprec/impl/solver/mld_z_gs_solver_bld.f90 b/mlprec/impl/solver/mld_z_gs_solver_bld.f90 index 5403ac44..ed249b38 100644 --- a/mlprec/impl/solver/mld_z_gs_solver_bld.f90 +++ b/mlprec/impl/solver/mld_z_gs_solver_bld.f90 @@ -93,11 +93,14 @@ subroutine mld_z_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%l%mv_from(tcoo) @@ -107,11 +110,14 @@ subroutine mld_z_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) call tcoo%ensure_size(nz+nrm) call tcoo%set_dupl(psb_dupl_add_) do k=1,nrm - tcoo%ia(nz+k) = k - tcoo%ja(nz+k) = k - tcoo%val(nz+k) = -sv%xtra(k) + if (sv%xtra(k) /= dzero) then + nz = nz + 1 + tcoo%ia(nz) = k + tcoo%ja(nz) = k + tcoo%val(nz) = -sv%xtra(k) + end if end do - call tcoo%set_nzeros(nz+nrm) + call tcoo%set_nzeros(nz) call tcoo%fix(info) call sv%u%mv_from(tcoo) end block