Made test program generate symmetric matrices.

CGS2
Salvatore Filippone 7 years ago
parent ad1b6e7074
commit 64fdf563fc

@ -88,20 +88,30 @@ contains
! !
! functions parametrizing the differential equation ! 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) function b1(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero use psb_base_mod, only : psb_dpk_, done, dzero
implicit none implicit none
real(psb_dpk_) :: b1 real(psb_dpk_) :: b1
real(psb_dpk_), intent(in) :: x,y real(psb_dpk_), intent(in) :: x,y
b1=done/sqrt((2*done)) b1=dzero
end function b1 end function b1
function b2(x,y) function b2(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero use psb_base_mod, only : psb_dpk_, done, dzero
implicit none implicit none
real(psb_dpk_) :: b2 real(psb_dpk_) :: b2
real(psb_dpk_), intent(in) :: x,y real(psb_dpk_), intent(in) :: x,y
b2=done/sqrt((2*done)) b2=dzero
end function b2 end function b2
function c(x,y) function c(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero use psb_base_mod, only : psb_dpk_, done, dzero
@ -444,7 +454,7 @@ contains
if(info /= psb_success_) exit if(info /= psb_success_) exit
call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),bv,desc_a,info) call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),bv,desc_a,info)
if(info /= psb_success_) exit 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) call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),xv,desc_a,info)
if(info /= psb_success_) exit if(info /= psb_success_) exit
end do end do
@ -624,7 +634,7 @@ program psb_d_pde2d
if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
eps = 1.d-9 eps = 1.d-6
call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)

@ -90,26 +90,36 @@ contains
! !
! functions parametrizing the differential equation ! 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) function b1(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero use psb_base_mod, only : psb_dpk_, done, dzero
implicit none implicit none
real(psb_dpk_) :: b1 real(psb_dpk_) :: b1
real(psb_dpk_), intent(in) :: x,y,z real(psb_dpk_), intent(in) :: x,y,z
b1=done/sqrt((3*done)) b1=dzero
end function b1 end function b1
function b2(x,y,z) function b2(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero use psb_base_mod, only : psb_dpk_, done, dzero
implicit none implicit none
real(psb_dpk_) :: b2 real(psb_dpk_) :: b2
real(psb_dpk_), intent(in) :: x,y,z real(psb_dpk_), intent(in) :: x,y,z
b2=done/sqrt((3*done)) b2=dzero
end function b2 end function b2
function b3(x,y,z) function b3(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero use psb_base_mod, only : psb_dpk_, done, dzero
implicit none implicit none
real(psb_dpk_) :: b3 real(psb_dpk_) :: b3
real(psb_dpk_), intent(in) :: x,y,z real(psb_dpk_), intent(in) :: x,y,z
b3=done/sqrt((3*done)) b3=dzero
end function b3 end function b3
function c(x,y,z) function c(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero use psb_base_mod, only : psb_dpk_, done, dzero
@ -248,7 +258,7 @@ contains
m = idim*idim*idim m = idim*idim*idim
n = m n = m
nnz = ((n*9)/(np)) nnz = ((n*7)/(np))
if(iam == psb_root_) write(psb_out_unit,'("Generating Matrix (size=",i0,")...")')n if(iam == psb_root_) write(psb_out_unit,'("Generating Matrix (size=",i0,")...")')n
t0 = psb_wtime() t0 = psb_wtime()
select case(partition_) select case(partition_)
@ -665,7 +675,7 @@ program psb_d_pde3d
if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
eps = 1.d-9 eps = 1.d-6
call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)

@ -88,20 +88,30 @@ contains
! !
! functions parametrizing the differential equation ! 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) function b1(x,y)
use psb_base_mod, only : psb_spk_, sone, szero use psb_base_mod, only : psb_spk_, sone, szero
implicit none implicit none
real(psb_spk_) :: b1 real(psb_spk_) :: b1
real(psb_spk_), intent(in) :: x,y real(psb_spk_), intent(in) :: x,y
b1=sone/sqrt((2*sone)) b1=szero
end function b1 end function b1
function b2(x,y) function b2(x,y)
use psb_base_mod, only : psb_spk_, sone, szero use psb_base_mod, only : psb_spk_, sone, szero
implicit none implicit none
real(psb_spk_) :: b2 real(psb_spk_) :: b2
real(psb_spk_), intent(in) :: x,y real(psb_spk_), intent(in) :: x,y
b2=sone/sqrt((2*sone)) b2=szero
end function b2 end function b2
function c(x,y) function c(x,y)
use psb_base_mod, only : psb_spk_, sone, szero use psb_base_mod, only : psb_spk_, sone, szero
@ -444,7 +454,7 @@ contains
if(info /= psb_success_) exit if(info /= psb_success_) exit
call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),bv,desc_a,info) call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),bv,desc_a,info)
if(info /= psb_success_) exit 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) call psb_geins(ib,myidx(ii:ii+ib-1),zt(1:ib),xv,desc_a,info)
if(info /= psb_success_) exit if(info /= psb_success_) exit
end do end do
@ -624,7 +634,7 @@ program psb_s_pde2d
if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
eps = 1.d-9 eps = 1.d-6
call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)

@ -90,26 +90,36 @@ contains
! !
! functions parametrizing the differential equation ! 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) function b1(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero use psb_base_mod, only : psb_spk_, sone, szero
implicit none implicit none
real(psb_spk_) :: b1 real(psb_spk_) :: b1
real(psb_spk_), intent(in) :: x,y,z real(psb_spk_), intent(in) :: x,y,z
b1=sone/sqrt((3*sone)) b1=szero
end function b1 end function b1
function b2(x,y,z) function b2(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero use psb_base_mod, only : psb_spk_, sone, szero
implicit none implicit none
real(psb_spk_) :: b2 real(psb_spk_) :: b2
real(psb_spk_), intent(in) :: x,y,z real(psb_spk_), intent(in) :: x,y,z
b2=sone/sqrt((3*sone)) b2=szero
end function b2 end function b2
function b3(x,y,z) function b3(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero use psb_base_mod, only : psb_spk_, sone, szero
implicit none implicit none
real(psb_spk_) :: b3 real(psb_spk_) :: b3
real(psb_spk_), intent(in) :: x,y,z real(psb_spk_), intent(in) :: x,y,z
b3=sone/sqrt((3*sone)) b3=szero
end function b3 end function b3
function c(x,y,z) function c(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero use psb_base_mod, only : psb_spk_, sone, szero
@ -248,7 +258,7 @@ contains
m = idim*idim*idim m = idim*idim*idim
n = m n = m
nnz = ((n*9)/(np)) nnz = ((n*7)/(np))
if(iam == psb_root_) write(psb_out_unit,'("Generating Matrix (size=",i0,")...")')n if(iam == psb_root_) write(psb_out_unit,'("Generating Matrix (size=",i0,")...")')n
t0 = psb_wtime() t0 = psb_wtime()
select case(partition_) select case(partition_)
@ -665,7 +675,7 @@ program psb_s_pde3d
if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd
call psb_barrier(ictxt) call psb_barrier(ictxt)
t1 = psb_wtime() t1 = psb_wtime()
eps = 1.d-9 eps = 1.d-6
call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,& call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,&
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst) & itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)

Loading…
Cancel
Save