base/serial/Makefile
 base/serial/aux/camsr.f90
 base/serial/aux/camsrx.f90
 base/serial/aux/dmsr.f90
 base/serial/aux/dmsrx.f90
 base/serial/aux/imsr.f90
 base/serial/aux/imsrx.f90
 base/serial/aux/smsr.f90
 base/serial/aux/smsrx.f90
 base/serial/aux/zamsr.f90
 base/serial/aux/zamsrx.f90
 base/serial/dp/Makefile
 base/serial/dp/ccoco.f
 base/serial/dp/ccocr.f
 base/serial/dp/dcoco.f
 base/serial/dp/dcocr.f
 base/serial/dp/djdcox.f
 base/serial/dp/reordvn.f
 base/serial/dp/scoco.f
 base/serial/dp/scocr.f
 base/serial/dp/zcoco.f
 base/serial/dp/zcocr.f
 base/serial/psb_cfixcoo.f90
 base/serial/psb_dfixcoo.f90
 base/serial/psb_ip_reord_mod.f90
 base/serial/psb_sfixcoo.f90
 base/serial/psb_zfixcoo.f90

Defined a new module ip_reord to handle reordering based on a
list-sort output; this will avoid future type mismatch, such as the
one causing trouble in the final mld2p4 testing for complex single
precision.
psblas3-type-indexed
Salvatore Filippone 17 years ago
parent 7f2074779d
commit 866cf36165

@ -26,7 +26,7 @@ FOBJS = psb_cest.o psb_dcoins.o psb_dcsmm.o psb_dcsmv.o \
psb_cgelp.o psb_cspgtdiag.o psb_cspgtblk.o psb_cspgetrow.o\ psb_cgelp.o psb_cspgtdiag.o psb_cspgtblk.o psb_cspgetrow.o\
psb_ccssm.o psb_ccssv.o psb_ccsmm.o psb_ccsmv.o psb_ctransp.o psb_ctransc.o\ psb_ccssm.o psb_ccssv.o psb_ccsmm.o psb_ccsmv.o psb_ctransp.o psb_ctransc.o\
psb_cspclip.o psb_crwextd.o psb_cspscal.o\ psb_cspclip.o psb_crwextd.o psb_cspscal.o\
psb_cnumbmm.o psb_csymbmm.o psb_cneigh.o psb_cnumbmm.o psb_csymbmm.o psb_cneigh.o psb_ip_reord_mod.o
# #
LIBDIR=.. LIBDIR=..
@ -43,8 +43,9 @@ lib1: $(FOBJS)
psb_scoins.o psb_dcoins.o psb_zcoins.o: psb_update_mod.o psb_scoins.o psb_dcoins.o psb_zcoins.o: psb_update_mod.o
psb_sspgetrow.o psb_dspgetrow.o psb_zspgetrow.o: psb_getrow_mod.o psb_sspgetrow.o psb_dspgetrow.o psb_zspgetrow.o: psb_getrow_mod.o
psb_sspcnv.o psb_dspcnv.o pzb_zspcnv.o: psb_regen_mod.o psb_sspcnv.o psb_dspcnv.o pzb_zspcnv.o: psb_regen_mod.o
psb_sfixcoo.o psb_dfixcoo.o psb_cfixcoo.o psb_zfixcoo.o: psb_ip_reord_mod.o
auxd: auxd: psb_ip_reord_mod.o
(cd aux; make lib) (cd aux; make lib)
cood: cood:
@ -56,7 +57,7 @@ csrd:
jadd: jadd:
(cd jad; make lib) (cd jad; make lib)
dpd: dpd: psb_ip_reord_mod.o
(cd dp; make lib) (cd dp; make lib)
f77d: f77d:

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine camsr(n,x,idir) subroutine camsr(n,x,idir)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n, idir integer :: n, idir
@ -63,25 +64,7 @@ subroutine camsr(n,x,idir)
call camsort_dw(n,x,iaux,iret) call camsort_dw(n,x,iaux,iret)
end if end if
if (iret == 0) then if (iret == 0) call psb_ip_reord(n,x,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine camsrx(n,x,indx,idir,flag) subroutine camsrx(n,x,indx,idir,flag)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n,idir,flag integer :: n,idir,flag
complex(psb_spk_) :: x(n) complex(psb_spk_) :: x(n)
@ -70,28 +71,7 @@ subroutine camsrx(n,x,indx,idir,flag)
call camsort_dw(n,x,iaux,iret) call camsort_dw(n,x,iaux,iret)
end if end if
if (iret /= 1) then if (iret == 0) call psb_ip_reord(n,x,indx,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine dmsr(n,x,idir) subroutine dmsr(n,x,idir)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n, idir integer :: n, idir
@ -64,25 +65,7 @@ subroutine dmsr(n,x,idir)
call dmsort_dw(n,x,iaux,iret) call dmsort_dw(n,x,iaux,iret)
end if end if
if (iret == 0) then if (iret == 0) call psb_ip_reord(n,x,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine dmsrx(n,x,indx,idir,flag) subroutine dmsrx(n,x,indx,idir,flag)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n,idir,flag integer :: n,idir,flag
real(psb_dpk_) :: x(n) real(psb_dpk_) :: x(n)
@ -71,28 +72,7 @@ subroutine dmsrx(n,x,indx,idir,flag)
call dmsort_dw(n,x,iaux,iret) call dmsort_dw(n,x,iaux,iret)
end if end if
if (iret /= 1) then if (iret == 0) call psb_ip_reord(n,x,indx,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine imsr(n,x,idir) subroutine imsr(n,x,idir)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n, idir integer :: n, idir
@ -63,25 +64,7 @@ subroutine imsr(n,x,idir)
call msort_dw(n,x,iaux,iret) call msort_dw(n,x,iaux,iret)
end if end if
if (iret == 0) then if (iret == 0) call psb_ip_reord(n,x,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
iswap = x(lp)
x(lp) = x(k)
x(k) = iswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine imsrx(n,x,indx,idir,flag) subroutine imsrx(n,x,indx,idir,flag)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n,idir,flag integer :: n,idir,flag
integer :: x(n) integer :: x(n)
@ -70,28 +71,7 @@ subroutine imsrx(n,x,indx,idir,flag)
call msort_dw(n,x,iaux,iret) call msort_dw(n,x,iaux,iret)
end if end if
if (iret /= 1) then if (iret == 0) call psb_ip_reord(n,x,indx,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
iswap = x(lp)
x(lp) = x(k)
x(k) = iswap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine smsr(n,x,idir) subroutine smsr(n,x,idir)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n, idir integer :: n, idir
@ -63,25 +64,7 @@ subroutine smsr(n,x,idir)
call smsort_dw(n,x,iaux,iret) call smsort_dw(n,x,iaux,iret)
end if end if
if (iret == 0) then if (iret == 0) call psb_ip_reord(n,x,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine smsrx(n,x,indx,idir,flag) subroutine smsrx(n,x,indx,idir,flag)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n,idir,flag integer :: n,idir,flag
real(psb_spk_) :: x(n) real(psb_spk_) :: x(n)
@ -70,28 +71,7 @@ subroutine smsrx(n,x,indx,idir,flag)
call smsort_dw(n,x,iaux,iret) call smsort_dw(n,x,iaux,iret)
end if end if
if (iret /= 1) then if (iret == 0) call psb_ip_reord(n,x,indx,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine zamsr(n,x,idir) subroutine zamsr(n,x,idir)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n, idir integer :: n, idir
@ -64,25 +65,7 @@ subroutine zamsr(n,x,idir)
call zamsort_dw(n,x,iaux,iret) call zamsort_dw(n,x,iaux,iret)
end if end if
if (iret == 0) then if (iret == 0) call psb_ip_reord(n,x,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -34,6 +34,7 @@
! Parameters: ! Parameters:
subroutine zamsrx(n,x,indx,idir,flag) subroutine zamsrx(n,x,indx,idir,flag)
use psb_serial_mod use psb_serial_mod
use psb_ip_reord_mod
implicit none implicit none
integer :: n,idir,flag integer :: n,idir,flag
complex(psb_dpk_) :: x(n) complex(psb_dpk_) :: x(n)
@ -70,28 +71,7 @@ subroutine zamsrx(n,x,indx,idir,flag)
call zamsort_dw(n,x,iaux,iret) call zamsort_dw(n,x,iaux,iret)
end if end if
if (iret /= 1) then if (iret == 0) call psb_ip_reord(n,x,indx,iaux)
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
end if
deallocate(iaux,stat=info) deallocate(iaux,stat=info)
if (info/=0) then if (info/=0) then

@ -6,7 +6,7 @@ include ../../../Make.inc
FOBJS = dcrcr.o dcrjd.o dgblock.o partition.o \ FOBJS = dcrcr.o dcrjd.o dgblock.o partition.o \
dgindex.o djadrp.o djadrp1.o dcsrrp.o dcsrp1.o check_dim.o \ dgindex.o djadrp.o djadrp1.o dcsrrp.o dcsrp1.o check_dim.o \
Max_nnzero.o dcoco.o dcocr.o dcrco.o djdcox.o djdco.o dvtfg.o dgind_tri.o \ Max_nnzero.o dcoco.o dcocr.o dcrco.o djdcox.o djdco.o dvtfg.o dgind_tri.o \
gen_block.o reordvn.o\ gen_block.o\
scrjd.o scrco.o scrcr.o scocr.o scoco.o sgindex.o sgind_tri.o\ scrjd.o scrco.o scrcr.o scocr.o scoco.o sgindex.o sgind_tri.o\
ccoco.o ccocr.o ccrco.o ccrcr.o ccrjd.o cgindex.o cgind_tri.o\ ccoco.o ccocr.o ccrco.o ccrcr.o ccrjd.o cgindex.o cgind_tri.o\
zcoco.o zcocr.o zcrco.o zcrcr.o zcrjd.o zgindex.o zgind_tri.o zcoco.o zcocr.o zcrco.o zcrcr.o zcrjd.o zgindex.o zgind_tri.o

@ -38,6 +38,7 @@ c
use psb_const_mod use psb_const_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
implicit none implicit none
c .. scalar arguments .. c .. scalar arguments ..
@ -155,8 +156,8 @@ c
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn,
+ call creordvn3(nnz,arn,ia1n,ia2n,aux(ipx),aux) + ia1n,ia2n,aux(ipx:),aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -168,8 +169,9 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) call creordvn3(nzl,arn(i),ia1n(i),ia2n(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux(ipx+i-1),aux) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),
+ aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -207,7 +209,9 @@ c ... sum the duplicated element ...
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) call creordvn(nnz,arn,ia1n,ia2n,aux) if (iret == 0) call psb_ip_reord(nzl,arn,
+ ia1n,ia2n,aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -219,8 +223,8 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) call creordvn(nzl,arn(i),ia1n(i),ia2n(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),aux)
i = j i = j
enddo enddo
c ... construct final COO representation... c ... construct final COO representation...

@ -40,6 +40,7 @@ C
use psb_error_mod use psb_error_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
IMPLICIT NONE IMPLICIT NONE
C C
@ -168,8 +169,9 @@ c
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nnz,arn,
+ call creordvn3(nnz,arn,itmp,ian1,aux(ipx),aux) + itmp,ian1,aux(ipx:),aux)
if (debug_level >= psb_debug_serial_) then if (debug_level >= psb_debug_serial_) then
do i=1, nnz-1 do i=1, nnz-1
if (itmp(i).gt.itmp(i+1)) then if (itmp(i).gt.itmp(i+1)) then
@ -194,8 +196,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) call creordvn3(nzl,arn(i),itmp(i),ian1(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux(ipx+i-1),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),
+ aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -258,7 +261,8 @@ c ... sum the duplicated element ...
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call creordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -271,8 +275,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call creordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -343,7 +348,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'U') THEN + psb_toupper(DESCRA(2:2)).EQ.'U') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call creordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -356,8 +362,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call creordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -416,7 +422,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'L') THEN + psb_toupper(DESCRA(2:2)).EQ.'L') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call creordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -429,8 +436,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call creordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo

@ -38,6 +38,7 @@ c
use psb_const_mod use psb_const_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
implicit none implicit none
c .. scalar arguments .. c .. scalar arguments ..
@ -155,7 +156,8 @@ c
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) call reordvn3(nnz,arn,ia1n,ia2n,aux(ipx),aux) if (iret == 0) call psb_ip_reord(nzl,arn,
+ ia1n,ia2n,aux(ipx:),aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -167,8 +169,9 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) call reordvn3(nzl,arn(i),ia1n(i),ia2n(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux(ipx+i-1),aux) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),
+ aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -206,7 +209,9 @@ c ... sum the duplicated element ...
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) call reordvn(nnz,arn,ia1n,ia2n,aux) if (iret == 0) call psb_ip_reord(nzl,arn,
+ ia1n,ia2n,aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -218,8 +223,8 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) call reordvn(nzl,arn(i),ia1n(i),ia2n(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),aux)
i = j i = j
enddo enddo
c ... construct final COO representation... c ... construct final COO representation...

@ -40,6 +40,7 @@ C
use psb_error_mod use psb_error_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
IMPLICIT NONE IMPLICIT NONE
C C
@ -169,7 +170,9 @@ c
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call reordvn3(nnz,arn,itmp,ian1,aux(ipx),aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux(ipx:),aux)
if (debug_level >= psb_debug_serial_) then if (debug_level >= psb_debug_serial_) then
do i=1, nnz-1 do i=1, nnz-1
if (itmp(i).gt.itmp(i+1)) then if (itmp(i).gt.itmp(i+1)) then
@ -194,8 +197,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) call reordvn3(nzl,arn(i),itmp(i),ian1(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux(ipx+i-1),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),
+ aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -258,7 +262,8 @@ c ... sum the duplicated element ...
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call reordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -271,8 +276,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call reordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -343,7 +349,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'U') THEN + psb_toupper(DESCRA(2:2)).EQ.'U') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call reordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -356,8 +363,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call reordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -416,7 +423,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'L') THEN + psb_toupper(DESCRA(2:2)).EQ.'L') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call reordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -429,8 +437,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call reordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo

@ -40,6 +40,7 @@ C
use psb_const_mod use psb_const_mod
use psb_string_mod use psb_string_mod
use psb_error_mod use psb_error_mod
use psb_ip_reord_mod
IMPLICIT NONE IMPLICIT NONE
C C
@ -137,7 +138,8 @@ C SCALE = (UNITD.EQ.'L') ! meaningless
C .... Order with key IA1N.... C .... Order with key IA1N....
CALL MSORT_UP(NNZ,IA1N,AUX,IRET) CALL MSORT_UP(NNZ,IA1N,AUX,IRET)
IF (IRET.EQ.0) CALL REORDVN(NNZ,ARN,IA1N,IA2N,AUX) if (iret == 0) call psb_ip_reord(nnz,arn,
+ ia1n,ia2n,aux)
C .... Order with key IA2N ... C .... Order with key IA2N ...
I = 1 I = 1
@ -149,8 +151,9 @@ C .... Order with key IA2N ...
ENDDO ENDDO
NZL = J - I NZL = J - I
CALL MSORT_UP(NZL,IA2N(I),AUX,IRET) CALL MSORT_UP(NZL,IA2N(I),AUX,IRET)
IF (IRET.EQ.0) CALL REORDVN(NZL,ARN(I),IA1N(I),IA2N(I), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ AUX) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),aux)
I = J I = J
ENDDO ENDDO
INFON(1)=nnz INFON(1)=nnz

@ -1,391 +0,0 @@
C
C Parallel Sparse BLAS version 2.2
C (C) Copyright 2006/2007/2008
C Salvatore Filippone University of Rome Tor Vergata
C Alfredo Buttari University of Rome Tor Vergata
C
C Redistribution and use in source and binary forms, with or without
C modification, are permitted provided that the following conditions
C are met:
C 1. Redistributions of source code must retain the above copyright
C notice, this list of conditions and the following disclaimer.
C 2. Redistributions in binary form must reproduce the above copyright
C notice, this list of conditions, and the following disclaimer in the
C documentation and/or other materials provided with the distribution.
C 3. The name of the PSBLAS group or the names of its contributors may
C not be used to endorse or promote products derived from this
C software without specific written permission.
C
C THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
C ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
C TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
C PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
C BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
C CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
C SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
C INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
C CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
C ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
C POSSIBILITY OF SUCH DAMAGE.
C
C
subroutine reordvn(nnz,ar,ia1,ia2,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),idx(0:*)
real(psb_dpk_) ar(*)
integer lp, kk, swapia1, swapia2, lswap
real(psb_dpk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine sreordvn(nnz,ar,ia1,ia2,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),idx(0:*)
real(psb_spk_) ar(*)
integer lp, kk, swapia1, swapia2, lswap
real(psb_spk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine ireordv2(nnz,ia1,ia2,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),idx(0:*)
integer lp, kk, swapia1, swapia2, lswap
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1 ..
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine ireordv1(nnz,ia1,idx)
use psb_const_mod
integer nnz
integer ia1(*),idx(0:*)
integer lp, kk, swapia1, lswap
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA1 = IA1(KK)
IA1(KK) = IA1(LP)
IA1(LP) = SWAPIA1
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine sreordvn3(nnz,ar,ia1,ia2,ia3,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),ia3(*),idx(0:*)
real(psb_spk_) ar(*)
integer lp, kk, swapia1, swapia2, swapia3,lswap
real(psb_spk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA3 = IA3(KK)
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA3(KK) = IA3(LP)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA3(LP) = SWAPIA3
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine reordvn3(nnz,ar,ia1,ia2,ia3,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),ia3(*),idx(0:*)
real(psb_dpk_) ar(*)
integer lp, kk, swapia1, swapia2, swapia3,lswap
real(psb_dpk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA3 = IA3(KK)
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA3(KK) = IA3(LP)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA3(LP) = SWAPIA3
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine creordvn(nnz,ar,ia1,ia2,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),idx(0:*)
complex(psb_spk_) ar(*)
integer lp, kk, swapia1, swapia2, lswap
complex(psb_spk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine creordvn3(nnz,ar,ia1,ia2,ia3,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),ia3(*),idx(0:*)
complex(psb_spk_) ar(*)
integer lp, kk, swapia1, swapia2, swapia3,lswap
complex(psb_spk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA3 = IA3(KK)
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA3(KK) = IA3(LP)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA3(LP) = SWAPIA3
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine zreordvn(nnz,ar,ia1,ia2,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),idx(0:*)
complex(psb_dpk_) ar(*)
integer lp, kk, swapia1, swapia2, lswap
complex(psb_dpk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end
subroutine zreordvn3(nnz,ar,ia1,ia2,ia3,idx)
use psb_const_mod
integer nnz
integer ia1(*),ia2(*),ia3(*),idx(0:*)
complex(psb_dpk_) ar(*)
integer lp, kk, swapia1, swapia2, swapia3,lswap
complex(psb_dpk_) swapar
LP = IDX(0)
KK = 1
500 CONTINUE
IF ((LP.EQ.0).OR.(KK.GT.NNZ)) GOTO 800
600 CONTINUE
IF (LP.GE.KK) GOTO 700
LP = IDX(LP)
GOTO 600
700 CONTINUE
C ... Swap of vectors IA2, IA1, AR ...
SWAPIA3 = IA3(KK)
SWAPIA2 = IA2(KK)
SWAPIA1 = IA1(KK)
SWAPAR = AR(KK)
IA3(KK) = IA3(LP)
IA2(KK) = IA2(LP)
IA1(KK) = IA1(LP)
AR(KK) = AR(LP)
IA3(LP) = SWAPIA3
IA2(LP) = SWAPIA2
IA1(LP) = SWAPIA1
AR(LP) = SWAPAR
LSWAP = IDX(LP)
IDX(LP) = IDX(KK)
IDX(KK) = LP
LP = LSWAP
KK = KK+1
GOTO 500
800 CONTINUE
return
end

@ -38,6 +38,7 @@ c
use psb_const_mod use psb_const_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
implicit none implicit none
c .. scalar arguments .. c .. scalar arguments ..
@ -155,8 +156,8 @@ c
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn,
+ call sreordvn3(nnz,arn,ia1n,ia2n,aux(ipx),aux) + ia1n,ia2n,aux(ipx:),aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -168,9 +169,9 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call sreordvn3(nzl,arn(i),ia1n(i),ia2n(i), + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),
+ aux(ipx+i-1),aux) + aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -208,7 +209,9 @@ c ... sum the duplicated element ...
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) call sreordvn(nnz,arn,ia1n,ia2n,aux) if (iret == 0) call psb_ip_reord(nzl,arn,
+ ia1n,ia2n,aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -220,8 +223,8 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call sreordvn(nzl,arn(i),ia1n(i),ia2n(i),aux) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),aux)
i = j i = j
enddo enddo
c ... construct final COO representation... c ... construct final COO representation...

@ -40,6 +40,7 @@ C
use psb_error_mod use psb_error_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
IMPLICIT NONE IMPLICIT NONE
C C
@ -169,8 +170,9 @@ c
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nnz,arn,
+ call sreordvn3(nnz,arn,itmp,ian1,aux(ipx),aux) + itmp,ian1,aux(ipx:),aux)
if (debug_level >= psb_debug_serial_) then if (debug_level >= psb_debug_serial_) then
do i=1, nnz-1 do i=1, nnz-1
if (itmp(i).gt.itmp(i+1)) then if (itmp(i).gt.itmp(i+1)) then
@ -195,9 +197,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call sreordvn3(nzl,arn(i),itmp(i),ian1(i), + itmp(i:i+nzl-1),ian1(i:i+nzl-1),
+ aux(ipx+i-1),aux) + aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -260,7 +262,8 @@ c ... sum the duplicated element ...
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call sreordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -273,8 +276,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call sreordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -345,7 +349,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'U') THEN + psb_toupper(DESCRA(2:2)).EQ.'U') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call sreordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -358,8 +363,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call sreordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -418,7 +423,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'L') THEN + psb_toupper(DESCRA(2:2)).EQ.'L') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call sreordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -431,8 +437,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call sreordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo

@ -38,6 +38,7 @@ c
use psb_const_mod use psb_const_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
implicit none implicit none
c .. scalar arguments .. c .. scalar arguments ..
@ -155,8 +156,8 @@ c
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn,
+ call zreordvn3(nnz,arn,ia1n,ia2n,aux(ipx),aux) + ia1n,ia2n,aux(ipx:),aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -168,8 +169,9 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) call zreordvn3(nzl,arn(i),ia1n(i),ia2n(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux(ipx+i-1),aux) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),
+ aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -207,7 +209,9 @@ c ... sum the duplicated element ...
c .... order with key ia1n ... c .... order with key ia1n ...
call msort_up(nnz,ia1n,aux,iret) call msort_up(nnz,ia1n,aux,iret)
if (iret.eq.0) call zreordvn(nnz,arn,ia1n,ia2n,aux) if (iret == 0) call psb_ip_reord(nzl,arn,
+ ia1n,ia2n,aux)
c .... order with key ia2n ... c .... order with key ia2n ...
i = 1 i = 1
@ -219,8 +223,8 @@ c .... order with key ia2n ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ia2n(i),aux,iret) call msort_up(nzl,ia2n(i),aux,iret)
if (iret.eq.0) call zreordvn(nzl,arn(i),ia1n(i),ia2n(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux) + ia1n(i:i+nzl-1),ia2n(i:i+nzl-1),aux)
i = j i = j
enddo enddo
c ... construct final COO representation... c ... construct final COO representation...

@ -40,6 +40,7 @@ C
use psb_error_mod use psb_error_mod
use psb_spmat_type use psb_spmat_type
use psb_string_mod use psb_string_mod
use psb_ip_reord_mod
IMPLICIT NONE IMPLICIT NONE
C C
@ -168,8 +169,9 @@ c
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nnz,arn,
+ call zreordvn3(nnz,arn,itmp,ian1,aux(ipx),aux) + itmp,ian1,aux(ipx:),aux)
if (debug_level >= psb_debug_serial_) then if (debug_level >= psb_debug_serial_) then
do i=1, nnz-1 do i=1, nnz-1
if (itmp(i).gt.itmp(i+1)) then if (itmp(i).gt.itmp(i+1)) then
@ -194,8 +196,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) call zreordvn3(nzl,arn(i),itmp(i),ian1(i), if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ aux(ipx+i-1),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),
+ aux(ipx+i-1:ipx+i+nzl-1),aux)
i = j i = j
enddo enddo
@ -258,7 +261,8 @@ c ... sum the duplicated element ...
C .... Order with key IA ... C .... Order with key IA ...
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call zreordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -271,8 +275,9 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call zreordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -343,7 +348,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'U') THEN + psb_toupper(DESCRA(2:2)).EQ.'U') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call zreordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -356,8 +362,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call zreordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo
@ -416,7 +422,8 @@ c ... sum the duplicated element ...
+ psb_toupper(DESCRA(2:2)).EQ.'L') THEN + psb_toupper(DESCRA(2:2)).EQ.'L') THEN
call msort_up(nnz,itmp,aux,iret) call msort_up(nnz,itmp,aux,iret)
if (iret.eq.0) call zreordvn(nnz,arn,itmp,ian1,aux) if (iret == 0) call psb_ip_reord(nnz,arn,
+ itmp,ian1,aux)
C .... Order with key JA ... C .... Order with key JA ...
i = 1 i = 1
j = i j = i
@ -429,8 +436,8 @@ C .... Order with key JA ...
enddo enddo
nzl = j - i nzl = j - i
call msort_up(nzl,ian1(i),aux,iret) call msort_up(nzl,ian1(i),aux,iret)
if (iret.eq.0) if (iret == 0) call psb_ip_reord(nzl,arn(i:i+nzl-1),
+ call zreordvn(nzl,arn(i),itmp(i),ian1(i),aux) + itmp(i:i+nzl-1),ian1(i:i+nzl-1),aux)
i = j i = j
enddo enddo

@ -38,6 +38,7 @@ Subroutine psb_cfixcoo(a,info,idir)
use psb_const_mod use psb_const_mod
use psb_string_mod use psb_string_mod
use psb_serial_mod, psb_protect_name => psb_cfixcoo use psb_serial_mod, psb_protect_name => psb_cfixcoo
use psb_ip_reord_mod
use psb_error_mod use psb_error_mod
implicit none implicit none
@ -85,7 +86,8 @@ Subroutine psb_cfixcoo(a,info,idir)
case(0) ! Row major order case(0) ! Row major order
call msort_up(nza,a%ia1(1),iaux(1),iret) call msort_up(nza,a%ia1(1),iaux(1),iret)
if (iret == 0) call creordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -96,7 +98,8 @@ Subroutine psb_cfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia2(i),iaux(1),iret) call msort_up(nzl,a%ia2(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call creordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo
@ -166,7 +169,8 @@ Subroutine psb_cfixcoo(a,info,idir)
case(1) ! Col major order case(1) ! Col major order
call msort_up(nza,a%ia2(1),iaux(1),iret) call msort_up(nza,a%ia2(1),iaux(1),iret)
if (iret == 0) call creordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -177,7 +181,8 @@ Subroutine psb_cfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia1(i),iaux(1),iret) call msort_up(nzl,a%ia1(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call creordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo

@ -38,6 +38,7 @@ subroutine psb_dfixcoo(a,info,idir)
use psb_const_mod use psb_const_mod
use psb_string_mod use psb_string_mod
use psb_serial_mod, psb_protect_name => psb_dfixcoo use psb_serial_mod, psb_protect_name => psb_dfixcoo
use psb_ip_reord_mod
use psb_error_mod use psb_error_mod
implicit none implicit none
@ -85,7 +86,8 @@ subroutine psb_dfixcoo(a,info,idir)
case(0) ! Row major order case(0) ! Row major order
call msort_up(nza,a%ia1(1),iaux(1),iret) call msort_up(nza,a%ia1(1),iaux(1),iret)
if (iret == 0) call reordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -96,7 +98,8 @@ subroutine psb_dfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia2(i),iaux(1),iret) call msort_up(nzl,a%ia2(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call reordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo
@ -166,7 +169,8 @@ subroutine psb_dfixcoo(a,info,idir)
case(1) ! Col major order case(1) ! Col major order
call msort_up(nza,a%ia2(1),iaux(1),iret) call msort_up(nza,a%ia2(1),iaux(1),iret)
if (iret == 0) call reordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -177,7 +181,8 @@ subroutine psb_dfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia1(i),iaux(1),iret) call msort_up(nzl,a%ia1(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call reordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo

@ -0,0 +1,670 @@
!!$
!!$ Parallel Sparse BLAS version 2.2
!!$ (C) Copyright 2006/2007/2008
!!$ Salvatore Filippone University of Rome Tor Vergata
!!$ Alfredo Buttari University of Rome Tor Vergata
!!$
!!$ Redistribution and use in source and binary forms, with or without
!!$ modification, are permitted provided that the following conditions
!!$ are met:
!!$ 1. Redistributions of source code must retain the above copyright
!!$ notice, this list of conditions and the following disclaimer.
!!$ 2. Redistributions in binary form must reproduce the above copyright
!!$ notice, this list of conditions, and the following disclaimer in the
!!$ documentation and/or other materials provided with the distribution.
!!$ 3. The name of the PSBLAS group or the names of its contributors may
!!$ not be used to endorse or promote products derived from this
!!$ software without specific written permission.
!!$
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
!!$ POSSIBILITY OF SUCH DAMAGE.
!!$
!!$
!
! Reorder (an) input vector(s) based on a list sort output.
! Based on: D. E. Knuth: The Art of Computer Programming
! vol. 3: Sorting and Searching, Addison Wesley, 1973
! ex. 5.2.12
!
!
module psb_ip_reord_mod
use psb_const_mod
interface psb_ip_reord
module procedure psb_ip_reord_i1,&
& psb_ip_reord_s1, psb_ip_reord_d1,&
& psb_ip_reord_c1, psb_ip_reord_z1,&
& psb_ip_reord_i1i1,&
& psb_ip_reord_s1i1, psb_ip_reord_d1i1,&
& psb_ip_reord_c1i1, psb_ip_reord_z1i1,&
& psb_ip_reord_s1i2, psb_ip_reord_d1i2,&
& psb_ip_reord_c1i2, psb_ip_reord_z1i2,&
& psb_ip_reord_s1i3, psb_ip_reord_d1i3,&
& psb_ip_reord_c1i3, psb_ip_reord_z1i3
end interface
contains
subroutine psb_ip_reord_i1(n,x,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
integer :: x(*)
integer :: lswap, lp, k
integer :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_i1
subroutine psb_ip_reord_s1(n,x,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_spk_) :: x(*)
integer :: lswap, lp, k
real(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_s1
subroutine psb_ip_reord_d1(n,x,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_dpk_) :: x(*)
integer :: lswap, lp, k
real(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_d1
subroutine psb_ip_reord_c1(n,x,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_spk_) :: x(*)
integer :: lswap, lp, k
complex(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_c1
subroutine psb_ip_reord_z1(n,x,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_dpk_) :: x(*)
integer :: lswap, lp, k
complex(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_z1
subroutine psb_ip_reord_i1i1(n,x,indx,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
integer :: x(*)
integer :: indx(*)
integer :: lswap, lp, k, ixswap
integer :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_i1i1
subroutine psb_ip_reord_s1i1(n,x,indx,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_spk_) :: x(*)
integer :: indx(*)
integer :: lswap, lp, k, ixswap
real(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_s1i1
subroutine psb_ip_reord_d1i1(n,x,indx,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_dpk_) :: x(*)
integer :: indx(*)
integer :: lswap, lp, k, ixswap
real(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_d1i1
subroutine psb_ip_reord_c1i1(n,x,indx,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_spk_) :: x(*)
integer :: indx(*)
integer :: lswap, lp, k, ixswap
complex(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_c1i1
subroutine psb_ip_reord_z1i1(n,x,indx,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_dpk_) :: x(*)
integer :: indx(*)
integer :: lswap, lp, k, ixswap
complex(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
ixswap = indx(lp)
indx(lp) = indx(k)
indx(k) = ixswap
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_z1i1
subroutine psb_ip_reord_s1i2(n,x,i1,i2,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_spk_) :: x(*)
integer :: i1(*), i2(*)
integer :: lswap, lp, k, isw1, isw2
real(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_s1i2
subroutine psb_ip_reord_d1i2(n,x,i1,i2,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_dpk_) :: x(*)
integer :: i1(*), i2(*)
integer :: lswap, lp, k, isw1, isw2
real(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_d1i2
subroutine psb_ip_reord_c1i2(n,x,i1,i2,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_spk_) :: x(*)
integer :: i1(*), i2(*)
integer :: lswap, lp, k, isw1, isw2
complex(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_c1i2
subroutine psb_ip_reord_z1i2(n,x,i1,i2,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_dpk_) :: x(*)
integer :: i1(*), i2(*)
integer :: lswap, lp, k, isw1, isw2
complex(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_z1i2
subroutine psb_ip_reord_s1i3(n,x,i1,i2,i3,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_spk_) :: x(*)
integer :: i1(*), i2(*), i3(*)
integer :: lswap, lp, k, isw1, isw2, isw3
real(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
isw3 = i3(lp)
i3(lp) = i3(k)
i3(k) = isw3
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_s1i3
subroutine psb_ip_reord_d1i3(n,x,i1,i2,i3,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
real(psb_dpk_) :: x(*)
integer :: i1(*), i2(*),i3(*)
integer :: lswap, lp, k, isw1, isw2,isw3
real(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
isw3 = i3(lp)
i3(lp) = i3(k)
i3(k) = isw3
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_d1i3
subroutine psb_ip_reord_c1i3(n,x,i1,i2,i3,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_spk_) :: x(*)
integer :: i1(*), i2(*), i3(*)
integer :: lswap, lp, k, isw1, isw2, isw3
complex(psb_spk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
isw3 = i3(lp)
i3(lp) = i3(k)
i3(k) = isw3
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_c1i3
subroutine psb_ip_reord_z1i3(n,x,i1,i2,i3,iaux)
integer, intent(in) :: n
integer :: iaux(0:*)
complex(psb_dpk_) :: x(*)
integer :: i1(*), i2(*), i3(*)
integer :: lswap, lp, k, isw1, isw2, isw3
complex(psb_dpk_) :: swap
lp = iaux(0)
k = 1
do
if ((lp==0).or.(k>n)) exit
do
if (lp >= k) exit
lp = iaux(lp)
end do
swap = x(lp)
x(lp) = x(k)
x(k) = swap
isw1 = i1(lp)
i1(lp) = i1(k)
i1(k) = isw1
isw2 = i2(lp)
i2(lp) = i2(k)
i2(k) = isw2
isw3 = i3(lp)
i3(lp) = i3(k)
i3(k) = isw3
lswap = iaux(lp)
iaux(lp) = iaux(k)
iaux(k) = lp
lp = lswap
k = k + 1
enddo
return
end subroutine psb_ip_reord_z1i3
end module psb_ip_reord_mod

@ -38,6 +38,7 @@ subroutine psb_sfixcoo(a,info,idir)
use psb_const_mod use psb_const_mod
use psb_string_mod use psb_string_mod
use psb_serial_mod, psb_protect_name => psb_sfixcoo use psb_serial_mod, psb_protect_name => psb_sfixcoo
use psb_ip_reord_mod
use psb_error_mod use psb_error_mod
implicit none implicit none
@ -85,7 +86,8 @@ subroutine psb_sfixcoo(a,info,idir)
case(0) ! Row major order case(0) ! Row major order
call msort_up(nza,a%ia1(1),iaux(1),iret) call msort_up(nza,a%ia1(1),iaux(1),iret)
if (iret == 0) call sreordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -96,7 +98,8 @@ subroutine psb_sfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia2(i),iaux(1),iret) call msort_up(nzl,a%ia2(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call sreordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo
@ -166,7 +169,8 @@ subroutine psb_sfixcoo(a,info,idir)
case(1) ! Col major order case(1) ! Col major order
call msort_up(nza,a%ia2(1),iaux(1),iret) call msort_up(nza,a%ia2(1),iaux(1),iret)
if (iret == 0) call sreordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -177,7 +181,8 @@ subroutine psb_sfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia1(i),iaux(1),iret) call msort_up(nzl,a%ia1(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call sreordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo

@ -38,6 +38,7 @@ Subroutine psb_zfixcoo(a,info,idir)
use psb_const_mod use psb_const_mod
use psb_string_mod use psb_string_mod
use psb_serial_mod, psb_protect_name => psb_zfixcoo use psb_serial_mod, psb_protect_name => psb_zfixcoo
use psb_ip_reord_mod
use psb_error_mod use psb_error_mod
implicit none implicit none
@ -85,7 +86,8 @@ Subroutine psb_zfixcoo(a,info,idir)
case(0) ! Row major order case(0) ! Row major order
call msort_up(nza,a%ia1(1),iaux(1),iret) call msort_up(nza,a%ia1(1),iaux(1),iret)
if (iret == 0) call zreordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -96,7 +98,8 @@ Subroutine psb_zfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia2(i),iaux(1),iret) call msort_up(nzl,a%ia2(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call zreordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo
@ -166,7 +169,8 @@ Subroutine psb_zfixcoo(a,info,idir)
case(1) ! Col major order case(1) ! Col major order
call msort_up(nza,a%ia2(1),iaux(1),iret) call msort_up(nza,a%ia2(1),iaux(1),iret)
if (iret == 0) call zreordvn(nza,a%aspk(1),a%ia1(1),a%ia2(1),iaux(1)) if (iret == 0) &
& call psb_ip_reord(nza,a%aspk,a%ia1,a%ia2,iaux)
i = 1 i = 1
j = i j = i
do while (i <= nza) do while (i <= nza)
@ -177,7 +181,8 @@ Subroutine psb_zfixcoo(a,info,idir)
nzl = j - i nzl = j - i
call msort_up(nzl,a%ia1(i),iaux(1),iret) call msort_up(nzl,a%ia1(i),iaux(1),iret)
if (iret == 0) & if (iret == 0) &
& call zreordvn(nzl,a%aspk(i),a%ia1(i),a%ia2(i),iaux(1)) & call psb_ip_reord(nzl,a%aspk(i:i+nzl-1),&
& a%ia1(i:i+nzl-1),a%ia2(i:i+nzl-1),iaux)
i = j i = j
enddo enddo

Loading…
Cancel
Save