From 64fdf563fcbedbe232528f33a4e1acd421f552dd Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Mon, 14 May 2018 12:10:34 +0100 Subject: [PATCH] Made test program generate symmetric matrices. --- test/pargen/psb_d_pde2d.f90 | 20 +++++++++++++++----- test/pargen/psb_d_pde3d.f90 | 20 +++++++++++++++----- test/pargen/psb_s_pde2d.f90 | 20 +++++++++++++++----- test/pargen/psb_s_pde3d.f90 | 20 +++++++++++++++----- 4 files changed, 60 insertions(+), 20 deletions(-) diff --git a/test/pargen/psb_d_pde2d.f90 b/test/pargen/psb_d_pde2d.f90 index 6dc725f8..955de6ef 100644 --- a/test/pargen/psb_d_pde2d.f90 +++ b/test/pargen/psb_d_pde2d.f90 @@ -88,20 +88,30 @@ contains ! ! functions parametrizing the differential equation - ! + ! + + ! + ! Note: b1 and b2 are the coefficients of the first + ! derivative of the unknown function. The default + ! we apply here is to have them zero, so that the resulting + ! matrix is symmetric/hermitian and suitable for + ! testing with CG and FCG. + ! When testing methods for non-hermitian matrices you can + ! change the B1/B2 functions to e.g. done/sqrt((2*done)) + ! function b1(x,y) use psb_base_mod, only : psb_dpk_, done, dzero implicit none real(psb_dpk_) :: b1 real(psb_dpk_), intent(in) :: x,y - b1=done/sqrt((2*done)) + b1=dzero end function b1 function b2(x,y) use psb_base_mod, only : psb_dpk_, done, dzero implicit none real(psb_dpk_) :: b2 real(psb_dpk_), intent(in) :: x,y - b2=done/sqrt((2*done)) + b2=dzero end function b2 function c(x,y) use psb_base_mod, only : psb_dpk_, done, dzero @@ -444,7 +454,7 @@ contains if(info /= psb_success_) exit call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),bv,desc_a,info) if(info /= psb_success_) exit - zt(:)=0.d0 + zt(:)=dzero call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),xv,desc_a,info) if(info /= psb_success_) exit end do @@ -624,7 +634,7 @@ program psb_d_pde2d if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd call psb_barrier(ictxt) t1 = psb_wtime() - eps = 1.d-9 + eps = 1.d-6 call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) diff --git a/test/pargen/psb_d_pde3d.f90 b/test/pargen/psb_d_pde3d.f90 index 4eb18893..f3c165d1 100644 --- a/test/pargen/psb_d_pde3d.f90 +++ b/test/pargen/psb_d_pde3d.f90 @@ -90,26 +90,36 @@ contains ! ! functions parametrizing the differential equation ! + + ! + ! Note: b1, b2 and b3 are the coefficients of the first + ! derivative of the unknown function. The default + ! we apply here is to have them zero, so that the resulting + ! matrix is symmetric/hermitian and suitable for + ! testing with CG and FCG. + ! When testing methods for non-hermitian matrices you can + ! change the B1/B2/B3 functions to e.g. done/sqrt((3*done)) + ! function b1(x,y,z) use psb_base_mod, only : psb_dpk_, done, dzero implicit none real(psb_dpk_) :: b1 real(psb_dpk_), intent(in) :: x,y,z - b1=done/sqrt((3*done)) + b1=dzero end function b1 function b2(x,y,z) use psb_base_mod, only : psb_dpk_, done, dzero implicit none real(psb_dpk_) :: b2 real(psb_dpk_), intent(in) :: x,y,z - b2=done/sqrt((3*done)) + b2=dzero end function b2 function b3(x,y,z) use psb_base_mod, only : psb_dpk_, done, dzero implicit none real(psb_dpk_) :: b3 real(psb_dpk_), intent(in) :: x,y,z - b3=done/sqrt((3*done)) + b3=dzero end function b3 function c(x,y,z) use psb_base_mod, only : psb_dpk_, done, dzero @@ -248,7 +258,7 @@ contains m = idim*idim*idim n = m - nnz = ((n*9)/(np)) + nnz = ((n*7)/(np)) if(iam == psb_root_) write(psb_out_unit,'("Generating Matrix (size=",i0,")...")')n t0 = psb_wtime() select case(partition_) @@ -665,7 +675,7 @@ program psb_d_pde3d if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd call psb_barrier(ictxt) t1 = psb_wtime() - eps = 1.d-9 + eps = 1.d-6 call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) diff --git a/test/pargen/psb_s_pde2d.f90 b/test/pargen/psb_s_pde2d.f90 index 58e11402..f4a80d0c 100644 --- a/test/pargen/psb_s_pde2d.f90 +++ b/test/pargen/psb_s_pde2d.f90 @@ -88,20 +88,30 @@ contains ! ! functions parametrizing the differential equation - ! + ! + + ! + ! Note: b1 and b2 are the coefficients of the first + ! derivative of the unknown function. The default + ! we apply here is to have them zero, so that the resulting + ! matrix is symmetric/hermitian and suitable for + ! testing with CG and FCG. + ! When testing methods for non-hermitian matrices you can + ! change the B1/B2 functions to e.g. sone/sqrt((2*sone)) + ! function b1(x,y) use psb_base_mod, only : psb_spk_, sone, szero implicit none real(psb_spk_) :: b1 real(psb_spk_), intent(in) :: x,y - b1=sone/sqrt((2*sone)) + b1=szero end function b1 function b2(x,y) use psb_base_mod, only : psb_spk_, sone, szero implicit none real(psb_spk_) :: b2 real(psb_spk_), intent(in) :: x,y - b2=sone/sqrt((2*sone)) + b2=szero end function b2 function c(x,y) use psb_base_mod, only : psb_spk_, sone, szero @@ -444,7 +454,7 @@ contains if(info /= psb_success_) exit call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),bv,desc_a,info) if(info /= psb_success_) exit - zt(:)=0.d0 + zt(:)=szero call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),xv,desc_a,info) if(info /= psb_success_) exit end do @@ -624,7 +634,7 @@ program psb_s_pde2d if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd call psb_barrier(ictxt) t1 = psb_wtime() - eps = 1.d-9 + eps = 1.d-6 call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) diff --git a/test/pargen/psb_s_pde3d.f90 b/test/pargen/psb_s_pde3d.f90 index 3287ef69..0ca70230 100644 --- a/test/pargen/psb_s_pde3d.f90 +++ b/test/pargen/psb_s_pde3d.f90 @@ -90,26 +90,36 @@ contains ! ! functions parametrizing the differential equation ! + + ! + ! Note: b1, b2 and b3 are the coefficients of the first + ! derivative of the unknown function. The default + ! we apply here is to have them zero, so that the resulting + ! matrix is symmetric/hermitian and suitable for + ! testing with CG and FCG. + ! When testing methods for non-hermitian matrices you can + ! change the B1/B2/B3 functions to e.g. sone/sqrt((3*sone)) + ! function b1(x,y,z) use psb_base_mod, only : psb_spk_, sone, szero implicit none real(psb_spk_) :: b1 real(psb_spk_), intent(in) :: x,y,z - b1=sone/sqrt((3*sone)) + b1=szero end function b1 function b2(x,y,z) use psb_base_mod, only : psb_spk_, sone, szero implicit none real(psb_spk_) :: b2 real(psb_spk_), intent(in) :: x,y,z - b2=sone/sqrt((3*sone)) + b2=szero end function b2 function b3(x,y,z) use psb_base_mod, only : psb_spk_, sone, szero implicit none real(psb_spk_) :: b3 real(psb_spk_), intent(in) :: x,y,z - b3=sone/sqrt((3*sone)) + b3=szero end function b3 function c(x,y,z) use psb_base_mod, only : psb_spk_, sone, szero @@ -248,7 +258,7 @@ contains m = idim*idim*idim n = m - nnz = ((n*9)/(np)) + nnz = ((n*7)/(np)) if(iam == psb_root_) write(psb_out_unit,'("Generating Matrix (size=",i0,")...")')n t0 = psb_wtime() select case(partition_) @@ -665,7 +675,7 @@ program psb_s_pde3d if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd call psb_barrier(ictxt) t1 = psb_wtime() - eps = 1.d-9 + eps = 1.d-6 call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)