Changed handling of duplicates and storage format. Changed interface

to both geins and spasb. New and better strategies.
psblas3-type-indexed
Salvatore Filippone 19 years ago
parent 77106751a4
commit 4b2f930cf6

@ -80,28 +80,31 @@
! !
! Queries into spmat%info ! Queries into spmat%info
! !
integer, parameter :: psb_root_=0
integer, parameter :: psb_nztotreq_=1, psb_nzrowreq_=2 integer, parameter :: psb_nztotreq_=1, psb_nzrowreq_=2
integer, parameter :: psb_nzsizereq_=3 integer, parameter :: psb_nzsizereq_=3
! !
! Entries and values for spmat%info ! Entries and values for spmat%info
! !
integer, parameter :: psb_nnz_=1, psb_dupl_=5 integer, parameter :: psb_nnz_=1
integer, parameter :: psb_del_bnd_=6, psb_srtd_=7 integer, parameter :: psb_del_bnd_=7, psb_srtd_=8
integer, parameter :: psb_state_=8, psb_upd_=9 integer, parameter :: psb_state_=9
integer, parameter :: psb_upd_pnt_=10, psb_ifasize_=10 integer, parameter :: psb_upd_pnt_=10
integer, parameter :: psb_dupl_=11, psb_upd_=12
integer, parameter :: psb_ifasize_=16
integer, parameter :: psb_spmat_null_=0, psb_spmat_bld_=1 integer, parameter :: psb_spmat_null_=0, psb_spmat_bld_=1
integer, parameter :: psb_spmat_asb_=2, psb_spmat_upd_=4 integer, parameter :: psb_spmat_asb_=2, psb_spmat_upd_=4
integer, parameter :: psb_ireg_flgs_=10, psb_ip2_=0 integer, parameter :: psb_ireg_flgs_=10, psb_ip2_=0
integer, parameter :: psb_iflag_=2, psb_ichk_=3 integer, parameter :: psb_iflag_=2, psb_ichk_=3
integer, parameter :: psb_nnzt_=4, psb_zero_=5,psb_ipc_=6 integer, parameter :: psb_nnzt_=4, psb_zero_=5,psb_ipc_=6
integer, parameter :: psb_dupl_err_ =1 integer, parameter :: psb_dupl_ovwrt_ = 0
integer, parameter :: psb_dupl_ovwrt_=2 integer, parameter :: psb_dupl_add_ = 1
integer, parameter :: psb_dupl_add_ =3 integer, parameter :: psb_dupl_err_ = 2
integer, parameter :: psb_perm_update_=98765 integer, parameter :: psb_dupl_def_ = psb_dupl_ovwrt_
integer, parameter :: psb_srch_update_=98764 integer, parameter :: psb_upd_dflt_ = 0
integer, parameter :: psb_isrtdcoo_ =98761 integer, parameter :: psb_upd_perm_ = 98765
integer, parameter :: psb_upd_srch_ = 98764
integer, parameter :: psb_isrtdcoo_ = 98761
integer, parameter :: psb_maxjdrows_=8, psb_minjdrows_=4 integer, parameter :: psb_maxjdrows_=8, psb_minjdrows_=4
integer, parameter :: psb_dbleint_=2 integer, parameter :: psb_dbleint_=2
! !

@ -92,6 +92,7 @@ Contains
rrax=>tmp rrax=>tmp
end if end if
else else
dim = 0
allocate(rrax(len),stat=info) allocate(rrax(len),stat=info)
if (info /= 0) then if (info /= 0) then
err=4000 err=4000

@ -47,7 +47,7 @@ module psb_spmat_type
! describe some chacteristics of sparse matrix ! describe some chacteristics of sparse matrix
character(len=11) :: descra character(len=11) :: descra
! Contains some additional informations on sparse matrix ! Contains some additional informations on sparse matrix
integer :: infoa(10) integer :: infoa(psb_ifasize_)
! Contains sparse matrix coefficients ! Contains sparse matrix coefficients
real(kind(1.d0)), pointer :: aspk(:)=>null() real(kind(1.d0)), pointer :: aspk(:)=>null()
! Contains indeces that describes sparse matrix structure ! Contains indeces that describes sparse matrix structure
@ -63,7 +63,7 @@ module psb_spmat_type
! describe some chacteristics of sparse matrix ! describe some chacteristics of sparse matrix
character(len=11) :: descra character(len=11) :: descra
! Contains some additional informations on sparse matrix ! Contains some additional informations on sparse matrix
integer :: infoa(10) integer :: infoa(psb_ifasize_)
! Contains sparse matrix coefficients ! Contains sparse matrix coefficients
complex(kind(1.d0)), pointer :: aspk(:)=>null() complex(kind(1.d0)), pointer :: aspk(:)=>null()
! Contains indeces that describes sparse matrix structure ! Contains indeces that describes sparse matrix structure
@ -80,6 +80,14 @@ module psb_spmat_type
module procedure psb_dspclone, psb_zspclone module procedure psb_dspclone, psb_zspclone
end interface end interface
interface psb_sp_setifld
module procedure psb_dsp_setifld, psb_zsp_setifld
end interface
interface psb_sp_getifld
module procedure psb_dsp_getifld, psb_zsp_getifld
end interface
interface psb_sp_transfer interface psb_sp_transfer
module procedure psb_dsp_transfer, psb_zsp_transfer module procedure psb_dsp_transfer, psb_zsp_transfer
end interface end interface
@ -212,7 +220,7 @@ contains
a%m=max(0,m) a%m=max(0,m)
a%k=max(0,k) a%k=max(0,k)
call psb_sp_reall(a,nnz,info) call psb_sp_reall(a,nnz,info)
if (debug) write(0,*) 'Check in ALLOCATE ',info,associated(a%pl),associated(a%pr)
a%pl(1)=0 a%pl(1)=0
a%pr(1)=0 a%pr(1)=0
! set infoa fields ! set infoa fields
@ -296,6 +304,8 @@ contains
call psb_realloc(max(1,a%m),a%pl,info) call psb_realloc(max(1,a%m),a%pl,info)
if (info /= 0) return if (info /= 0) return
call psb_realloc(max(1,a%k),a%pr,info) call psb_realloc(max(1,a%k),a%pr,info)
if (debug) write(0,*) associated(a%ia1),associated(a%ia2),&
& associated(a%aspk),associated(a%pl),associated(a%pr),info
if (info /= 0) return if (info /= 0) return
Return Return
@ -420,6 +430,63 @@ contains
End Subroutine psb_dsp_transfer End Subroutine psb_dsp_transfer
Subroutine psb_dsp_setifld(val,field,a,info)
implicit none
!....Parameters...
Type(psb_dspmat_type), intent(inout) :: A
Integer, intent(in) :: field,val
Integer, intent(out) :: info
!locals
logical, parameter :: debug=.false.
info = 0
!!$ call psb_realloc(psb_ifasize_,a%infoa,info)
if (info == 0) &
& call psb_setifield(val,field,a%infoa,psb_ifasize_,info)
Return
end subroutine psb_dsp_setifld
function psb_dsp_getifld(field,a,info)
implicit none
!....Parameters...
Type(psb_dspmat_type), intent(in) :: A
Integer, intent(in) :: field
Integer :: psb_dsp_getifld
Integer, intent(out) :: info
!locals
logical, parameter :: debug=.false.
integer :: val
info = 0
val = -1
if ((field < 1).or.(field > psb_ifasize_)) then
info = -1
psb_dsp_getifld = val
return
endif
!!$ if (.not.associated(a%infoa)) then
!!$ info = -2
!!$ return
!!$ endif
call psb_getifield(val,field,a%infoa,psb_ifasize_,info)
psb_dsp_getifld = val
Return
end function psb_dsp_getifld
subroutine psb_dsp_free(a,info) subroutine psb_dsp_free(a,info)
implicit none implicit none
!....Parameters... !....Parameters...
@ -765,6 +832,66 @@ contains
End Subroutine psb_zsp_transfer End Subroutine psb_zsp_transfer
Subroutine psb_zsp_setifld(val,field,a,info)
implicit none
!....Parameters...
Type(psb_zspmat_type), intent(inout) :: A
Integer, intent(in) :: field,val
Integer, intent(out) :: info
!locals
logical, parameter :: debug=.false.
info = 0
!!$ call psb_realloc(psb_ifasize_,a%infoa,info)
if (info == 0) &
& call psb_setifield(val,field,a%infoa,psb_ifasize_,info)
Return
end subroutine psb_zsp_setifld
function psb_zsp_getifld(field,a,info)
implicit none
!....Parameters...
Type(psb_zspmat_type), intent(in) :: A
Integer, intent(in) :: field
Integer :: psb_zsp_getifld
Integer, intent(out) :: info
!locals
logical, parameter :: debug=.false.
integer :: val
info = 0
val = -1
if ((field < 1).or.(field > psb_ifasize_)) then
info = -1
psb_zsp_getifld = val
return
endif
!!$ if (.not.associated(a%infoa)) then
!!$ info = -2
!!$ return
!!$ endif
call psb_getifield(val,field,a%infoa,psb_ifasize_,info)
psb_zsp_getifld = val
Return
end function psb_zsp_getifld
subroutine psb_zsp_free(a,info) subroutine psb_zsp_free(a,info)
implicit none implicit none

@ -293,7 +293,7 @@ Module psb_tools_mod
interface psb_geins interface psb_geins
! 2-D double precision version ! 2-D double precision version
subroutine psb_dins(m, n, x, ix, jx, blck, desc_a, info,& subroutine psb_dins(m, n, x, ix, jx, blck, desc_a, info,&
& iblck, jblck) & iblck, jblck,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m,n integer, intent(in) :: m,n
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -302,10 +302,11 @@ Module psb_tools_mod
real(kind(1.d0)), intent(in) :: blck(:,:) real(kind(1.d0)), intent(in) :: blck(:,:)
integer,intent(out) :: info integer,intent(out) :: info
integer, optional, intent(in) :: iblck,jblck integer, optional, intent(in) :: iblck,jblck
integer, optional, intent(in) :: dupl
end subroutine psb_dins end subroutine psb_dins
! 2-D double precision square version ! 2-D double precision square version
subroutine psb_dinsvm(m, x, ix, jx, blck, desc_a,info,& subroutine psb_dinsvm(m, x, ix, jx, blck, desc_a,info,&
& iblck) & iblck,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m integer, intent(in) :: m
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -314,10 +315,11 @@ Module psb_tools_mod
real(kind(1.d0)), intent(in) :: blck(:) real(kind(1.d0)), intent(in) :: blck(:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: dupl
end subroutine psb_dinsvm end subroutine psb_dinsvm
! 1-D double precision version ! 1-D double precision version
subroutine psb_dinsvv(m, x, ix, blck, desc_a, info,& subroutine psb_dinsvv(m, x, ix, blck, desc_a, info,&
& iblck,insflag) & iblck,insflag,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m integer, intent(in) :: m
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -327,10 +329,11 @@ Module psb_tools_mod
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: insflag integer, optional, intent(in) :: insflag
integer, optional, intent(in) :: dupl
end subroutine psb_dinsvv end subroutine psb_dinsvv
! 2-D integer version ! 2-D integer version
subroutine psb_iins(m, n, x, ix, jx, blck, desc_a, info,& subroutine psb_iins(m, n, x, ix, jx, blck, desc_a, info,&
& iblck, jblck) & iblck, jblck,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m,n integer, intent(in) :: m,n
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -339,10 +342,11 @@ Module psb_tools_mod
integer, intent(in) :: blck(:,:) integer, intent(in) :: blck(:,:)
integer,intent(out) :: info integer,intent(out) :: info
integer, optional, intent(in) :: iblck,jblck integer, optional, intent(in) :: iblck,jblck
integer, optional, intent(in) :: dupl
end subroutine psb_iins end subroutine psb_iins
! 2-D integer square version ! 2-D integer square version
subroutine psb_iinsvm(m, x, ix, jx, blck, desc_a,info,& subroutine psb_iinsvm(m, x, ix, jx, blck, desc_a,info,&
& iblck) & iblck,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m integer, intent(in) :: m
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -351,10 +355,11 @@ Module psb_tools_mod
integer, intent(in) :: blck(:) integer, intent(in) :: blck(:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: dupl
end subroutine psb_iinsvm end subroutine psb_iinsvm
! 1-D integer version ! 1-D integer version
subroutine psb_iinsvv(m, x, ix, blck, desc_a, info,& subroutine psb_iinsvv(m, x, ix, blck, desc_a, info,&
& iblck,insflag) & iblck,insflag,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m integer, intent(in) :: m
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -364,10 +369,11 @@ Module psb_tools_mod
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: insflag integer, optional, intent(in) :: insflag
integer, optional, intent(in) :: dupl
end subroutine psb_iinsvv end subroutine psb_iinsvv
! 2-D double precision version ! 2-D double precision version
subroutine psb_zins(m, n, x, ix, jx, blck, desc_a, info,& subroutine psb_zins(m, n, x, ix, jx, blck, desc_a, info,&
& iblck, jblck) & iblck, jblck,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m,n integer, intent(in) :: m,n
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -376,10 +382,11 @@ Module psb_tools_mod
complex(kind(1.d0)), intent(in) :: blck(:,:) complex(kind(1.d0)), intent(in) :: blck(:,:)
integer,intent(out) :: info integer,intent(out) :: info
integer, optional, intent(in) :: iblck,jblck integer, optional, intent(in) :: iblck,jblck
integer, optional, intent(in) :: dupl
end subroutine psb_zins end subroutine psb_zins
! 2-D double precision square version ! 2-D double precision square version
subroutine psb_zinsvm(m, x, ix, jx, blck, desc_a,info,& subroutine psb_zinsvm(m, x, ix, jx, blck, desc_a,info,&
& iblck) & iblck,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m integer, intent(in) :: m
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -388,10 +395,11 @@ Module psb_tools_mod
complex(kind(1.d0)), intent(in) :: blck(:) complex(kind(1.d0)), intent(in) :: blck(:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: dupl
end subroutine psb_zinsvm end subroutine psb_zinsvm
! 1-D double precision version ! 1-D double precision version
subroutine psb_zinsvv(m, x, ix, blck, desc_a, info,& subroutine psb_zinsvv(m, x, ix, blck, desc_a, info,&
& iblck,insflag) & iblck,insflag,dupl)
use psb_descriptor_type use psb_descriptor_type
integer, intent(in) :: m integer, intent(in) :: m
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
@ -401,6 +409,7 @@ Module psb_tools_mod
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: insflag integer, optional, intent(in) :: insflag
integer, optional, intent(in) :: dupl
end subroutine psb_zinsvv end subroutine psb_zinsvv
end interface end interface
@ -523,23 +532,23 @@ Module psb_tools_mod
end interface end interface
interface psb_spasb interface psb_spasb
subroutine psb_dspasb(a,desc_a, info, afmt, up, dup) subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl)
use psb_descriptor_type use psb_descriptor_type
use psb_spmat_type use psb_spmat_type
type(psb_dspmat_type), intent (inout) :: a type(psb_dspmat_type), intent (inout) :: a
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
integer, intent(out) :: info integer, intent(out) :: info
integer,optional, intent(in) :: dup integer,optional, intent(in) :: dupl, upd
character, optional, intent(in) :: afmt*5, up character, optional, intent(in) :: afmt*5
end subroutine psb_dspasb end subroutine psb_dspasb
subroutine psb_zspasb(a,desc_a, info, afmt, up, dup) subroutine psb_zspasb(a,desc_a, info, afmt, upd, dupl)
use psb_descriptor_type use psb_descriptor_type
use psb_spmat_type use psb_spmat_type
type(psb_zspmat_type), intent (inout) :: a type(psb_zspmat_type), intent (inout) :: a
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
integer, intent(out) :: info integer, intent(out) :: info
integer,optional, intent(in) :: dup integer,optional, intent(in) :: dupl, upd
character, optional, intent(in) :: afmt*5, up character, optional, intent(in) :: afmt*5
end subroutine psb_zspasb end subroutine psb_zspasb
end interface end interface

@ -165,7 +165,8 @@ contains
goto 9999 goto 9999
end if end if
b%infoa(psb_upd_) = 6 call psb_sp_setifld(psb_dupl_ovwrt_,psb_dupl_,b,info)
call psb_sp_setifld(psb_upd_dflt_,psb_upd_,b,info)
b%fida = 'COO' b%fida = 'COO'
b%m=a%m b%m=a%m
b%k=a%k b%k=a%k

@ -165,7 +165,8 @@ contains
goto 9999 goto 9999
end if end if
b%infoa(psb_upd_) = 6 call psb_sp_setifld(psb_dupl_ovwrt_,psb_dupl_,b,info)
call psb_sp_setifld(psb_upd_dflt_,psb_upd_,b,info)
b%fida = 'COO' b%fida = 'COO'
b%m=a%m b%m=a%m
b%k=a%k b%k=a%k

@ -509,7 +509,7 @@ subroutine psb_dspmv(alpha,a,x,beta,y,desc_a,info,&
liwork= 2*ncol liwork= 2*ncol
if (a%pr(1) /= 0) liwork = liwork + n * ik if (a%pr(1) /= 0) liwork = liwork + n * ik
if (a%pl(1) /= 0) liwork = liwork + m * ik if (a%pl(1) /= 0) liwork = liwork + m * ik
! write(0,*)'---->>>',work(1) ! write(0,*)'---->>>',work(1)
if (present(work)) then if (present(work)) then
if(size(work).ge.liwork) then if(size(work).ge.liwork) then
iwork => work iwork => work

@ -81,6 +81,7 @@ subroutine psb_dspsm(alpha,a,x,beta,y,desc_a,info,&
use psi_mod use psi_mod
use psb_check_mod use psb_check_mod
use psb_error_mod use psb_error_mod
use psb_string_mod
implicit none implicit none
real(kind(1.D0)), intent(in) :: alpha, beta real(kind(1.D0)), intent(in) :: alpha, beta
@ -159,16 +160,16 @@ subroutine psb_dspsm(alpha,a,x,beta,y,desc_a,info,&
endif endif
if (present(unitd)) then if (present(unitd)) then
lunitd = unitd lunitd = toupper(unitd)
else else
lunitd = 'U' lunitd = 'U'
endif endif
if (present(trans)) then if (present(trans)) then
if ((trans.eq.'N').or.(trans.eq.'T')& itrans = toupper(trans)
& .or.(trans.eq.'n').or.(trans.eq.'t')) then if((itrans.eq.'N').or.(itrans.eq.'T')) then
itrans = trans ! Ok
else if ((trans.eq.'C').or.(trans.eq.'c')) then else if (itrans.eq.'C') then
info = 3020 info = 3020
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
@ -388,6 +389,7 @@ subroutine psb_dspsv(alpha,a,x,beta,y,desc_a,info,&
use psi_mod use psi_mod
use psb_check_mod use psb_check_mod
use psb_error_mod use psb_error_mod
use psb_string_mod
real(kind(1.D0)), intent(in) :: alpha, beta real(kind(1.D0)), intent(in) :: alpha, beta
real(kind(1.d0)), intent(in), target :: x(:) real(kind(1.d0)), intent(in), target :: x(:)
@ -448,15 +450,16 @@ subroutine psb_dspsv(alpha,a,x,beta,y,desc_a,info,&
endif endif
if (present(unitd)) then if (present(unitd)) then
lunitd = unitd lunitd = toupper(unitd)
else else
lunitd = 'U' lunitd = 'U'
endif endif
if (present(trans)) then if (present(trans)) then
if((trans.eq.'N').or.(trans.eq.'T')) then itrans = toupper(trans)
itrans = trans if((itrans.eq.'N').or.(itrans.eq.'T')) then
else if (trans.eq.'C') then ! Ok
else if (itrans.eq.'C') then
info = 3020 info = 3020
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
@ -507,7 +510,7 @@ subroutine psb_dspsv(alpha,a,x,beta,y,desc_a,info,&
end if end if
iwork(1)=0.d0 iwork(1)=0.d0
if(present(d)) then if (present(d)) then
lld = size(d) lld = size(d)
id => d id => d
else else

@ -11,7 +11,8 @@ FOBJS = psb_cest.o psb_dcoins.o psb_dcsdp.o psb_dcsmm.o psb_dcsmv.o \
psb_zcsnmi.o psb_zcsrws.o psb_zcssm.o psb_zcssv.o psb_zcsdp.o\ psb_zcsnmi.o psb_zcsrws.o psb_zcssm.o psb_zcssv.o psb_zcsdp.o\
psb_zfixcoo.o psb_zipcoo2csr.o psb_zipcsr2coo.o psb_zipcoo2csc.o \ psb_zfixcoo.o psb_zipcoo2csr.o psb_zipcsr2coo.o psb_zipcoo2csc.o \
psb_zcoins.o psb_zcsprt.o psb_zneigh.o psb_ztransp.o \ psb_zcoins.o psb_zcsprt.o psb_zneigh.o psb_ztransp.o \
psb_zrwextd.o psb_zsymbmm.o psb_znumbmm.o psb_zspinfo.o psb_zspscal.o psb_zrwextd.o psb_zsymbmm.o psb_znumbmm.o psb_zspinfo.o psb_zspscal.o\
psb_getifield.o psb_setifield.o
INCDIRS = -I ../../lib -I . INCDIRS = -I ../../lib -I .

@ -4,7 +4,7 @@ include ../../../Make.inc
# #
FOBJS = isr.o isrx.o \ FOBJS = isr.o isrx.o \
mrgsrt.o isaperm.o ibsrch.o mrgsrt.o isaperm.o ibsrch.o imsr.o imsrx.o
OBJS=$(FOBJS) OBJS=$(FOBJS)

@ -30,7 +30,8 @@
!!$ !!$
! File: imsr.f90 ! File: imsr.f90
! Subroutine: ! Subroutine:
! Parameters:subroutine imsr(n,x) ! Parameters:
subroutine imsr(n,x)
integer :: n integer :: n
integer :: x(n) integer :: x(n)

@ -30,7 +30,8 @@
!!$ !!$
! File: imsrx.f90 ! File: imsrx.f90
! Subroutine: ! Subroutine:
! Parameters:subroutine imsrx(n,x,indx) ! Parameters:
subroutine imsrx(n,x,indx)
integer :: n integer :: n
integer :: x(n) integer :: x(n)
integer :: indx(n) integer :: indx(n)

@ -71,13 +71,14 @@ c
ierror = 0 ierror = 0
call fcpsb_erractionsave(err_act) call fcpsb_erractionsave(err_act)
check_flag=ibits(info(psb_upd_),1,2) call psb_getifield(check_flag,psb_dupl_,info,psb_ifasize_,ierror)
if (trans.eq.'N') then if (trans.eq.'N') then
scale = (unitd.eq.'L') ! meaningless scale = (unitd.eq.'L') ! meaningless
p1(1) = 0 p1(1) = 0
p2(1) = 0 p2(1) = 0
nnz = info(psb_nnz_) call psb_getifield(nnz,psb_nnz_,info,psb_ifasize_,ierror)
if (debug) then if (debug) then
write(*,*) 'on entry to dcoco: nnz laux ', write(*,*) 'on entry to dcoco: nnz laux ',
+ nnz,laux,larn,lia1n,lia2n + nnz,laux,larn,lia1n,lia2n
@ -171,16 +172,16 @@ c ... insert remaining element ...
do elem_in = 2, nnz do elem_in = 2, nnz
if ((ia1n(elem_in).eq.ia1n(elem_out)).and. if ((ia1n(elem_in).eq.ia1n(elem_out)).and.
+ (ia2n(elem_in).eq.ia2n(elem_out))) then + (ia2n(elem_in).eq.ia2n(elem_out))) then
if (check_flag.eq.1) then if (check_flag.eq.psb_dupl_err_) then
c ... error, there are duplicated elements ... c ... error, there are duplicated elements ...
ierror = 130 ierror = 130
call fcpsb_errpush(ierror,name,int_val) call fcpsb_errpush(ierror,name,int_val)
goto 9999 goto 9999
else if (check_flag.eq.2) then else if (check_flag.eq.psb_dupl_ovwrt_) then
c ... insert only the first duplicated element ... c ... insert only the first duplicated element ...
ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out
else if (check_flag.eq.3) then else if (check_flag.eq.psb_dupl_add_) then
c ... sum the duplicated element ... c ... add the duplicated element ...
arn(elem_out) = arn(elem_out) + arn(elem_in) arn(elem_out) = arn(elem_out) + arn(elem_in)
ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out
end if end if
@ -219,15 +220,15 @@ c ... insert remaining element ...
do elem_in = 2, nnz do elem_in = 2, nnz
if ((ia1n(elem_in).eq.ia1n(elem_out)).and. if ((ia1n(elem_in).eq.ia1n(elem_out)).and.
+ (ia2n(elem_in).eq.ia2n(elem_out))) then + (ia2n(elem_in).eq.ia2n(elem_out))) then
if (check_flag.eq.1) then if (check_flag.eq.psb_dupl_err_) then
c ... error, there are duplicated elements ... c ... error, there are duplicated elements ...
ierror = 130 ierror = 130
call fcpsb_errpush(ierror,name,int_val) call fcpsb_errpush(ierror,name,int_val)
goto 9999 goto 9999
else if (check_flag.eq.2) then else if (check_flag.eq.psb_dupl_ovwrt_) then
c ... insert only the first duplicated element ... c ... insert only the first duplicated element ...
else if (check_flag.eq.3) then else if (check_flag.eq.psb_dupl_add_) then
c ... sum the duplicated element ... c ... add the duplicated element ...
arn(elem_out) = arn(elem_out) + arn(elem_in) arn(elem_out) = arn(elem_out) + arn(elem_in)
end if end if
else else

@ -73,8 +73,8 @@ C
IERROR = 0 IERROR = 0
CALL FCPSB_ERRACTIONSAVE(ERR_ACT) CALL FCPSB_ERRACTIONSAVE(ERR_ACT)
CHECK_FLAG=IBITS(INFO(PSB_UPD_),1,2) call psb_getifield(check_flag,psb_dupl_,info,psb_ifasize_,ierror)
c$$$ write(0,*) 'DCOCR FLAG ',info(psb_upd_),check_flag
IF ((TRANS.EQ.'N').or.(TRANS.EQ.'n')) THEN IF ((TRANS.EQ.'N').or.(TRANS.EQ.'n')) THEN
SCALE = (UNITD.EQ.'L') ! meaningless SCALE = (UNITD.EQ.'L') ! meaningless
@ -221,16 +221,16 @@ C ... Insert other element of row ...
ian2(ip2+aux(ipx+elem-1)-1) = elem_csr ian2(ip2+aux(ipx+elem-1)-1) = elem_csr
ELEM_CSR = ELEM_CSR+1 ELEM_CSR = ELEM_CSR+1
ELSE ELSE
IF (CHECK_FLAG.EQ.1) THEN IF (CHECK_FLAG.EQ.psb_dupl_err_) THEN
C ... Error, there are duplicated elements ... C ... Error, there are duplicated elements ...
IERROR = 130 IERROR = 130
CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL) CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL)
GOTO 9999 GOTO 9999
ELSE IF (CHECK_FLAG.EQ.2) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_ovwrt_) THEN
C ... Insert only the last duplicated element ... C ... Insert only the last duplicated element ...
ARN(ELEM_CSR-1) = AR(ELEM) ARN(ELEM_CSR-1) = AR(ELEM)
ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1 ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1
ELSE IF (CHECK_FLAG.EQ.3) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_add_) THEN
C ... Sum the duplicated element ... C ... Sum the duplicated element ...
ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM) ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM)
ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1 ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1
@ -296,17 +296,17 @@ C ... Insert other element of row ...
ARN(ELEM_CSR) = AR(ELEM) ARN(ELEM_CSR) = AR(ELEM)
ELEM_CSR = ELEM_CSR+1 ELEM_CSR = ELEM_CSR+1
ELSE ELSE
IF (CHECK_FLAG.EQ.1) THEN IF (CHECK_FLAG.EQ.psb_dupl_err_) THEN
C ... Error, there are duplicated elements ... C ... Error, there are duplicated elements ...
IERROR = 130 IERROR = 130
CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL) CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL)
GOTO 9999 GOTO 9999
ELSE IF (CHECK_FLAG.EQ.2) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_ovwrt_) THEN
C ... Insert only the last duplicated element ... C ... Insert only the last duplicated element ...
ARN(ELEM_CSR-1) = AR(ELEM) ARN(ELEM_CSR-1) = AR(ELEM)
if (debug) write(0,*) 'Duplicated overwrite', if (debug) write(0,*) 'Duplicated overwrite',
+ elem_csr-1,elem + elem_csr-1,elem
ELSE IF (CHECK_FLAG.EQ.3) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_add_) THEN
C ... Sum the duplicated element ... C ... Sum the duplicated element ...
ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM) ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM)
if (debug) write(0,*) 'Duplicated add', if (debug) write(0,*) 'Duplicated add',

@ -59,7 +59,9 @@ c .. Local Arrays ..
POINT_AR = 1 POINT_AR = 1
POINT_JA = 0 POINT_JA = 0
CHECK_FLAG=IBITS(INFON(PSB_UPD_),1,2)
call psb_getifield(check_flag,psb_dupl_,infon,psb_ifasize_,ierror)
IF ((LARN.LT.POINT_AR).OR.(LKA.LT.POINT_AR)) THEN IF ((LARN.LT.POINT_AR).OR.(LKA.LT.POINT_AR)) THEN
IERROR = 60 IERROR = 60

@ -71,7 +71,7 @@ c
ierror = 0 ierror = 0
call fcpsb_erractionsave(err_act) call fcpsb_erractionsave(err_act)
check_flag=ibits(info(psb_upd_),1,2) call psb_getifield(check_flag,psb_dupl_,info,psb_ifasize_,ierror)
if (trans.eq.'N') then if (trans.eq.'N') then
scale = (unitd.eq.'L') ! meaningless scale = (unitd.eq.'L') ! meaningless
p1(1) = 0 p1(1) = 0
@ -172,15 +172,15 @@ c ... insert remaining element ...
do elem_in = 2, nnz do elem_in = 2, nnz
if ((ia1n(elem_in).eq.ia1n(elem_out)).and. if ((ia1n(elem_in).eq.ia1n(elem_out)).and.
+ (ia2n(elem_in).eq.ia2n(elem_out))) then + (ia2n(elem_in).eq.ia2n(elem_out))) then
if (check_flag.eq.1) then if (check_flag.eq.psb_dupl_err_) then
c ... error, there are duplicated elements ... c ... error, there are duplicated elements ...
ierror = 130 ierror = 130
call fcpsb_errpush(ierror,name,int_val) call fcpsb_errpush(ierror,name,int_val)
goto 9999 goto 9999
else if (check_flag.eq.2) then else if (check_flag.eq.psb_dupl_ovwrt_) then
c ... insert only the first duplicated element ... c ... insert only the first duplicated element ...
ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out
else if (check_flag.eq.3) then else if (check_flag.eq.psb_dupl_add_) then
c ... sum the duplicated element ... c ... sum the duplicated element ...
arn(elem_out) = arn(elem_out) + arn(elem_in) arn(elem_out) = arn(elem_out) + arn(elem_in)
ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out ia2n(ip2+aux(ipx+elem_in-1)-1) = elem_out
@ -220,14 +220,14 @@ c ... insert remaining element ...
do elem_in = 2, nnz do elem_in = 2, nnz
if ((ia1n(elem_in).eq.ia1n(elem_out)).and. if ((ia1n(elem_in).eq.ia1n(elem_out)).and.
+ (ia2n(elem_in).eq.ia2n(elem_out))) then + (ia2n(elem_in).eq.ia2n(elem_out))) then
if (check_flag.eq.1) then if (check_flag.eq.psb_dupl_err_) then
c ... error, there are duplicated elements ... c ... error, there are duplicated elements ...
ierror = 130 ierror = 130
call fcpsb_errpush(ierror,name,int_val) call fcpsb_errpush(ierror,name,int_val)
goto 9999 goto 9999
else if (check_flag.eq.2) then else if (check_flag.eq.psb_dupl_ovwrt_) then
c ... insert only the first duplicated element ... c ... insert only the first duplicated element ...
else if (check_flag.eq.3) then else if (check_flag.eq.psb_dupl_add_) then
c ... sum the duplicated element ... c ... sum the duplicated element ...
arn(elem_out) = arn(elem_out) + arn(elem_in) arn(elem_out) = arn(elem_out) + arn(elem_in)
end if end if

@ -73,8 +73,8 @@ C
IERROR = 0 IERROR = 0
CALL FCPSB_ERRACTIONSAVE(ERR_ACT) CALL FCPSB_ERRACTIONSAVE(ERR_ACT)
CHECK_FLAG=IBITS(INFO(PSB_UPD_),1,2) call psb_getifield(check_flag,psb_dupl_,info,psb_ifasize_,ierror)
c$$$ write(0,*) 'ZCOCR FLAG ',info(psb_upd_),check_flag
IF ((TRANS.EQ.'N').or.(TRANS.EQ.'n')) THEN IF ((TRANS.EQ.'N').or.(TRANS.EQ.'n')) THEN
SCALE = (UNITD.EQ.'L') ! meaningless SCALE = (UNITD.EQ.'L') ! meaningless
@ -221,16 +221,16 @@ C ... Insert other element of row ...
ian2(ip2+aux(ipx+elem-1)-1) = elem_csr ian2(ip2+aux(ipx+elem-1)-1) = elem_csr
ELEM_CSR = ELEM_CSR+1 ELEM_CSR = ELEM_CSR+1
ELSE ELSE
IF (CHECK_FLAG.EQ.1) THEN IF (CHECK_FLAG.EQ.psb_dupl_err_) THEN
C ... Error, there are duplicated elements ... C ... Error, there are duplicated elements ...
IERROR = 130 IERROR = 130
CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL) CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL)
GOTO 9999 GOTO 9999
ELSE IF (CHECK_FLAG.EQ.2) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_ovwrt_) THEN
C ... Insert only the last duplicated element ... C ... Insert only the last duplicated element ...
ARN(ELEM_CSR-1) = AR(ELEM) ARN(ELEM_CSR-1) = AR(ELEM)
ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1 ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1
ELSE IF (CHECK_FLAG.EQ.3) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_add_) THEN
C ... Sum the duplicated element ... C ... Sum the duplicated element ...
ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM) ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM)
ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1 ian2(ip2+aux(ipx+elem-1)-1) = elem_csr-1
@ -296,17 +296,17 @@ C ... Insert other element of row ...
ARN(ELEM_CSR) = AR(ELEM) ARN(ELEM_CSR) = AR(ELEM)
ELEM_CSR = ELEM_CSR+1 ELEM_CSR = ELEM_CSR+1
ELSE ELSE
IF (CHECK_FLAG.EQ.1) THEN IF (CHECK_FLAG.EQ.psb_dupl_err_) THEN
C ... Error, there are duplicated elements ... C ... Error, there are duplicated elements ...
IERROR = 130 IERROR = 130
CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL) CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL)
GOTO 9999 GOTO 9999
ELSE IF (CHECK_FLAG.EQ.2) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_ovwrt_) THEN
C ... Insert only the last duplicated element ... C ... Insert only the last duplicated element ...
ARN(ELEM_CSR-1) = AR(ELEM) ARN(ELEM_CSR-1) = AR(ELEM)
if (debug) write(0,*) 'Duplicated overwrite', if (debug) write(0,*) 'Duplicated overwrite',
+ elem_csr-1,elem + elem_csr-1,elem
ELSE IF (CHECK_FLAG.EQ.3) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_add_) THEN
C ... Sum the duplicated element ... C ... Sum the duplicated element ...
ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM) ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM)
if (debug) write(0,*) 'Duplicated add', if (debug) write(0,*) 'Duplicated add',
@ -396,19 +396,19 @@ C ... Insert other element of row ...
ELEM_CSR = ELEM_CSR+1 ELEM_CSR = ELEM_CSR+1
ENDIF ENDIF
ELSE ELSE
IF (CHECK_FLAG.EQ.1) THEN IF (CHECK_FLAG.EQ.psb_dupl_err_) THEN
C ... Error, there are duplicated elements ... C ... Error, there are duplicated elements ...
IERROR = 130 IERROR = 130
CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL) CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL)
GOTO 9999 GOTO 9999
ELSE IF (CHECK_FLAG.EQ.2) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_ovwrt_) THEN
C ... Insert only the last duplicated element ... C ... Insert only the last duplicated element ...
IF(JA(ELEM).GT.IA(ELEM)) THEN IF(JA(ELEM).GT.IA(ELEM)) THEN
ARN(ELEM_CSR-1) = AR(ELEM) ARN(ELEM_CSR-1) = AR(ELEM)
ENDIF ENDIF
if (debug) write(0,*) 'Duplicated overwrite', if (debug) write(0,*) 'Duplicated overwrite',
+ elem_csr-1,elem + elem_csr-1,elem
ELSE IF (CHECK_FLAG.EQ.3) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_add_) THEN
C ... Sum the duplicated element ... C ... Sum the duplicated element ...
IF(JA(ELEM).GT.IA(ELEM)) THEN IF(JA(ELEM).GT.IA(ELEM)) THEN
ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM) ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM)
@ -494,19 +494,19 @@ C ... Insert other element of row ...
ELEM_CSR = ELEM_CSR+1 ELEM_CSR = ELEM_CSR+1
ENDIF ENDIF
ELSE ELSE
IF (CHECK_FLAG.EQ.1) THEN IF (CHECK_FLAG.EQ.psb_dupl_err_) THEN
C ... Error, there are duplicated elements ... C ... Error, there are duplicated elements ...
IERROR = 130 IERROR = 130
CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL) CALL FCPSB_ERRPUSH(IERROR,NAME,INT_VAL)
GOTO 9999 GOTO 9999
ELSE IF (CHECK_FLAG.EQ.2) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_ovwrt_) THEN
C ... Insert only the last duplicated element ... C ... Insert only the last duplicated element ...
IF(JA(ELEM).LT.IA(ELEM)) THEN IF(JA(ELEM).LT.IA(ELEM)) THEN
ARN(ELEM_CSR-1) = AR(ELEM) ARN(ELEM_CSR-1) = AR(ELEM)
ENDIF ENDIF
if (debug) write(0,*) 'Duplicated overwrite', if (debug) write(0,*) 'Duplicated overwrite',
+ elem_csr-1,elem + elem_csr-1,elem
ELSE IF (CHECK_FLAG.EQ.3) THEN ELSE IF (CHECK_FLAG.EQ.psb_dupl_add_) THEN
C ... Sum the duplicated element ... C ... Sum the duplicated element ...
IF(JA(ELEM).LT.IA(ELEM)) THEN IF(JA(ELEM).LT.IA(ELEM)) THEN
ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM) ARN(ELEM_CSR-1) = ARN(ELEM_CSR-1) + AR(ELEM)

@ -59,7 +59,7 @@ c .. Local Arrays ..
POINT_AR = 1 POINT_AR = 1
POINT_JA = 0 POINT_JA = 0
CHECK_FLAG=IBITS(INFON(PSB_UPD_),1,2) call psb_getifield(check_flag,psb_dupl_,infon,psb_ifasize_,ierror)
IF ((LARN.LT.POINT_AR).OR.(LKA.LT.POINT_AR)) THEN IF ((LARN.LT.POINT_AR).OR.(LKA.LT.POINT_AR)) THEN
IERROR = 60 IERROR = 60

@ -49,8 +49,8 @@ subroutine psb_dcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
character(len=5) :: ufida character(len=5) :: ufida
integer :: i,j,ir,ic,nr,nc, ng, nza, isza,spstate, nnz,& integer :: i,j,ir,ic,nr,nc, ng, nza, isza,spstate, nnz,&
& ip1, nzl, err_act, int_err(5) & ip1, nzl, err_act, int_err(5), iupd
logical, parameter :: debug=.true. logical, parameter :: debug=.false.
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
name='psb_dcoins' name='psb_dcoins'
@ -88,9 +88,10 @@ subroutine psb_dcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
!!$ ufida = toupper(a%fida) !!$ ufida = toupper(a%fida)
call touppers(a%fida,ufida) call touppers(a%fida,ufida)
ng = size(gtl) ng = size(gtl)
spstate = a%infoa(psb_state_) spstate = psb_sp_getifld(psb_state_,a,info)
select case(spstate) select case(spstate)
case(psb_spmat_bld_) case(psb_spmat_bld_)
if ((ufida /= 'COO').and.(ufida/='COI')) then if ((ufida /= 'COO').and.(ufida/='COI')) then
info = 134 info = 134
@ -129,20 +130,23 @@ subroutine psb_dcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
write(0,*) 'PSB_COINS: insert discarded items ' write(0,*) 'PSB_COINS: insert discarded items '
end if end if
end if end if
if ((nza - a%infoa(psb_nnz_)) /= nz) then if ((nza - psb_sp_getifld(psb_nnz_,a,info)) /= nz) then
a%infoa(psb_del_bnd_) = nza call psb_sp_setifld(nza,psb_del_bnd_,a,info)
endif endif
a%infoa(psb_nnz_) = nza call psb_sp_setifld(nza,psb_nnz_,a,info)
case(psb_spmat_upd_) case(psb_spmat_upd_)
if (ibits(a%infoa(psb_upd_),2,1).eq.1) then iupd = psb_sp_getifld(psb_upd_,a,info)
ip1 = a%infoa(psb_upd_pnt_) select case (iupd)
case (psb_upd_perm_)
ip1 = psb_sp_getifld(psb_upd_pnt_,a,info)
nzl = psb_sp_getifld(psb_del_bnd_,a,info)
nza = a%ia2(ip1+psb_nnz_) nza = a%ia2(ip1+psb_nnz_)
nzl = a%infoa(psb_del_bnd_)
call psb_inner_upd(nz,ia,ja,val,nza,a%aspk,gtl,& call psb_inner_upd(nz,ia,ja,val,nza,a%aspk,gtl,&
& imin,imax,jmin,jmax,nzl,info) & imin,imax,jmin,jmax,nzl,info)
if(info.ne.izero) then if(info.ne.izero) then
info=4010 info=4010
ch_err='psb_inner_upd' ch_err='psb_inner_upd'
@ -154,13 +158,20 @@ subroutine psb_dcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
write(0,*) 'PSB_COINS: update discarded items ' write(0,*) 'PSB_COINS: update discarded items '
end if end if
end if end if
a%ia2(ip1+psb_nnz_) = nza a%ia2(ip1+psb_nnz_) = nza
else
if (debug) write(0,*) 'From COINS(UPD) : NZA:',nza
case (psb_upd_dflt_, psb_upd_srch_)
write(0,*) 'Default & search inner update to be implemented'
info = 2230
call psb_errpush(info,name)
goto 9999
case default
info = 2231 info = 2231
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif end select
case default case default
info = 2232 info = 2232

@ -47,6 +47,7 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
use psb_const_mod use psb_const_mod
use psb_error_mod use psb_error_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod
implicit none implicit none
!....Parameters... !....Parameters...
@ -68,6 +69,7 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
Integer, Parameter :: maxtry=8 Integer, Parameter :: maxtry=8
logical, parameter :: debug=.false. logical, parameter :: debug=.false.
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
interface psb_cest interface psb_cest
subroutine psb_cest(afmt, m,n,nnz, lia1, lia2, lar, up, info) subroutine psb_cest(afmt, m,n,nnz, lia1, lia2, lar, up, info)
integer, intent(in) :: m,n,nnz integer, intent(in) :: m,n,nnz
@ -98,17 +100,17 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
ifc_ = 1 ifc_ = 1
endif endif
if (present(check)) then if (present(check)) then
check_ = check check_ = toupper(check)
else else
check_ = 'N' check_ = 'N'
endif endif
if (present(trans)) then if (present(trans)) then
trans_ = trans trans_ = toupper(trans )
else else
trans_ = 'N' trans_ = 'N'
endif endif
if (present(unitd)) then if (present(unitd)) then
unitd_ = unitd unitd_ = toupper(unitd )
else else
unitd_ = 'U' unitd_ = 'U'
endif endif
@ -132,7 +134,7 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
endif endif
if((check_=='Y').or.(check_=='C')) then if((check_=='Y').or.(check_=='C')) then
if(a%fida(1:3)=='CSR') then if(toupper(a%fida(1:3))=='CSR') then
call dcsrck(trans,a%m,a%k,a%descra,a%aspk,a%ia1,a%ia2,work,size(work),info) call dcsrck(trans,a%m,a%k,a%descra,a%aspk,a%ia1,a%ia2,work,size(work),info)
if(info /= 0) then if(info /= 0) then
info=4010 info=4010
@ -153,13 +155,14 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
b%k=a%k b%k=a%k
call psb_spinfo(psb_nztotreq_,a,size_req,info) call psb_spinfo(psb_nztotreq_,a,size_req,info)
if (debug) write(0,*) 'DCSDP : size_req 1:',size_req if (debug) write(0,*) 'DCSDP : size_req 1:',size_req
!! PULL IUP FROM INFOA FIELD !
iup = iand(b%infoa(psb_upd_),4) iup = psb_sp_getifld(psb_upd_,b,info)
if (iup > 0) then if (iup == psb_upd_perm_) then
up = 'Y' up = 'Y'
else else
up = 'N' up = 'N'
endif endif
n_row=b%m n_row=b%m
n_col=b%k n_col=b%k
call psb_cest(b%fida, n_row,n_col,size_req,& call psb_cest(b%fida, n_row,n_col,size_req,&
@ -190,11 +193,11 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
b%pr(:) = 0 b%pr(:) = 0
select case (a%fida(1:3)) select case (toupper(a%fida(1:3)))
case ('CSR') case ('CSR')
select case (b%fida(1:3)) select case (toupper(b%fida(1:3)))
case ('CSR') case ('CSR')
@ -281,7 +284,7 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
case ('COO','COI') case ('COO','COI')
select case (b%fida(1:3)) select case (toupper(b%fida(1:3)))
case ('CSR') case ('CSR')
@ -375,57 +378,59 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
else if (check_=='R') then else if (check_=='R') then
!...Regenerating matrix !...Regenerating matrix
if (b%infoa(psb_state_) /= psb_spmat_upd_) then if (psb_sp_getifld(psb_state_,b,info) /= psb_spmat_upd_) then
info = 8888
call psb_errpush(info,name)
goto 9999
endif
if (ibits(b%infoa(psb_upd_),2,1).eq.0) then
!
! Nothing to be done......
!
info = 8888 info = 8888
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
select case(psb_sp_getifld(psb_upd_,b,info))
case(psb_upd_perm_)
if (b%fida(1:3)/='JAD') then if (toupper(b%fida(1:3))/='JAD') then
ip1 = b%infoa(psb_upd_pnt_) ip1 = psb_sp_getifld(psb_upd_pnt_,b,info)
ip2 = b%ia2(ip1+psb_ip2_) ip2 = b%ia2(ip1+psb_ip2_)
nnz = b%ia2(ip1+psb_nnz_) nnz = b%ia2(ip1+psb_nnz_)
iflag = b%ia2(ip1+psb_iflag_) iflag = b%ia2(ip1+psb_iflag_)
ichk = b%ia2(ip1+psb_ichk_) ichk = b%ia2(ip1+psb_ichk_)
nnzt = b%ia2(ip1+psb_nnzt_) nnzt = b%ia2(ip1+psb_nnzt_)
if (debug) write(*,*) 'Regeneration start: ',& if (debug) write(*,*) 'Regeneration start: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt ,iflag,info & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt ,iflag,info
if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then
info = 8889 info = 8889
write(*,*) 'Regeneration start error: ',& write(*,*) 'Regeneration start error: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt ,iflag,ichk & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt ,iflag,ichk
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
do i= 1, nnz do i= 1, nnz
work(i) = 0.d0 work(i) = 0.d0
enddo enddo
if (iflag.eq.2) then select case(iflag)
case(psb_dupl_ovwrt_,psb_dupl_err_)
do i=1, nnz do i=1, nnz
work(b%ia2(ip2+i-1)) = b%aspk(i) work(b%ia2(ip2+i-1)) = b%aspk(i)
enddo enddo
else if (iflag.eq.3) then case(psb_dupl_add_)
do i=1, nnz do i=1, nnz
work(b%ia2(ip2+i-1)) = b%aspk(i) + work(b%ia2(ip2+i-1)) work(b%ia2(ip2+i-1)) = b%aspk(i) + work(b%ia2(ip2+i-1))
enddo enddo
endif case default
info = 8887
call psb_errpush(info,name)
goto 9999
end select
do i=1, nnz do i=1, nnz
b%aspk(i) = work(i) b%aspk(i) = work(i)
enddo enddo
else if (b%fida(1:3) == 'JAD') then else if (toupper(b%fida(1:3)) == 'JAD') then
ip1 = b%infoa(psb_upd_pnt_)
ip1 = psb_sp_getifld(psb_upd_pnt_,b,info)
ip2 = b%ia1(ip1+psb_ip2_) ip2 = b%ia1(ip1+psb_ip2_)
count = b%ia1(ip1+psb_zero_) count = b%ia1(ip1+psb_zero_)
ipc = b%ia1(ip1+psb_ipc_) ipc = b%ia1(ip1+psb_ipc_)
@ -434,13 +439,13 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
ichk = b%ia1(ip1+psb_ichk_) ichk = b%ia1(ip1+psb_ichk_)
nnzt = b%ia1(ip1+psb_nnzt_) nnzt = b%ia1(ip1+psb_nnzt_)
if (debug) write(*,*) 'Regeneration start: ',& if (debug) write(*,*) 'Regeneration start: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt,count, & & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt,count, &
& iflag,info & iflag,info
if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then
info = 10 info = 10
write(*,*) 'Regeneration start error: ',& write(*,*) 'Regeneration start error: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt ,iflag,ichk & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt ,iflag,ichk
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
@ -448,15 +453,21 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
do i= 1, nnz+count do i= 1, nnz+count
work(i) = 0.d0 work(i) = 0.d0
enddo enddo
if (iflag.eq.2) then select case(iflag)
case(psb_dupl_ovwrt_,psb_dupl_err_)
do i=1, nnz do i=1, nnz
work(b%ia1(ip2+i-1)) = b%aspk(i) work(b%ia1(ip2+i-1)) = b%aspk(i)
enddo enddo
else if (iflag.eq.3) then case(psb_dupl_add_)
do i=1, nnz do i=1, nnz
work(b%ia1(ip2+i-1)) = b%aspk(i) + work(b%ia1(ip2+i-1)) work(b%ia1(ip2+i-1)) = b%aspk(i) + work(b%ia1(ip2+i-1))
enddo enddo
endif case default
info = 8887
call psb_errpush(info,name)
goto 9999
end select
do i=1, nnz+count do i=1, nnz+count
b%aspk(i) = work(i) b%aspk(i) = work(i)
enddo enddo
@ -465,9 +476,18 @@ subroutine psb_dcsdp(a, b,info,ifc,check,trans,unitd)
end do end do
endif endif
case(psb_upd_dflt_,psb_upd_srch_)
! Nothing to be done
case default
! Wrong value
info = 8888
call psb_errpush(info,name)
goto 9999
end select
end if end if
b%infoa(psb_state_) = psb_spmat_asb_ call psb_sp_setifld(psb_spmat_asb_,psb_state_,b,info)
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return

@ -0,0 +1,14 @@
subroutine psb_getifield(val,field,info,isize,ierr)
integer :: val,field,isize,ierr
integer :: info(*)
ierr = 0
val = -1
if ((field < 1).or.(field > isize)) then
ierr = -1
return
endif
val = info(field)
return
end subroutine psb_getifield

@ -0,0 +1,14 @@
subroutine psb_setifield(val,field,info,isize,ierr)
integer :: val,field,isize,ierr
integer :: info(*)
ierr = 0
if ((field < 1).or.(field > isize)) then
ierr = -1
return
endif
info(field) = val
return
end subroutine psb_setifield

@ -49,7 +49,7 @@ subroutine psb_zcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
character(len=5) :: ufida character(len=5) :: ufida
integer :: i,j,ir,ic,nr,nc, ng, nza, isza,spstate, nnz,& integer :: i,j,ir,ic,nr,nc, ng, nza, isza,spstate, nnz,&
& ip1, nzl, err_act, int_err(5) & ip1, nzl, err_act, int_err(5), iupd
logical, parameter :: debug=.true. logical, parameter :: debug=.true.
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
@ -88,7 +88,7 @@ subroutine psb_zcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
!!$ ufida = toupper(a%fida) !!$ ufida = toupper(a%fida)
call touppers(a%fida,ufida) call touppers(a%fida,ufida)
ng = size(gtl) ng = size(gtl)
spstate = a%infoa(psb_state_) spstate = psb_sp_getifld(psb_state_,a,info)
select case(spstate) select case(spstate)
case(psb_spmat_bld_) case(psb_spmat_bld_)
@ -108,7 +108,7 @@ subroutine psb_zcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
endif endif
if ((nza+nz)>isza) then if ((nza+nz)>isza) then
call psb_sp_reall(a,nza+nz,info) call psb_sp_reall(a,max(nza+nz,int(1.5*isza)),info)
if(info.ne.izero) then if(info.ne.izero) then
info=4010 info=4010
ch_err='psb_sp_reall' ch_err='psb_sp_reall'
@ -136,10 +136,12 @@ subroutine psb_zcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
case(psb_spmat_upd_) case(psb_spmat_upd_)
if (ibits(a%infoa(psb_upd_),2,1).eq.1) then iupd = psb_sp_getifld(psb_upd_,a,info)
ip1 = a%infoa(psb_upd_pnt_) select case (iupd)
case (psb_upd_perm_)
ip1 = psb_sp_getifld(psb_upd_pnt_,a,info)
nzl = psb_sp_getifld(psb_del_bnd_,a,info)
nza = a%ia2(ip1+psb_nnz_) nza = a%ia2(ip1+psb_nnz_)
nzl = a%infoa(psb_del_bnd_)
call psb_inner_upd(nz,ia,ja,val,nza,a%aspk,gtl,& call psb_inner_upd(nz,ia,ja,val,nza,a%aspk,gtl,&
& imin,imax,jmin,jmax,nzl,info) & imin,imax,jmin,jmax,nzl,info)
@ -156,11 +158,16 @@ subroutine psb_zcoins(nz,ia,ja,val,a,gtl,imin,imax,jmin,jmax,info)
end if end if
a%ia2(ip1+psb_nnz_) = nza a%ia2(ip1+psb_nnz_) = nza
else case (psb_upd_dflt_, psb_upd_srch_)
write(0,*) 'Default & search inner update to be implemented'
info = 2230
call psb_errpush(info,name)
goto 9999
case default
info = 2231 info = 2231
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif end select
case default case default
info = 2232 info = 2232
@ -197,7 +204,7 @@ contains
if (nza >= nzl) then if (nza >= nzl) then
do i=1, nz do i=1, nz
nza = nza + 1 nza = nza + 1
a%aspk(nza) = val(i) aspk(nza) = val(i)
end do end do
else else
do i=1, nz do i=1, nz
@ -208,7 +215,7 @@ contains
ic = gtl(ic) ic = gtl(ic)
if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then
nza = nza + 1 nza = nza + 1
a%aspk(nza) = val(i) aspk(nza) = val(i)
end if end if
end if end if
end do end do
@ -239,9 +246,9 @@ contains
ic = gtl(ic) ic = gtl(ic)
if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then
nza = nza + 1 nza = nza + 1
a%ia1(nza) = ir ia1(nza) = ir
a%ia2(nza) = ic ia2(nza) = ic
a%aspk(nza) = val(i) aspk(nza) = val(i)
end if end if
end if end if
end do end do

@ -47,6 +47,7 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
use psb_const_mod use psb_const_mod
use psb_error_mod use psb_error_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod
implicit none implicit none
!....Parameters... !....Parameters...
@ -99,17 +100,17 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
ifc_ = 1 ifc_ = 1
endif endif
if (present(check)) then if (present(check)) then
check_ = check check_ = toupper(check)
else else
check_ = 'N' check_ = 'N'
endif endif
if (present(trans)) then if (present(trans)) then
trans_ = trans trans_ = toupper(trans )
else else
trans_ = 'N' trans_ = 'N'
endif endif
if (present(unitd)) then if (present(unitd)) then
unitd_ = unitd unitd_ = toupper(unitd )
else else
unitd_ = 'U' unitd_ = 'U'
endif endif
@ -133,7 +134,7 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
endif endif
if((check_=='Y').or.(check_=='C')) then if((check_=='Y').or.(check_=='C')) then
if(a%fida(1:3)=='CSR') then if(toupper(a%fida(1:3))=='CSR') then
call zcsrck(trans,a%m,a%k,a%descra,a%aspk,a%ia1,a%ia2,work,size(work),info) call zcsrck(trans,a%m,a%k,a%descra,a%aspk,a%ia1,a%ia2,work,size(work),info)
if(info /= 0) then if(info /= 0) then
info=4010 info=4010
@ -154,13 +155,14 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
b%k=a%k b%k=a%k
call psb_spinfo(psb_nztotreq_,a,size_req,info) call psb_spinfo(psb_nztotreq_,a,size_req,info)
if (debug) write(0,*) 'DCSDP : size_req 1:',size_req if (debug) write(0,*) 'DCSDP : size_req 1:',size_req
!! PULL IUP FROM INFOA FIELD !
iup = iand(b%infoa(psb_upd_),4) iup = psb_sp_getifld(psb_upd_,b,info)
if (iup > 0) then if (iup == psb_upd_perm_) then
up = 'Y' up = 'Y'
else else
up = 'N' up = 'N'
endif endif
n_row=b%m n_row=b%m
n_col=b%k n_col=b%k
call psb_cest(b%fida, n_row,n_col,size_req,& call psb_cest(b%fida, n_row,n_col,size_req,&
@ -191,11 +193,11 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
b%pr(:) = 0 b%pr(:) = 0
select case (a%fida(1:3)) select case (toupper(a%fida(1:3)))
case ('CSR') case ('CSR')
select case (b%fida(1:3)) select case (toupper(b%fida(1:3)))
case ('CSR') case ('CSR')
@ -271,7 +273,7 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
case ('COO','COI') case ('COO','COI')
select case (b%fida(1:3)) select case (toupper(b%fida(1:3)))
case ('CSR') case ('CSR')
@ -361,57 +363,59 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
else if (check_=='R') then else if (check_=='R') then
!...Regenerating matrix !...Regenerating matrix
if (b%infoa(psb_state_) /= psb_spmat_upd_) then if (psb_sp_getifld(psb_state_,b,info) /= psb_spmat_upd_) then
info = 8888
call psb_errpush(info,name)
goto 9999
endif
if (ibits(b%infoa(psb_upd_),2,1).eq.0) then
!
! Nothing to be done......
!
info = 8888 info = 8888
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
select case(psb_sp_getifld(psb_upd_,b,info))
case(psb_upd_perm_)
if (b%fida(1:3)/='JAD') then if (toupper(b%fida(1:3))/='JAD') then
ip1 = b%infoa(psb_upd_pnt_) ip1 = psb_sp_getifld(psb_upd_pnt_,b,info)
ip2 = b%ia2(ip1+psb_ip2_) ip2 = b%ia2(ip1+psb_ip2_)
nnz = b%ia2(ip1+psb_nnz_) nnz = b%ia2(ip1+psb_nnz_)
iflag = b%ia2(ip1+psb_iflag_) iflag = b%ia2(ip1+psb_iflag_)
ichk = b%ia2(ip1+psb_ichk_) ichk = b%ia2(ip1+psb_ichk_)
nnzt = b%ia2(ip1+psb_nnzt_) nnzt = b%ia2(ip1+psb_nnzt_)
if (debug) write(*,*) 'Regeneration start: ',& if (debug) write(*,*) 'Regeneration start: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt ,iflag,info & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt ,iflag,info
if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then
info = 8889 info = 8889
write(*,*) 'Regeneration start error: ',& write(*,*) 'Regeneration start error: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt ,iflag,ichk & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt ,iflag,ichk
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
do i= 1, nnz do i= 1, nnz
work(i) = 0.d0 work(i) = 0.d0
enddo enddo
if (iflag.eq.2) then select case(iflag)
case(psb_dupl_ovwrt_,psb_dupl_err_)
do i=1, nnz do i=1, nnz
work(b%ia2(ip2+i-1)) = b%aspk(i) work(b%ia2(ip2+i-1)) = b%aspk(i)
enddo enddo
else if (iflag.eq.3) then case(psb_dupl_add_)
do i=1, nnz do i=1, nnz
work(b%ia2(ip2+i-1)) = b%aspk(i) + work(b%ia2(ip2+i-1)) work(b%ia2(ip2+i-1)) = b%aspk(i) + work(b%ia2(ip2+i-1))
enddo enddo
endif case default
info = 8887
call psb_errpush(info,name)
goto 9999
end select
do i=1, nnz do i=1, nnz
b%aspk(i) = work(i) b%aspk(i) = work(i)
enddo enddo
else if (b%fida(1:3) == 'JAD') then else if (toupper(b%fida(1:3)) == 'JAD') then
ip1 = b%infoa(psb_upd_pnt_) ip1 = psb_sp_getifld(psb_upd_pnt_,b,info)
ip2 = b%ia1(ip1+psb_ip2_) ip2 = b%ia1(ip1+psb_ip2_)
count = b%ia1(ip1+psb_zero_) count = b%ia1(ip1+psb_zero_)
ipc = b%ia1(ip1+psb_ipc_) ipc = b%ia1(ip1+psb_ipc_)
@ -420,13 +424,13 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
ichk = b%ia1(ip1+psb_ichk_) ichk = b%ia1(ip1+psb_ichk_)
nnzt = b%ia1(ip1+psb_nnzt_) nnzt = b%ia1(ip1+psb_nnzt_)
if (debug) write(*,*) 'Regeneration start: ',& if (debug) write(*,*) 'Regeneration start: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt,count, & & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt,count, &
& iflag,info & iflag,info
if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then if ((ichk/=nnzt+iflag).or.(nnz/=nnzt)) then
info = 10 info = 10
write(*,*) 'Regeneration start error: ',& write(*,*) 'Regeneration start error: ',&
& b%infoa(psb_upd_),psb_perm_update_,nnz,nnzt ,iflag,ichk & b%infoa(psb_upd_),psb_upd_perm_,nnz,nnzt ,iflag,ichk
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
@ -434,15 +438,21 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
do i= 1, nnz+count do i= 1, nnz+count
work(i) = 0.d0 work(i) = 0.d0
enddo enddo
if (iflag.eq.2) then select case(iflag)
case(psb_dupl_ovwrt_,psb_dupl_err_)
do i=1, nnz do i=1, nnz
work(b%ia1(ip2+i-1)) = b%aspk(i) work(b%ia1(ip2+i-1)) = b%aspk(i)
enddo enddo
else if (iflag.eq.3) then case(psb_dupl_add_)
do i=1, nnz do i=1, nnz
work(b%ia1(ip2+i-1)) = b%aspk(i) + work(b%ia1(ip2+i-1)) work(b%ia1(ip2+i-1)) = b%aspk(i) + work(b%ia1(ip2+i-1))
enddo enddo
endif case default
info = 8887
call psb_errpush(info,name)
goto 9999
end select
do i=1, nnz+count do i=1, nnz+count
b%aspk(i) = work(i) b%aspk(i) = work(i)
enddo enddo
@ -451,9 +461,18 @@ subroutine psb_zcsdp(a, b,info,ifc,check,trans,unitd)
end do end do
endif endif
case(psb_upd_dflt_,psb_upd_srch_)
! Nothing to be done
case default
! Wrong value
info = 8888
call psb_errpush(info,name)
goto 9999
end select
end if end if
b%infoa(psb_state_) = psb_spmat_asb_ call psb_sp_setifld(psb_spmat_asb_,psb_state_,b,info)
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return

@ -45,7 +45,7 @@
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
! jblck - integer(optional). First col of submatrix belonging to blck to be inserted. ! jblck - integer(optional). First col of submatrix belonging to blck to be inserted.
subroutine psb_dins(m, n, x, ix, jx, blck, desc_a, info,& subroutine psb_dins(m, n, x, ix, jx, blck, desc_a, info,&
& iblck, jblck) & iblck, jblck,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -61,12 +61,13 @@ subroutine psb_dins(m, n, x, ix, jx, blck, desc_a, info,&
real(kind(1.d0)), intent(in) :: blck(:,:) real(kind(1.d0)), intent(in) :: blck(:,:)
integer,intent(out) :: info integer,intent(out) :: info
integer, optional, intent(in) :: iblck,jblck integer, optional, intent(in) :: iblck,jblck
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,row,k,err_act,& integer :: icontxt,i,loc_row,glob_row,row,k,err_act,&
& nprocs,mode, loc_cols,col,iblock, jblock, mglob, int_err(5), err & nprocs,mode, loc_cols,col,iblock, jblock, mglob, int_err(5), err
integer :: nprow,npcol, me ,mypcol integer :: nprow,npcol, me ,mypcol,dupl_
character :: temp_descra*11,temp_fida*5 character :: temp_descra*11,temp_fida*5
character(len=20) :: name, char_err character(len=20) :: name, char_err
@ -161,7 +162,32 @@ subroutine psb_dins(m, n, x, ix, jx, blck, desc_a, info,&
else else
jblock = 1 jblock = 1
endif endif
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
do col = 1, n
x(loc_row,jx+col-1) = blck(iblock+i-1,jblock+col-1)
enddo
end if
enddo
case(psb_dupl_add_)
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -177,6 +203,11 @@ subroutine psb_dins(m, n, x, ix, jx, blck, desc_a, info,&
enddo enddo
end if end if
enddo enddo
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return
@ -240,7 +271,7 @@ end subroutine psb_dins
! info - integer. Eventually returns an error code ! info - integer. Eventually returns an error code
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
subroutine psb_dinsvm(m, x, ix, jx, blck, desc_a,info,& subroutine psb_dinsvm(m, x, ix, jx, blck, desc_a,info,&
& iblck) & iblck,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -265,10 +296,11 @@ subroutine psb_dinsvm(m, x, ix, jx, blck, desc_a,info,&
real(kind(1.d0)), intent(in) :: blck(:) real(kind(1.d0)), intent(in) :: blck(:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,loc_cols,mglob,err_act, int_err(5),err integer :: icontxt,i,loc_row,glob_row,loc_cols,mglob,err_act, int_err(5),err
integer :: nprow,npcol, me ,mypcol, iblock integer :: nprow,npcol, me ,mypcol, iblock, dupl_
character(len=20) :: name, char_err character(len=20) :: name, char_err
if(psb_get_errstatus().ne.0) return if(psb_get_errstatus().ne.0) return
@ -352,6 +384,14 @@ subroutine psb_dinsvm(m, x, ix, jx, blck, desc_a,info,&
iblock = 1 iblock = 1
endif endif
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -363,10 +403,29 @@ subroutine psb_dinsvm(m, x, ix, jx, blck, desc_a,info,&
if (loc_row.ge.1) then if (loc_row.ge.1) then
! this row belongs to me ! this row belongs to me
! copy i-th row of block blck in x ! copy i-th row of block blck in x
x(loc_row,jx) = x(loc_row,jx) + blck(iblock+i-1) x(loc_row,jx) = blck(iblock+i-1)
end if end if
enddo enddo
case(psb_dupl_add_)
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
x(loc_row,jx) = x(loc_row,jx) + blck(iblock+i-1)
end if
enddo
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return
@ -427,7 +486,7 @@ end subroutine psb_dinsvm
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
! insflag - integer(optional). ??? ! insflag - integer(optional). ???
subroutine psb_dinsvv(m, x, ix, blck, desc_a, info,& subroutine psb_dinsvv(m, x, ix, blck, desc_a, info,&
& iblck,insflag) & iblck,insflag,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -450,11 +509,12 @@ subroutine psb_dinsvv(m, x, ix, blck, desc_a, info,&
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: insflag integer, optional, intent(in) :: insflag
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,row,k,& integer :: icontxt,i,loc_row,glob_row,row,k,&
& loc_rows,loc_cols,iblock, liflag,mglob,err_act, int_err(5), err & loc_rows,loc_cols,iblock, liflag,mglob,err_act, int_err(5), err
integer :: nprow,npcol, me ,mypcol integer :: nprow,npcol, me ,mypcol,dupl_
character(len=20) :: name, char_err character(len=20) :: name, char_err
if(psb_get_errstatus().ne.0) return if(psb_get_errstatus().ne.0) return
@ -528,7 +588,40 @@ subroutine psb_dinsvv(m, x, ix, blck, desc_a, info,&
else else
liflag = psb_upd_glbnum_ liflag = psb_upd_glbnum_
end if end if
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
if (liflag == psb_upd_glbnum_) then
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
x(loc_row) = blck(iblock+i-1)
end if
enddo
else if (liflag == psb_upd_locnum_) then
k = min(ix+m-1,loc_rows)
do i=ix,k
x(i) = blck(i-ix+1)
enddo
else
info=-1
call psb_errpush(info,name)
goto 9999
endif
case(psb_dupl_add_)
if (liflag == psb_upd_glbnum_) then if (liflag == psb_upd_glbnum_) then
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -554,6 +647,11 @@ subroutine psb_dinsvv(m, x, ix, blck, desc_a, info,&
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return

@ -42,7 +42,7 @@
! up - character(optional). ??? ! up - character(optional). ???
! dup - integer(optional). ??? ! dup - integer(optional). ???
! !
subroutine psb_dspasb(a,desc_a, info, afmt, up, dup) subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl)
use psb_descriptor_type use psb_descriptor_type
use psb_spmat_type use psb_spmat_type
@ -50,33 +50,25 @@ subroutine psb_dspasb(a,desc_a, info, afmt, up, dup)
use psb_const_mod use psb_const_mod
use psi_mod use psi_mod
use psb_error_mod use psb_error_mod
use psb_string_mod
implicit none implicit none
interface psb_cest
subroutine psb_cest(afmt, m,n,nnz, lia1, lia2, lar, up, info)
integer, intent(in) :: m,n,nnz
integer, intent(out) :: lia1, lia2, lar, info
character, intent(inout) :: afmt*5
character, intent(in) :: up
end subroutine psb_cest
end interface
!...Parameters.... !...Parameters....
type(psb_dspmat_type), intent (inout) :: a type(psb_dspmat_type), intent (inout) :: a
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
integer, intent(out) :: info integer, intent(out) :: info
integer,optional, intent(in) :: dup integer,optional, intent(in) :: dupl, upd
character, optional, intent(in) :: afmt*5, up character, optional, intent(in) :: afmt*5
!....Locals.... !....Locals....
integer :: int_err(5) integer :: int_err(5)
type(psb_dspmat_type) :: atemp type(psb_dspmat_type) :: atemp
real(kind(1.d0)) :: real_err(5) real(kind(1.d0)) :: real_err(5)
integer :: ia1_size,ia2_size,aspk_size,m,i,err,& integer :: ia1_size,ia2_size,aspk_size,m,i,err,&
& nprow,npcol,myrow,mycol ,size_req,idup,n_col,iout, err_act & nprow,npcol,myrow,mycol ,size_req,n_col,iout, err_act
integer :: dscstate, spstate, nr,k,j, iupdup integer :: dscstate, spstate, nr,k,j
integer :: upd_, dupl_
integer :: icontxt,temp(2),isize(2),n_row integer :: icontxt,temp(2),isize(2),n_row
character :: iup
logical, parameter :: debug=.false., debugwrt=.false. logical, parameter :: debug=.false., debugwrt=.false.
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
@ -126,38 +118,27 @@ subroutine psb_dspasb(a,desc_a, info, afmt, up, dup)
! !
! Second step: handle the local matrix part. ! Second step: handle the local matrix part.
! !
iupdup = 0 if (present(upd)) then
if (present(up)) then upd_=upd
if(up.eq.'Y') then
iupdup = 4
iup = up
else if (up /= 'N') then
write(0,*)'Wrong value for update input in ASB...'
write(0,*)'Changing to default'
iup = 'N'
else else
iup = 'N' upd_ = psb_upd_dflt_
endif
else
iup = 'N'
endif endif
if (present(dup)) then if (present(dupl)) then
if((dup.lt.1).or.(dup.gt.3)) then if((dupl < psb_dupl_ovwrt_).or.(dupl > psb_dupl_err_)) then
write(0,*)'Wrong value for duplicate input in ASB...' write(0,*)'Wrong value for duplicate input in ASB...'
write(0,*)'Changing to default' write(0,*)'Changing to default'
idup = 1 dupl_ = psb_dupl_def_
else else
idup = dup dupl_ = dupl
endif endif
else else
idup = 1 dupl_ = psb_dupl_def_
endif endif
iupdup = ieor(iupdup,idup)
a%infoa(psb_upd_)=iupdup call psb_sp_setifld(upd_,psb_upd_,a,info)
if (debug) write(0,*)'in ASB',psb_upd_,iupdup call psb_sp_setifld(dupl_,psb_dupl_,a,info)
a%m = n_row a%m = n_row
a%k = n_col a%k = n_col
@ -170,39 +151,13 @@ subroutine psb_dspasb(a,desc_a, info, afmt, up, dup)
goto 9999 goto 9999
! convert to user requested format after the temp copy ! convert to user requested format after the temp copy
end if end if
if (present(afmt)) then if (present(afmt)) then
a%fida = afmt a%fida = afmt
else else
a%fida = '???' a%fida = '???'
endif endif
!
! work area requested must be fixed to
! No of Grid'd processes and NNZ+2
!
!!$ size_req = max(a%infoa(psb_nnz_),1)+3
!!$ if (debug) write(0,*) 'DCSDP : size_req 1:',size_req
!!$ call psb_cest(a%fida, n_row,n_col,size_req,&
!!$ & ia1_size, ia2_size, aspk_size, iup,info)
!!$ write(0,*) 'ESTIMATE : ',ia1_size,ia2_size,aspk_Size,iup
!!$ if (info /= no_err) then
!!$ info=4010
!!$ ch_err='psb_cest'
!!$ call psb_errpush(info,name,a_err=ch_err)
!!$ goto 9999
!!$ endif
!!$
!!$ call psb_sp_reall(a,ia1_size,ia2_size,aspk_size,info)
!!$ if (info /= no_err) then
!!$ info=4010
!!$ ch_err='psb_sp_reall'
!!$ call psb_errpush(info,name,a_err=ch_err)
!!$ goto 9999
!!$ endif
!!$
!!$ a%pl(:) = 0
!!$ a%pr(:) = 0
if (debugwrt) then if (debugwrt) then
iout = 30+myrow iout = 30+myrow
open(iout) open(iout)
@ -210,7 +165,7 @@ subroutine psb_dspasb(a,desc_a, info, afmt, up, dup)
close(iout) close(iout)
endif endif
! Do the real conversion into the requested storage formatmode ! Do the real conversion into the requested storage format
! result is put in A ! result is put in A
call psb_csdp(atemp,a,info,ifc=2) call psb_csdp(atemp,a,info,ifc=2)

@ -86,10 +86,12 @@ Subroutine psb_dsprn(a, desc_a,info)
goto 9999 goto 9999
endif endif
if (a%infoa(psb_state_) == psb_spmat_asb_) then select case(psb_sp_getifld(psb_state_,a,info))
case(psb_spmat_asb_)
a%aspk(:) = dzero a%aspk(:) = dzero
if (ibits(a%infoa(psb_upd_),2,1)==1) then
if (psb_sp_getifld(psb_upd_,a,info)==psb_upd_perm_) then
if(a%fida(1:3).eq.'JAD') then if(a%fida(1:3).eq.'JAD') then
a%ia1(a%infoa(psb_upd_pnt_)+psb_nnz_) = 0 a%ia1(a%infoa(psb_upd_pnt_)+psb_nnz_) = 0
else else
@ -97,16 +99,17 @@ Subroutine psb_dsprn(a, desc_a,info)
endif endif
endif endif
a%infoa(psb_state_) = psb_spmat_upd_ a%infoa(psb_state_) = psb_spmat_upd_
else if (a%infoa(psb_state_) == psb_spmat_bld_) then case(psb_spmat_bld_)
! in this case do nothing. this allows sprn to be called ! in this case do nothing. this allows sprn to be called
! right after allocate, with spins doing the right thing. ! right after allocate, with spins doing the right thing.
! hopefully :-) ! hopefully :-)
else if (a%infoa(psb_state_) == psb_spmat_upd_) then
else case( psb_spmat_upd_)
case default
info=591 info=591
call psb_errpush(info,name) call psb_errpush(info,name)
endif end select
if (info /= 0) goto 9999 if (info /= 0) goto 9999

@ -45,7 +45,7 @@
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
! jblck - integer(optional). First col of submatrix belonging to blck to be inserted. ! jblck - integer(optional). First col of submatrix belonging to blck to be inserted.
subroutine psb_iins(m, n, x, ix, jx, blck, desc_a, info,& subroutine psb_iins(m, n, x, ix, jx, blck, desc_a, info,&
& iblck, jblck) & iblck, jblck,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -60,11 +60,12 @@ subroutine psb_iins(m, n, x, ix, jx, blck, desc_a, info,&
integer, intent(in) :: blck(:,:) integer, intent(in) :: blck(:,:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck,jblck integer, optional, intent(in) :: iblck,jblck
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,& integer :: icontxt,i,loc_row,glob_row,&
& loc_cols,col,iblock, jblock, mglob & loc_cols,col,iblock, jblock, mglob,dupl_
integer :: nprow,npcol, myrow ,mycol, int_err(5),err_act integer :: nprow,npcol, myrow ,mycol, int_err(5),err_act
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
@ -161,7 +162,30 @@ subroutine psb_iins(m, n, x, ix, jx, blck, desc_a, info,&
else else
jblock = 1 jblock = 1
endif endif
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
do col = 1, n
x(loc_row,jx+col-1) = blck(iblock+i-1,jblock+col-1)
enddo
end if
enddo
case(psb_dupl_add_)
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -177,6 +201,11 @@ subroutine psb_iins(m, n, x, ix, jx, blck, desc_a, info,&
enddo enddo
end if end if
enddo enddo
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return
@ -238,7 +267,7 @@ end subroutine psb_iins
! info - integer. Eventually returns an error code ! info - integer. Eventually returns an error code
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
subroutine psb_iinsvm(m, x, ix, jx, blck, desc_a, info,& subroutine psb_iinsvm(m, x, ix, jx, blck, desc_a, info,&
& iblck) & iblck,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -263,11 +292,12 @@ subroutine psb_iinsvm(m, x, ix, jx, blck, desc_a, info,&
integer, intent(in) :: blck(:) integer, intent(in) :: blck(:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,& integer :: icontxt,i,loc_row,glob_row,&
& loc_cols,iblock, jblock,mglob, err_act, int_err(5) & loc_cols,iblock, jblock,mglob, err_act, int_err(5)
integer :: nprow,npcol, myrow ,mycol integer :: nprow,npcol, myrow ,mycol,dupl_
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
if(psb_get_errstatus().ne.0) return if(psb_get_errstatus().ne.0) return
@ -285,6 +315,29 @@ subroutine psb_iinsvm(m, x, ix, jx, blck, desc_a, info,&
iblock = 1 iblock = 1
endif endif
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
x(loc_row,jx) = blck(iblock+i-1)
end if
enddo
case(psb_dupl_add_)
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -299,6 +352,11 @@ subroutine psb_iinsvm(m, x, ix, jx, blck, desc_a, info,&
x(loc_row,jx) = x(loc_row,jx) + blck(iblock+i-1) x(loc_row,jx) = x(loc_row,jx) + blck(iblock+i-1)
end if end if
enddo enddo
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return
@ -356,7 +414,7 @@ end subroutine psb_iinsvm
! info - integer. Eventually returns an error code ! info - integer. Eventually returns an error code
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
subroutine psb_iinsvv(m, x, ix, blck, desc_a, info,& subroutine psb_iinsvv(m, x, ix, blck, desc_a, info,&
& iblck) & iblck,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -378,11 +436,12 @@ subroutine psb_iinsvv(m, x, ix, blck, desc_a, info,&
integer, intent(in) :: blck(:) integer, intent(in) :: blck(:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,k,& integer :: icontxt,i,loc_row,glob_row,k,&
& loc_rows,loc_cols,col,iblock, jblock, mglob, err_act, int_err(5) & loc_rows,loc_cols,col,iblock, jblock, mglob, err_act, int_err(5)
integer :: nprow,npcol, myrow ,mycol integer :: nprow,npcol, myrow ,mycol,dupl_
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
if(psb_get_errstatus().ne.0) return if(psb_get_errstatus().ne.0) return
@ -451,7 +510,30 @@ subroutine psb_iinsvv(m, x, ix, blck, desc_a, info,&
else else
iblock = 1 iblock = 1
endif endif
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
x(loc_row) = blck(iblock+i-1)
end if
enddo
case(psb_dupl_add_)
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -466,6 +548,11 @@ subroutine psb_iinsvv(m, x, ix, blck, desc_a, info,&
x(loc_row) = x(loc_row) + blck(iblock+i-1) x(loc_row) = x(loc_row) + blck(iblock+i-1)
end if end if
enddo enddo
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return

@ -45,7 +45,7 @@
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
! jblck - integer(optional). First col of submatrix belonging to blck to be inserted. ! jblck - integer(optional). First col of submatrix belonging to blck to be inserted.
subroutine psb_zins(m, n, x, ix, jx, blck, desc_a, info,& subroutine psb_zins(m, n, x, ix, jx, blck, desc_a, info,&
& iblck, jblck) & iblck, jblck,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -61,12 +61,13 @@ subroutine psb_zins(m, n, x, ix, jx, blck, desc_a, info,&
complex(kind(1.d0)), intent(in) :: blck(:,:) complex(kind(1.d0)), intent(in) :: blck(:,:)
integer,intent(out) :: info integer,intent(out) :: info
integer, optional, intent(in) :: iblck,jblck integer, optional, intent(in) :: iblck,jblck
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,row,k,err_act,& integer :: icontxt,i,loc_row,glob_row,row,k,err_act,&
& nprocs,mode, loc_cols,col,iblock, jblock, mglob, int_err(5), err & nprocs,mode, loc_cols,col,iblock, jblock, mglob, int_err(5), err
integer :: nprow,npcol, me ,mypcol integer :: nprow,npcol, me ,mypcol,dupl_
character :: temp_descra*11,temp_fida*5 character :: temp_descra*11,temp_fida*5
character(len=20) :: name, char_err character(len=20) :: name, char_err
@ -161,7 +162,30 @@ subroutine psb_zins(m, n, x, ix, jx, blck, desc_a, info,&
else else
jblock = 1 jblock = 1
endif endif
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
do col = 1, n
x(loc_row,jx+col-1) = blck(iblock+i-1,jblock+col-1)
enddo
end if
enddo
case(psb_dupl_add_)
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -177,6 +201,11 @@ subroutine psb_zins(m, n, x, ix, jx, blck, desc_a, info,&
enddo enddo
end if end if
enddo enddo
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return
@ -240,7 +269,7 @@ end subroutine psb_zins
! info - integer. Eventually returns an error code ! info - integer. Eventually returns an error code
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
subroutine psb_zinsvm(m, x, ix, jx, blck, desc_a,info,& subroutine psb_zinsvm(m, x, ix, jx, blck, desc_a,info,&
& iblck) & iblck,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -265,10 +294,11 @@ subroutine psb_zinsvm(m, x, ix, jx, blck, desc_a,info,&
complex(kind(1.d0)), intent(in) :: blck(:) complex(kind(1.d0)), intent(in) :: blck(:)
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,loc_cols,mglob,err_act, int_err(5),err integer :: icontxt,i,loc_row,glob_row,loc_cols,mglob,err_act, int_err(5),err
integer :: nprow,npcol, me ,mypcol, iblock integer :: nprow,npcol, me ,mypcol, iblock,dupl_
character(len=20) :: name, char_err character(len=20) :: name, char_err
if(psb_get_errstatus().ne.0) return if(psb_get_errstatus().ne.0) return
@ -351,7 +381,29 @@ subroutine psb_zinsvm(m, x, ix, jx, blck, desc_a,info,&
else else
iblock = 1 iblock = 1
endif endif
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
x(loc_row,jx) = blck(iblock+i-1)
end if
enddo
case(psb_dupl_add_)
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -366,6 +418,11 @@ subroutine psb_zinsvm(m, x, ix, jx, blck, desc_a,info,&
x(loc_row,jx) = x(loc_row,jx) + blck(iblock+i-1) x(loc_row,jx) = x(loc_row,jx) + blck(iblock+i-1)
end if end if
enddo enddo
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return
@ -427,7 +484,7 @@ end subroutine psb_zinsvm
! iblck - integer(optional). First row of submatrix belonging to blck to be inserted. ! iblck - integer(optional). First row of submatrix belonging to blck to be inserted.
! insflag - integer(optional). ??? ! insflag - integer(optional). ???
subroutine psb_zinsvv(m, x, ix, blck, desc_a, info,& subroutine psb_zinsvv(m, x, ix, blck, desc_a, info,&
& iblck,insflag) & iblck,insflag,dupl)
!....insert dense submatrix to dense matrix ..... !....insert dense submatrix to dense matrix .....
use psb_descriptor_type use psb_descriptor_type
use psb_const_mod use psb_const_mod
@ -450,11 +507,12 @@ subroutine psb_zinsvv(m, x, ix, blck, desc_a, info,&
integer, intent(out) :: info integer, intent(out) :: info
integer, optional, intent(in) :: iblck integer, optional, intent(in) :: iblck
integer, optional, intent(in) :: insflag integer, optional, intent(in) :: insflag
integer, optional, intent(in) :: dupl
!locals..... !locals.....
integer :: icontxt,i,loc_row,glob_row,row,k,& integer :: icontxt,i,loc_row,glob_row,row,k,&
& loc_rows,loc_cols,iblock, liflag,mglob,err_act, int_err(5), err & loc_rows,loc_cols,iblock, liflag,mglob,err_act, int_err(5), err
integer :: nprow,npcol, me ,mypcol integer :: nprow,npcol, me ,mypcol,dupl_
character(len=20) :: name, char_err character(len=20) :: name, char_err
if(psb_get_errstatus().ne.0) return if(psb_get_errstatus().ne.0) return
@ -528,7 +586,41 @@ subroutine psb_zinsvv(m, x, ix, blck, desc_a, info,&
else else
liflag = psb_upd_glbnum_ liflag = psb_upd_glbnum_
end if end if
if (present(dupl)) then
dupl_ = dupl
else
dupl_ = psb_dupl_ovwrt_
endif
select case(dupl_)
case(psb_dupl_ovwrt_)
if (liflag == psb_upd_glbnum_) then
do i = 1, m
!loop over all blck's rows
! row actual block row
glob_row=ix+i-1
if (glob_row > mglob) exit
loc_row=desc_a%glob_to_loc(glob_row)
if (loc_row.ge.1) then
! this row belongs to me
! copy i-th row of block blck in x
x(loc_row) = blck(iblock+i-1)
end if
enddo
else if (liflag == psb_upd_locnum_) then
k = min(ix+m-1,loc_rows)
do i=ix,k
x(i) = blck(i-ix+1)
enddo
else
info=-1
call psb_errpush(info,name)
goto 9999
endif
case(psb_dupl_add_)
if (liflag == psb_upd_glbnum_) then if (liflag == psb_upd_glbnum_) then
do i = 1, m do i = 1, m
!loop over all blck's rows !loop over all blck's rows
@ -554,6 +646,11 @@ subroutine psb_zinsvv(m, x, ix, blck, desc_a, info,&
call psb_errpush(info,name) call psb_errpush(info,name)
goto 9999 goto 9999
endif endif
case default
info = 321
call psb_errpush(info,name)
goto 9999
end select
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return

@ -42,7 +42,7 @@
! up - character(optional). ??? ! up - character(optional). ???
! dup - integer(optional). ??? ! dup - integer(optional). ???
! !
subroutine psb_zspasb(a,desc_a, info, afmt, up, dup) subroutine psb_zspasb(a,desc_a, info, afmt, upd, dupl)
use psb_descriptor_type use psb_descriptor_type
use psb_spmat_type use psb_spmat_type
@ -50,33 +50,25 @@ subroutine psb_zspasb(a,desc_a, info, afmt, up, dup)
use psb_const_mod use psb_const_mod
use psi_mod use psi_mod
use psb_error_mod use psb_error_mod
use psb_string_mod
implicit none implicit none
interface psb_cest
subroutine psb_cest(afmt, m,n,nnz, lia1, lia2, lar, up, info)
integer, intent(in) :: m,n,nnz
integer, intent(out) :: lia1, lia2, lar, info
character, intent(inout) :: afmt*5
character, intent(in) :: up
end subroutine psb_cest
end interface
!...Parameters.... !...Parameters....
type(psb_zspmat_type), intent (inout) :: a type(psb_zspmat_type), intent (inout) :: a
type(psb_desc_type), intent(in) :: desc_a type(psb_desc_type), intent(in) :: desc_a
integer, intent(out) :: info integer, intent(out) :: info
integer,optional, intent(in) :: dup integer,optional, intent(in) :: dupl, upd
character, optional, intent(in) :: afmt*5, up character, optional, intent(in) :: afmt*5
!....Locals.... !....Locals....
integer :: int_err(5) integer :: int_err(5)
type(psb_zspmat_type) :: atemp type(psb_zspmat_type) :: atemp
real(kind(1.d0)) :: real_err(5) real(kind(1.d0)) :: real_err(5)
integer :: ia1_size,ia2_size,aspk_size,m,i,err,& integer :: ia1_size,ia2_size,aspk_size,m,i,err,&
& nprow,npcol,myrow,mycol ,size_req,idup,n_col,iout, err_act & nprow,npcol,myrow,mycol ,size_req,n_col,iout, err_act
integer :: dscstate, spstate, nr,k,j, iupdup integer :: dscstate, spstate, nr,k,j
integer :: upd_, dupl_
integer :: icontxt,temp(2),isize(2),n_row integer :: icontxt,temp(2),isize(2),n_row
character :: iup
logical, parameter :: debug=.false., debugwrt=.false. logical, parameter :: debug=.false., debugwrt=.false.
character(len=20) :: name, ch_err character(len=20) :: name, ch_err
@ -126,38 +118,27 @@ subroutine psb_zspasb(a,desc_a, info, afmt, up, dup)
! !
! Second step: handle the local matrix part. ! Second step: handle the local matrix part.
! !
iupdup = 0 if (present(upd)) then
if (present(up)) then upd_=upd
if(up.eq.'Y') then
iupdup = 4
iup = up
else if (up /= 'N') then
write(0,*)'Wrong value for update input in ASB...'
write(0,*)'Changing to default'
iup = 'N'
else else
iup = 'N' upd_ = psb_upd_dflt_
endif
else
iup = 'N'
endif endif
if (present(dup)) then if (present(dupl)) then
if((dup.lt.1).or.(dup.gt.3)) then if((dupl < psb_dupl_ovwrt_).or.(dupl > psb_dupl_err_)) then
write(0,*)'Wrong value for duplicate input in ASB...' write(0,*)'Wrong value for duplicate input in ASB...'
write(0,*)'Changing to default' write(0,*)'Changing to default'
idup = 1 dupl_ = psb_dupl_def_
else else
idup = dup dupl_ = dupl
endif endif
else else
idup = 1 dupl_ = psb_dupl_def_
endif endif
iupdup = ieor(iupdup,idup)
a%infoa(psb_upd_)=iupdup call psb_sp_setifld(upd_,psb_upd_,a,info)
if (debug) write(0,*)'in ASB',psb_upd_,iupdup call psb_sp_setifld(dupl_,psb_dupl_,a,info)
a%m = n_row a%m = n_row
a%k = n_col a%k = n_col
@ -170,39 +151,13 @@ subroutine psb_zspasb(a,desc_a, info, afmt, up, dup)
goto 9999 goto 9999
! convert to user requested format after the temp copy ! convert to user requested format after the temp copy
end if end if
if (present(afmt)) then if (present(afmt)) then
a%fida = afmt a%fida = afmt
else else
a%fida = '???' a%fida = '???'
endif endif
!
! work area requested must be fixed to
! No of Grid'd processes and NNZ+2
!
!!$ size_req = max(a%infoa(psb_nnz_),1)+3
!!$ if (debug) write(0,*) 'DCSDP : size_req 1:',size_req
!!$ call psb_cest(a%fida, n_row,n_col,size_req,&
!!$ & ia1_size, ia2_size, aspk_size, iup,info)
!!$ write(0,*) 'ESTIMATE : ',ia1_size,ia2_size,aspk_Size,iup
!!$ if (info /= no_err) then
!!$ info=4010
!!$ ch_err='psb_cest'
!!$ call psb_errpush(info,name,a_err=ch_err)
!!$ goto 9999
!!$ endif
!!$
!!$ call psb_sp_reall(a,ia1_size,ia2_size,aspk_size,info)
!!$ if (info /= no_err) then
!!$ info=4010
!!$ ch_err='psb_sp_reall'
!!$ call psb_errpush(info,name,a_err=ch_err)
!!$ goto 9999
!!$ endif
!!$
!!$ a%pl(:) = 0
!!$ a%pr(:) = 0
if (debugwrt) then if (debugwrt) then
iout = 30+myrow iout = 30+myrow
open(iout) open(iout)
@ -210,7 +165,7 @@ subroutine psb_zspasb(a,desc_a, info, afmt, up, dup)
close(iout) close(iout)
endif endif
! Do the real conversion into the requested storage formatmode ! Do the real conversion into the requested storage format
! result is put in A ! result is put in A
call psb_csdp(atemp,a,info,ifc=2) call psb_csdp(atemp,a,info,ifc=2)

@ -420,7 +420,7 @@ contains
call blacs_barrier(icontxt,'all') call blacs_barrier(icontxt,'all')
t2 = mpi_wtime() t2 = mpi_wtime()
call psb_spasb(a,desc_a,info,dup=1,afmt=afmt) call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,afmt=afmt)
t3 = mpi_wtime() t3 = mpi_wtime()
if(info/=0)then if(info/=0)then
info=4010 info=4010
@ -437,7 +437,7 @@ contains
else else
call psb_spasb(a,desc_a,info,afmt=afmt,dup=1) call psb_spasb(a,desc_a,info,afmt=afmt,dupl=psb_dupl_err_)
if(info/=0)then if(info/=0)then
info=4010 info=4010
ch_err='psspasb' ch_err='psspasb'
@ -780,7 +780,7 @@ contains
call blacs_barrier(icontxt,'all') call blacs_barrier(icontxt,'all')
t2 = mpi_wtime() t2 = mpi_wtime()
call psb_spasb(a,desc_a,info,dup=1,afmt=afmt) call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,afmt=afmt)
t3 = mpi_wtime() t3 = mpi_wtime()
if(info/=0)then if(info/=0)then
info=4010 info=4010
@ -1203,7 +1203,7 @@ contains
call blacs_barrier(icontxt,'all') call blacs_barrier(icontxt,'all')
t2 = mpi_wtime() t2 = mpi_wtime()
call psb_spasb(a,desc_a,info,dup=1,afmt=afmt) call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,afmt=afmt)
t3 = mpi_wtime() t3 = mpi_wtime()
if(info/=0)then if(info/=0)then
info=4010 info=4010
@ -1220,7 +1220,7 @@ contains
else else
call psb_spasb(a,desc_a,info,afmt=afmt,dup=1) call psb_spasb(a,desc_a,info,afmt=afmt,dupl=psb_dupl_err_)
if(info/=0)then if(info/=0)then
info=4010 info=4010
ch_err='psspasb' ch_err='psspasb'
@ -1563,7 +1563,7 @@ contains
call blacs_barrier(icontxt,'all') call blacs_barrier(icontxt,'all')
t2 = mpi_wtime() t2 = mpi_wtime()
call psb_spasb(a,desc_a,info,dup=1,afmt=afmt) call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,afmt=afmt)
t3 = mpi_wtime() t3 = mpi_wtime()
if(info/=0)then if(info/=0)then
info=4010 info=4010

@ -667,7 +667,7 @@ contains
t1 = mpi_wtime() t1 = mpi_wtime()
call psb_cdasb(desc_a,info) call psb_cdasb(desc_a,info)
call psb_spasb(a,desc_a,info,dup=1,afmt=afmt) call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,afmt=afmt)
call blacs_barrier(icontxt,'ALL') call blacs_barrier(icontxt,'ALL')
tasb = mpi_wtime()-t1 tasb = mpi_wtime()-t1
if(info.ne.0) then if(info.ne.0) then

Loading…
Cancel
Save