22 integer(kind=kint) :: ndeg
23 integer(kind=kint) :: neqns
24 integer(kind=kint) :: nstop
25 integer(kind=kint) :: stage
26 integer(kind=kint) :: lncol
27 integer(kind=kint) :: lndsln
29 integer(kind=kint),
pointer :: zpiv(:)
30 integer(kind=kint),
pointer :: iperm(:)
31 integer(kind=kint),
pointer :: invp(:)
32 integer(kind=kint),
pointer :: parent(:)
33 integer(kind=kint),
pointer :: nch(:)
34 integer(kind=kint),
pointer :: xlnzr(:)
35 integer(kind=kint),
pointer :: colno(:)
37 real(kind=
kreal),
pointer :: diag(:,:)
38 real(kind=
kreal),
pointer :: zln(:,:)
39 real(kind=
kreal),
pointer :: dsln(:,:)
44 real(kind=
kreal),
parameter :: rmin = 1.00d-200
48 integer,
parameter :: ilog = 16
49 logical,
parameter :: ldbg = .false.
52 logical :: lelap = .false.
66 integer(kind=kint),
intent(in) :: nrows
67 integer(kind=kint),
intent(in) :: ilag_sta
68 integer(kind=kint),
intent(in) :: nttbr
69 integer(kind=kint),
intent(in) :: pointers(:)
70 integer(kind=kint),
intent(in) :: indices(:)
71 real(kind=
kreal),
intent(in) :: values(:)
74 real(kind=
kreal),
intent(inout) :: b(:)
86 integer(kind=kint),
parameter :: ndeg_prm = 1
93 integer(kind=kint) :: i,j,k,l,kk
98 a0%neqns = ilag_sta - 1
104 do l= pointers(i), pointers(i+1)-1
106 if (j .le. a0%neqns)
then
107 a0%nttbr = a0%nttbr+1
112 allocate( a0%irow(a0%nttbr), a0%jcol(a0%nttbr), a0%val(ndeg_prm,a0%nttbr))
113 allocate( a0tmp%irow(a0%nttbr), a0tmp%jcol(a0%nttbr), a0tmp%val(ndeg_prm,a0%nttbr))
117 do l= pointers(i), pointers(i+1)-1
119 if (j .le. a0%neqns)
then
124 a0tmp%val(1,kk)=values(l)
133 if (a0tmp%jcol(k) == i)
then
135 a0%irow(kk)=a0tmp%jcol(k)
136 a0%jcol(kk)=a0tmp%irow(k)
137 a0%val(1,kk)=a0tmp%val(1,k)
143 lag%nrows = nrows - ilag_sta + 1
144 lag%ncols = ilag_sta - 1
150 do l= pointers(i), pointers(i+1)-1
152 if ((j .ge. ilag_sta) .and. (i .lt. ilag_sta) )
then
153 lag%nttbr = lag%nttbr+1
158 allocate( lag%irow(lag%nttbr), lag%jcol(lag%nttbr), lag%val(ndeg_prm,lag%nttbr))
159 allocate( lagtmp%irow(lag%nttbr), lagtmp%jcol(lag%nttbr), lagtmp%val(ndeg_prm,lag%nttbr))
163 do l= pointers(i), pointers(i+1)-1
165 if ((j .ge. ilag_sta) .and. (i .lt. ilag_sta) )
then
168 lagtmp%jcol(kk) = j - ilag_sta +1
169 lagtmp%val(1,kk)=values(l)
178 if (lagtmp%jcol(k) == i)
then
180 lag%irow(kk)=lagtmp%jcol(k)
181 lag%jcol(kk)=lagtmp%irow(k)
182 lag%val(1,kk)=lagtmp%val(1,k)
186 call hecmw_solve_direct_serial_lag_in(a0,lag, b)
193 subroutine hecmw_solve_direct_serial_lag_in(a0,lag, b)
200 real(kind=
kreal),
intent(inout) :: b(:)
207 call sp_direct_parent(a0,lag,b)
210 end subroutine hecmw_solve_direct_serial_lag_in
214 subroutine sp_direct_parent(a0, lag, b_in)
223 real(kind=
kreal),
intent(inout) :: b_in(:)
233 integer(kind=kint) :: neqns_a
234 integer(kind=kint) :: neqns_lag
237 real(kind=
kreal),
allocatable :: b(:,:)
238 real(kind=
kreal),
allocatable :: oldb(:,:)
239 real(kind=
kreal),
allocatable :: b_a(:)
240 real(kind=
kreal),
allocatable :: b_lag(:)
244 logical,
save :: nusol_ready = .false.
245 integer(kind=kint),
save :: ndeg, nndeg, ndegt
248 integer(kind=kint) :: ierr
249 integer(kind=kint) :: i,j,k
252 real(kind=
kreal),
pointer :: spdslnval(:,:)
253 integer(kind=kint),
pointer :: spdslnidx(:)
254 integer(kind=kint) :: nspdsln
258 real(kind=
kreal),
pointer :: dsln_lag(:,:)
259 real(kind=
kreal),
pointer :: diag_lag(:,:)
260 real(kind=
kreal),
allocatable :: wk(:), wk_d(:)
261 integer(kind=kint) :: ks, ke
274 ndegt = (ndeg+1)*ndeg/2
288 neqns_lag = lag%nrows
289 allocate(dsln_lag(1,neqns_lag*(neqns_lag - 1)/2))
290 allocate(diag_lag(1,neqns_lag))
299 cm%a%neqns = a0%neqns
300 cm%a%nttbr = a0%nttbr
301 allocate(cm%a%irow(cm%a%nttbr), cm%a%jcol(cm%a%nttbr), cm%a%val(1, cm%a%nttbr))
302 cm%a%irow(:) = a0%irow(:)
303 cm%a%jcol(:) = a0%jcol(:)
304 cm%a%val(1,:) = a0%val(1,:)
308 cm%c%nttbr = lag%nttbr
309 cm%c%nrows = lag%nrows
310 cm%c%ncols = lag%ncols
311 allocate(cm%c%irow(cm%c%nttbr), cm%c%jcol(cm%c%nttbr), cm%c%val(1, cm%c%nttbr))
312 cm%c%irow(:) = lag%irow(:)
313 cm%c%jcol(:) = lag%jcol(:)
314 cm%c%val(1,:) = lag%val(1,:)
317 cm%ista_c = cm%a%neqns+1
318 cm%neqns_t = cm%a%neqns + cm%c%nrows
327 call matini_para(cm, dsi, ierr)
331 call staij1(0, cm%a%irow(i), cm%a%jcol(i), cm%a%val(:,i), dsi, ierr)
335 call staij1(0, cm%c%irow(i)+cm%a%neqns, cm%c%jcol(i), cm%c%val(:,i), dsi, ierr)
347 call nufct0_child(dsi, ierr, nspdsln, spdslnidx, spdslnval, diag_lag)
358 dsln_lag(:,spdslnidx(i)) = dsln_lag(:,spdslnidx(i)) + spdslnval(:,i)
365 call nufct0_parent(dsln_lag, diag_lag, neqns_lag, ndeg)
377 allocate(b(ndeg,a0%neqns+lag%nrows), stat=ierr)
379 call errtrp(
'stop due to allocation error.')
381 do i=1,a0%neqns+lag%nrows
386 allocate(oldb(ndeg,a0%neqns+lag%nrows), stat=ierr)
388 call errtrp(
'stop due to allocation error.')
391 oldb(ndeg,i)=b(ndeg,i)
393 do i=a0%neqns+1, a0%neqns+lag%nrows
394 oldb(ndeg,i)=b(ndeg,i)
397 allocate(b_a(neqns_a))
402 allocate(b_lag(neqns_lag))
404 b_lag(i)=b_in(neqns_a + i)
409 allocate(wk(neqns_a+neqns_lag), stat=ierr)
411 call errtrp(
'stop due to allocation error.')
416 wk(i)=b_a(dsi%iperm(i))
426 wk(i)=wk(i)-spdot2(wk,dsi%zln(1,:),dsi%colno,ks,ke)
430 allocate(wk_d(dsi%nstop:dsi%neqns), stat=ierr)
432 call errtrp(
'stop due to allocation error.')
436 do i=dsi%nstop,dsi%neqns
442 wk_d(i)=wk_d(i)-spdot2(wk,dsi%zln(1,:),dsi%colno,ks,ke)
460 b_lag(i)=b_lag(i) + wk_d(neqns_a + i)
467 call nusol1_parent(dsln_lag(1,:), diag_lag(1,:), b_lag, neqns_lag)
478 wk(i)=wk(i)*dsi%diag(1,i)
483 wk(neqns_a + i)=b_lag(i)
494 wk(j)=wk(j)-wk(i)*dsi%zln(1,k)
499 b(1,dsi%iperm(i))=wk(i)
502 b(1,neqns_a +i )=b_lag(i)
512 call verif0(ndeg, a0%neqns, a0%nttbr, a0%irow, a0%jcol, a0%val, lag%nrows, lag%nttbr, lag%irow, lag%jcol, lag%val, oldb, b)
514 do i=1,a0%neqns+lag%nrows
519 deallocate(spdslnidx, spdslnval)
520 deallocate(dsln_lag, diag_lag)
522 deallocate(b, oldb, b_a, b_lag)
524 deallocate(cm%a%irow, cm%a%jcol, cm%a%val)
525 deallocate(cm%c%irow, cm%c%jcol, cm%c%val)
527 deallocate(dsi%iperm)
529 deallocate(dsi%parent)
531 deallocate(dsi%xlnzr)
532 deallocate(dsi%colno)
538 end subroutine sp_direct_parent
542 subroutine errtrp(mes)
547 end subroutine errtrp
551 subroutine matini_para(cm,dsi,ir)
590 type(dsinfo),
intent(out) :: dsi
591 integer(kind=kint),
intent(out) :: ir
593 integer(kind=kint),
pointer :: irow_a(:), jcol_a(:)
594 integer(kind=kint),
pointer :: irow_c(:), jcol_c(:)
596 integer(kind=kint),
pointer :: ia(:)
597 integer(kind=kint),
pointer :: ja(:)
598 integer(kind=kint),
pointer :: jcpt(:)
599 integer(kind=kint),
pointer :: jcolno(:)
601 integer(kind=kint),
pointer :: iperm_a(:)
602 integer(kind=kint),
pointer :: invp_a(:)
604 integer(kind=kint),
pointer :: xlnzr_a(:)
605 integer(kind=kint),
pointer :: colno_a(:)
607 integer(kind=kint),
pointer :: xlnzr_c(:)
608 integer(kind=kint),
pointer :: colno_c(:)
611 integer(kind=kint),
pointer :: adjncy(:)
612 integer(kind=kint),
pointer :: qlink(:)
613 integer(kind=kint),
pointer :: qsize(:)
614 integer(kind=kint),
pointer :: nbrhd(:)
615 integer(kind=kint),
pointer :: rchset(:)
617 integer(kind=kint),
pointer :: cstr(:)
619 integer(kind=kint),
pointer :: adjt(:)
620 integer(kind=kint),
pointer :: anc(:)
622 integer(kind=kint),
pointer :: lwk3arr(:)
623 integer(kind=kint),
pointer :: lwk2arr(:)
624 integer(kind=kint),
pointer :: lwk1arr(:)
625 integer(kind=kint),
pointer :: lbtreearr(:,:)
626 integer(kind=kint),
pointer :: lleafarr(:)
627 integer(kind=kint),
pointer :: lxleafarr(:)
628 integer(kind=kint),
pointer :: ladparr(:)
629 integer(kind=kint),
pointer :: lpordrarr(:)
631 integer(kind=kint) :: neqns_a, nttbr_a, neqns_a1, nstop, neqns_t, neqns_d, nttbr_c, ndeg
632 integer(kind=kint) :: lncol_a, lncol_c
633 integer(kind=kint) :: neqnsz, nofsub, izz, izz0, lnleaf
634 integer(kind=kint) :: ir1
635 integer(kind=kint) :: i, ierr
661 allocate(dsi%zpiv(neqns_a), stat=ierr)
663 call errtrp(
'stop due to allocation error.')
665 call zpivot(neqns_a,neqnsz,nttbr_a,jcol_a,irow_a,dsi%zpiv,ir1)
673 allocate(jcpt(2*nttbr_a), jcolno(2*nttbr_a), stat=ierr)
675 call errtrp(
'stop due to allocation error.')
677 call stsmat(neqns_a,nttbr_a,irow_a,jcol_a,jcpt,jcolno)
681 allocate(ia(neqns_a1), ja(2*nttbr_a), stat=ierr)
683 call errtrp(
'stop due to allocation error.')
685 call stiaja(neqns_a, neqns_a,ia,ja,jcpt,jcolno)
691 allocate(iperm_a(neqns_a), invp_a(neqns_a), stat=ierr)
693 call errtrp(
'stop due to allocation error.')
695 call idntty(neqns_a,invp_a,iperm_a)
698 allocate(adjncy(2*nttbr_a),qlink(neqns_a1),qsize(neqns_a1),nbrhd(neqns_a1),rchset(neqns_a1), stat=ierr)
700 call errtrp(
'stop due to allocation error.')
702 allocate(lwk2arr(neqns_a1),lwk1arr(neqns_a1), stat=ierr)
704 call errtrp(
'stop due to allocation error.')
706 call genqmd(neqns_a,ia,ja,iperm_a,invp_a,lwk1arr,lwk2arr,rchset,nbrhd,qsize,qlink,nofsub,adjncy)
707 deallocate(adjncy, qlink, qsize, nbrhd, rchset)
710 call stiaja(neqns_a, neqns_a, ia, ja, jcpt,jcolno)
714 allocate(cstr(neqns_a1),adjt(neqns_a1), stat=ierr)
716 call errtrp(
'stop due to allocation error.')
719 call genpaq(ia,ja,invp_a,iperm_a,lwk2arr,neqns_a,cstr)
722 allocate (lbtreearr(2,neqns_a1), stat=ierr)
724 call errtrp(
'stop due to allocation error.')
726 call genbtq(ia, ja, invp_a, iperm_a,lwk2arr,lbtreearr,dsi%zpiv,izz,neqns_a)
730 if(izz0.eq.0) izz0=izz
731 if(izz0.ne.izz)
goto 30
732 call rotate(ia, ja, invp_a, iperm_a, lwk2arr,lbtreearr,izz,neqns_a,anc,adjt,ir1)
735 call bringu(dsi%zpiv,iperm_a, invp_a, lwk2arr,izz,neqns_a,ir1)
740 allocate(lwk3arr(0:neqns_a1),lpordrarr(neqns_a1),dsi%parent(neqns_a1), dsi%nch(neqns_a1), stat=ierr)
742 call errtrp(
'stop due to allocation error.')
744 call posord(dsi%parent,lbtreearr,invp_a,iperm_a,lpordrarr,dsi%nch,neqns_a,lwk1arr,lwk2arr,lwk3arr)
747 allocate(lleafarr(nttbr_a),lxleafarr(neqns_a1),ladparr(neqns_a1), stat=ierr)
749 call errtrp(
'stop due to allocation error.')
751 call gnleaf(ia, ja, invp_a, iperm_a, lpordrarr,dsi%nch,ladparr,lxleafarr,lleafarr,neqns_a,lnleaf)
755 call countclno(dsi%parent, lxleafarr, lleafarr, neqns_a, nstop, lncol_a, ir1)
756 allocate(colno_a(lncol_a),xlnzr_a(neqns_a1), stat=ierr)
758 call errtrp(
'stop due to allocation error.')
760 call gnclno(dsi%parent,lpordrarr,lxleafarr,lleafarr,xlnzr_a, colno_a, neqns_a, nstop,lncol_a,ir1)
767 call ldudecomposec(xlnzr_a,colno_a,invp_a,iperm_a, ndeg, nttbr_c, irow_c, &
768 jcol_c, cm%c%ncols, cm%c%nrows, xlnzr_c, colno_c, lncol_c)
771 allocate(dsi%xlnzr(neqns_t + 1), stat=ierr)
773 call errtrp(
'stop due to allocation error.')
775 dsi%xlnzr(1:neqns_a)=xlnzr_a(:)
776 dsi%xlnzr(neqns_a+1:neqns_t+1)=xlnzr_c(:)+xlnzr_a(neqns_a+1)-1
778 dsi%lncol=lncol_a + lncol_c
779 allocate(dsi%colno(lncol_a + lncol_c), stat=ierr)
781 call errtrp(
'stop due to allocation error.')
785 dsi%colno(i)=colno_a(i)
788 dsi%colno(lncol_a + i)=colno_c(i)
791 allocate(dsi%invp(neqns_t), dsi%iperm(neqns_t), stat=ierr)
793 call errtrp(
'stop due to allocation error.')
795 dsi%invp(1:neqns_a)=invp_a(1:neqns_a)
796 dsi%iperm(1:neqns_a)=iperm_a(1:neqns_a)
797 do i=neqns_a+1,neqns_t
802 deallocate(xlnzr_a, colno_a, xlnzr_c, colno_c, invp_a, iperm_a)
809 end subroutine matini_para
813 subroutine nufct0_child(dsi,ir, nspdsln, spdslnidx, spdslnval, diag_lag)
816 type(dsinfo),
intent(inout) :: dsi
817 integer(kind=kint),
intent(out) :: ir
819 integer(kind=kint),
intent(inout) :: nspdsln
820 real(kind=
kreal),
pointer :: spdslnval(:,:)
821 integer(kind=kint),
pointer :: spdslnidx(:)
823 real(kind=
kreal),
intent(inout) :: diag_lag(:,:)
829 if(dsi%stage.ne.20)
then
835 if(dsi%ndeg.eq.1)
then
836 call nufct1_child(dsi%xlnzr,dsi%colno,dsi%zln,dsi%diag,dsi%neqns,dsi%parent,dsi%nch,dsi%nstop,ir, &
837 nspdsln, spdslnidx, spdslnval, diag_lag)
838 else if(dsi%ndeg.eq.2)
then
839 write(idbg,*)
'ndeg=1 only'
841 else if(dsi%ndeg.eq.3)
then
842 write(idbg,*)
'ndeg=1 only'
844 else if(dsi%ndeg.eq.6)
then
845 write(idbg,*)
'ndeg=1 only'
848 write(idbg,*)
'ndeg=1 only'
855 end subroutine nufct0_child
859 subroutine nufct1_child(xlnzr,colno,zln,diag,neqns,parent,nch,nstop,ir, nspdsln, spdslnidx, spdslnval, diag_lag)
862 integer(kind=kint),
intent(in) :: xlnzr(:),colno(:),parent(:)
863 integer(kind=kint),
intent(in) :: neqns, nstop, ir
864 integer(kind=kint),
intent(inout) :: nch(:)
865 real(kind=
kreal),
intent(inout) :: zln(:,:),diag(:,:)
867 integer(kind=kint) :: neqns_c
868 integer(kind=kint) :: i,l, ic
869 integer(kind=kint) :: nspdsln
870 integer(kind=kint),
pointer :: spdslnidx(:)
871 real(kind=
kreal),
pointer :: spdslnval(:,:)
872 real(kind=
kreal),
intent(out) :: diag_lag(:,:)
891 diag(1,1)=1.0d0/diag(1,1)
896 call sum(ic,xlnzr,colno,zln(1,:),diag(1,:),nch,parent,neqns)
904 call sum1(ic,xlnzr,colno,zln(1,:),diag(1,:),parent,neqns)
917 neqns_c = neqns - nstop + 1
918 call sum2_child(neqns,nstop,xlnzr,colno,zln(1,:),diag(1,:),spdslnidx,spdslnval,nspdsln)
927 diag_lag(1,i) = diag(1,nstop+i-1)
931 end subroutine nufct1_child
937 subroutine nufct0_parent(dsln, diag, neqns, ndeg)
942 real(kind=
kreal),
intent(inout) :: dsln(:,:)
943 real(kind=
kreal),
intent(inout) :: diag(:,:)
944 integer(kind=kint),
intent(in) :: neqns, ndeg
946 if (ndeg .eq. 1)
then
947 call sum3(neqns, dsln(1,:), diag(1,:))
948 else if (ndeg .eq. 3)
then
949 write(idbg,*)
'ndeg=1 only'
952 write(idbg,*)
'ndeg=1 only'
957 end subroutine nufct0_parent
964 subroutine nusol1_parent(dsln, diag, b, neqns)
971 real(kind=
kreal),
intent(in) :: dsln(:)
972 real(kind=
kreal),
intent(in) :: diag(:)
973 real(kind=
kreal),
intent(inout) :: b(:)
974 integer(kind=kint),
intent(in) :: neqns
976 integer(kind=kint) :: i,j,k,loc
981 b(i)=b(i)-dot_product(b(1:i-1),dsln(k:k+i-2))
989 loc=(neqns-1)*neqns/2
992 b(j)=b(j)-b(i)*dsln(loc)
998 end subroutine nusol1_parent
1005 subroutine zpivot(neqns,neqnsz,nttbr,jcol,irow,zpiv,ir)
1009 integer(kind=kint),
intent(in) :: jcol(:),irow(:)
1010 integer(kind=kint),
intent(out) :: zpiv(:)
1011 integer(kind=kint),
intent(in) :: neqns,nttbr
1012 integer(kind=kint),
intent(out) :: neqnsz,ir
1014 integer(kind=kint) :: i,j,l
1024 if(i.le.0.or.j.le.0)
then
1027 elseif(i.gt.neqns.or.j.gt.neqns)
then
1031 if(i.eq.j) zpiv(i)=0
1035 if(zpiv(i).eq.0)
then
1042 if(ldbg)
write(idbg,*)
'# zpivot ########################'
1043 if(ldbg)
write(idbg,60) (zpiv(i),i=1,neqns)
1046 end subroutine zpivot
1050 subroutine stsmat(neqns,nttbr,irow,jcol,jcpt,jcolno)
1054 integer(kind=kint),
intent(in) :: irow(:), jcol(:)
1055 integer(kind=kint),
intent(out) :: jcpt(:), jcolno(:)
1056 integer(kind=kint),
intent(in) :: neqns, nttbr
1058 integer(kind=kint) :: i,j,k,l,loc,locr
1077 if(loc.eq.0)
goto 120
1078 if(jcolno(loc).eq.j)
then
1080 elseif(jcolno(loc).gt.j)
then
1100 if(loc.eq.0)
goto 170
1101 if(jcolno(loc).eq.i)
then
1103 elseif(jcolno(loc).gt.i)
then
1121 write(idbg,*)
'jcolno'
1122 write(idbg,60) (jcolno(i),i=1,k)
1123 write(idbg,*)
'jcpt'
1124 write(idbg,60) (jcpt(i),i=1,k)
1128 end subroutine stsmat
1131 subroutine stiaja(neqns,neqnsz,ia,ja,jcpt,jcolno)
1137 integer(kind=kint),
intent(in) :: jcpt(:),jcolno(:)
1138 integer(kind=kint),
intent(out) :: ia(:),ja(:)
1139 integer(kind=kint),
intent(in) :: neqns, neqnsz
1141 integer(kind=kint) :: i,k,l,ii,loc
1149 if(loc.eq.0)
goto 120
1151 if(ii.eq.k.or.ii.gt.neqnsz)
goto 130
1160 write(idbg,*)
'stiaja(): ia '
1161 write(idbg,60) (ia(i),i=1,neqns+1)
1162 write(idbg,*)
'stiaja(): ja '
1163 write(idbg,60) (ja(i),i=1,ia(neqns+1))
1167 end subroutine stiaja
1171 subroutine idntty(neqns,invp,iperm)
1175 integer(kind=kint),
intent(out) :: invp(:),iperm(:)
1176 integer(kind=kint),
intent(in) :: neqns
1178 integer(kind=kint) :: i
1185 end subroutine idntty
1189 subroutine genqmd(neqns,xadj,adj0,perm,invp,deg,marker,rchset,nbrhd,qsize,qlink,nofsub,adjncy)
1193 integer(kind=kint),
intent(in) :: adj0(:),xadj(:)
1194 integer(kind=kint),
intent(out) :: rchset(:),nbrhd(:),adjncy(:),perm(:),invp(:),deg(:),marker(:),qsize(:),qlink(:)
1195 integer(kind=kint),
intent(in) :: neqns
1196 integer(kind=kint),
intent(out) :: nofsub
1198 integer(kind=kint) :: inode,ip,irch,mindeg,nhdsze,node,np,num,nump1,nxnode,rchsze,search,thresh,ndeg
1199 integer(kind=kint) :: i,j
1203 do i=1,xadj(neqns+1)-1
1212 ndeg=xadj(node+1)-xadj(node)
1214 if(ndeg.lt.mindeg) mindeg=ndeg
1222 if(nump1.gt.search) search=nump1
1223 do 400 j=search,neqns
1225 if(marker(node).lt.0)
goto 400
1227 if(ndeg.le.thresh)
goto 500
1228 if(ndeg.lt.mindeg) mindeg=ndeg
1233 nofsub=nofsub+deg(node)
1235 call qmdrch(node,xadj,adjncy,deg,marker,rchsze,rchset,nhdsze,nbrhd)
1245 nxnode=qlink(nxnode)
1246 if(nxnode.gt.0)
goto 600
1247 if(rchsze.le.0)
goto 800
1249 call qmdupd(xadj,adjncy,rchsze,rchset,deg,qsize,qlink,marker,rchset(rchsze+1:),nbrhd(nhdsze+1:))
1251 do 700 irch=1,rchsze
1253 if(marker(inode).lt.0)
goto 700
1256 if(ndeg.lt.mindeg) mindeg=ndeg
1257 if(ndeg.gt.thresh)
goto 700
1262 if(nhdsze.gt.0)
call qmdot(node,xadj,adjncy,marker,rchsze,rchset,nbrhd)
1263 800
if(num.lt.neqns)
goto 300
1265 end subroutine genqmd
1269 subroutine genpaq(xadj,adjncy,invp,iperm,parent,neqns,ancstr)
1273 integer(kind=kint),
intent(in) :: xadj(:),adjncy(:),invp(:),iperm(:)
1274 integer(kind=kint),
intent(out) :: parent(:),ancstr(:)
1275 integer(kind=kint),
intent(in) :: neqns
1277 integer(kind=kint) :: i,k,l,ip,it
1283 do 110 k=xadj(ip),xadj(ip+1)-1
1287 if(ancstr(l).eq.0)
goto 111
1288 if(ancstr(l).eq.i)
goto 110
1299 if(parent(i).eq.0) parent(i)=neqns+1
1302 if(ldbg)
write(idbg,6010)
1303 if(ldbg)
write(idbg,6000) (i,parent(i),i=1,neqns)
1305 6010
format(
' parent')
1307 end subroutine genpaq
1311 subroutine genbtq(xadj,adjncy,invp,iperm,parent,btree,zpiv,izz,neqns)
1315 integer(kind=kint),
intent(in) :: xadj(:),adjncy(:),parent(:),invp(:),iperm(:),zpiv(:)
1316 integer(kind=kint),
intent(out) :: btree(:,:)
1317 integer(kind=kint),
intent(in) :: neqns
1318 integer(kind=kint),
intent(out) :: izz
1320 integer(kind=kint) :: i,ip,ib,inext
1328 if(ip.le.0)
goto 100
1347 if(zpiv(i).ne.0)
then
1348 if(btree(1,invp(i)).eq.0)
then
1356 if(ldbg)
write(idbg,6010)
1357 if(ldbg)
write(idbg,6000) (i,btree(1,i),btree(2,i),i=1,neqns)
1358 if(ldbg)
write(idbg,6020) izz
1361 6000
format(i6,
'(',2i6,
')')
1362 6010
format(
' binary tree')
1363 6020
format(
' the first zero pivot is ',i4)
1366 end subroutine genbtq
1370 subroutine rotate(xadj,adjncy,invp,iperm,parent,btree,izz,neqns,anc,adjt,irr)
1374 integer(kind=kint),
intent(in) :: xadj(:),adjncy(:),parent(:),btree(:,:)
1375 integer(kind=kint),
intent(out) :: anc(:),adjt(:)
1376 integer(kind=kint),
intent(inout) :: invp(:), iperm(:)
1377 integer(kind=kint),
intent(in) :: neqns,izz
1378 integer(kind=kint),
intent(out) :: irr
1380 integer(kind=kint) :: i,k,l,izzz,nanc,loc,locc,ll,kk,iy
1393 if(btree(1,izzz).ne.0)
then
1407 if(loc.ne.0)
goto 100
1421 if(locc.ne.0)
goto 220
1423 do k=xadj(iperm(loc)),xadj(iperm(loc)+1)-1
1424 adjt(invp(adjncy(k)))=1
1426 if(loc.ge.anc(l))
goto 250
1428 if(locc.ne.0)
goto 220
1433 if(adjt(anc(ll)).eq.0)
then
1453 if(adjt(ll).eq.0)
then
1467 if(locc.ne.0)
goto 350
1469 do kk=xadj(iperm(loc)),xadj(iperm(loc)+1)-1
1470 adjt(invp(adjncy(kk)))=1
1472 if(loc.ge.iy)
goto 380
1474 if(locc.ne.0)
goto 350
1479 if(adjt(anc(ll)).eq.0)
then
1481 invp(iperm(anc(ll)))=k
1486 if(adjt(anc(ll)).ne.0)
then
1488 invp(iperm(anc(ll)))=k
1498 if(i.eq.izzz)
goto 510
1502 invp(iperm(izzz))=neqns
1510 if(ldbg)
write(idbg,6000) (invp(i),i=1,neqns)
1513 end subroutine rotate
1517 subroutine bringu(zpiv,iperm,invp,parent,izz,neqns,irr)
1521 integer(kind=kint),
intent(in) :: zpiv(:),parent(:)
1522 integer(kind=kint),
intent(inout) :: iperm(:),invp(:)
1523 integer(kind=kint),
intent(in) :: neqns,izz
1524 integer(kind=kint),
intent(out) :: irr
1526 integer(kind=kint) :: i,ib0,ib,ibp,izzp
1544 if(ib.le.0)
goto 1000
1547 if(zpiv(izzp).eq.0)
goto 110
1557 if(invp(iperm(i)).ne.i)
goto 210
1558 if(iperm(invp(i)).ne.i)
goto 210
1562 write(20,*)
'permutation error'
1569 end subroutine bringu
1573 subroutine posord(parent,btree,invp,iperm,pordr,nch,neqns,iw,qarent,mch)
1577 integer(kind=kint),
intent(in) :: btree(:,:),qarent(:)
1578 integer(kind=kint),
intent(out) :: pordr(:),iperm(:),nch(:),iw(:),parent(:),mch(0:neqns+1)
1579 integer(kind=kint),
intent(inout) :: invp(:)
1580 integer(kind=kint),
intent(in) :: neqns
1582 integer(kind=kint) :: i,l,locc,loc,locp,invpos,ipinv,ii
1593 if(locc.ne.0)
goto 10
1595 mch(locp)=mch(locp)+1
1598 if(l.ge.neqns)
goto 1000
1601 if(locc.ne.0)
goto 10
1604 mch(locp)=mch(locp)+mch(loc)+1
1608 ipinv=pordr(invp(i))
1617 if(ii.gt.0.and.ii.le.neqns)
then
1620 parent(i)=qarent(invpos)
1623 if(ldbg)
write(idbg,6020)
1624 if(ldbg)
write(idbg,6000) (pordr(i),i=1,neqns)
1625 if(ldbg)
write(idbg,6030)
1626 if(ldbg)
write(idbg,6050)
1627 if(ldbg)
write(idbg,6000) (parent(i),i=1,neqns)
1628 if(ldbg)
write(idbg,6000) (invp(i),i=1,neqns)
1629 if(ldbg)
write(idbg,6040)
1630 if(ldbg)
write(idbg,6000) (iperm(i),i=1,neqns)
1631 if(ldbg)
write(idbg,6010)
1632 if(ldbg)
write(idbg,6000) (nch(i),i=1,neqns)
1635 6020
format(
' post order')
1636 6030
format(/
' invp ')
1637 6040
format(/
' iperm ')
1638 6050
format(/
' parent')
1640 end subroutine posord
1644 subroutine gnleaf(xadj,adjncy,invp,iperm,pordr,nch,adjncp,xleaf,leaf,neqns,lnleaf)
1648 integer(kind=kint),
intent(in) :: xadj(:),adjncy(:),pordr(:),nch(:),invp(:),iperm(:)
1649 integer(kind=kint),
intent(out) :: xleaf(:),leaf(:),adjncp(:)
1650 integer(kind=kint),
intent(in) :: neqns
1652 integer(kind=kint) i,k,l,m,ik,istart,ip,iq,lnleaf,lc1,lc
1660 do k=xadj(ip),xadj(ip+1)-1
1669 call qqsort(adjncp(istart+1:),m)
1670 lc1=adjncp(istart+1)
1671 if(lc1.ge.i)
goto 100
1677 if(lc1.lt.lc-nch(lc))
then
1690 if(ldbg)
write(idbg,6020)
1691 if(ldbg)
write(idbg,6000) (xleaf(i),i=1,neqns+1)
1692 if(ldbg)
write(idbg,6010) lnleaf
1693 if(ldbg)
write(idbg,6000) (leaf(i),i=1,lnleaf)
1696 6010
format(
' leaf (len = ',i6,
')')
1697 6020
format(
' xleaf')
1698 end subroutine gnleaf
1702 subroutine countclno(parent,xleaf,leaf,neqns,nstop,lncol,ir)
1712 integer(kind=kint),
intent(in) :: parent(:),xleaf(:),leaf(:)
1713 integer(kind=kint),
intent(in) :: neqns, nstop
1714 integer(kind=kint),
intent(out) :: lncol, ir
1716 integer(kind=kint) :: i,j,k,l,nc,ks,ke,nxleaf
1724 if(ke.lt.ks)
goto 100
1730 if(j.ge.nxleaf)
goto 110
1740 if(j.ge.nstop)
goto 100
1741 if(j.ge.i.or.j.eq.0)
goto 100
1748 end subroutine countclno
1752 subroutine gnclno(parent,pordr,xleaf,leaf,xlnzr,colno,neqns,nstop,lncol,ir)
1756 integer(kind=kint),
intent(in) :: parent(:),pordr(:),xleaf(:),leaf(:)
1757 integer(kind=kint),
intent(out) :: colno(:),xlnzr(:)
1758 integer(kind=kint),
intent(in) :: neqns, nstop
1759 integer(kind=kint),
intent(out) :: lncol,ir
1761 integer(kind=kint) :: i,j,k,l,nc,ks,ke,nxleaf
1770 if(ke.lt.ks)
goto 100
1776 if(j.ge.nxleaf)
goto 110
1787 if(j.ge.nstop)
goto 100
1788 if(j.ge.i.or.j.eq.0)
goto 100
1796 if(ldbg)
write(idbg,6010)
1798 if(ldbg)
write(idbg,6020) lncol
1802 write(idbg,6000) (colno(i),i=xlnzr(k),xlnzr(k+1)-1)
1806 6010
format(
' xlnzr')
1807 6020
format(
' colno (lncol =',i10,
')')
1808 6100
format(/
' row = ',i6)
1810 end subroutine gnclno
1814 subroutine qmdrch(root,xadj,adjncy,deg,marker,rchsze,rchset,nhdsze,nbrhd)
1818 integer(kind=kint),
intent(in) :: deg(:),xadj(:),adjncy(:)
1819 integer(kind=kint),
intent(out) :: rchset(:),nbrhd(:)
1820 integer(kind=kint),
intent(inout) :: marker(:)
1821 integer(kind=kint),
intent(in) :: root
1822 integer(kind=kint),
intent(out) :: nhdsze,rchsze
1824 integer(kind=kint) :: i,j, istrt, istop, jstrt, jstop, nabor, node
1829 istop=xadj(root+1)-1
1830 if(istop.lt.istrt)
return
1831 do 600 i=istrt,istop
1833 if(nabor.eq.0)
return
1834 if(marker(nabor).ne.0)
goto 600
1835 if(deg(nabor).lt.0)
goto 200
1837 rchset(rchsze)=nabor
1840 200 marker(nabor)=-1
1843 300 jstrt=xadj(nabor)
1844 jstop=xadj(nabor+1)-1
1845 do 500 j=jstrt,jstop
1851 elseif(node==0)
then
1854 400
if(marker(node).ne.0)
goto 500
1861 end subroutine qmdrch
1865 subroutine qmdupd(xadj,adjncy,nlist,list,deg,qsize,qlink,marker,rchset,nbrhd)
1869 integer(kind=kint),
intent(in) :: adjncy(:),list(:),xadj(:)
1870 integer(kind=kint),
intent(out) :: nbrhd(:),rchset(:)
1871 integer(kind=kint),
intent(inout) :: marker(:),deg(:),qsize(:),qlink(:)
1872 integer(kind=kint),
intent(in) :: nlist
1874 integer(kind=kint) :: j, deg0,deg1,il,inhd,inode,irch,jstrt,jstop,mark,nabor,nhdsze,node,rchsze
1876 if(nlist.le.0)
return
1881 deg0=deg0+qsize(node)
1883 jstop=xadj(node+1)-1
1885 do 100 j=jstrt,jstop
1887 if(marker(nabor).ne.0.or.deg(nabor).ge.0)
goto 100
1894 if(nhdsze.gt.0)
call qmdmrg(xadj,adjncy,deg,qsize,qlink,marker,deg0,nhdsze,nbrhd,rchset,nbrhd(nhdsze+1:))
1898 if(mark.gt.1.or.mark.lt.0)
goto 600
1899 call qmdrch(node,xadj,adjncy,deg,marker,rchsze,rchset,nhdsze,nbrhd)
1901 if(rchsze.le.0)
goto 400
1904 deg1=deg1+qsize(inode)
1907 400 deg(node)=deg1-1
1908 if(nhdsze.le.0)
goto 600
1915 end subroutine qmdupd
1919 subroutine qmdot(root,xadj,adjncy,marker,rchsze,rchset,nbrhd)
1923 integer(kind=kint),
intent(in) :: marker(:),rchset(:),nbrhd(:),xadj(:)
1924 integer(kind=kint),
intent(inout) :: adjncy(:)
1925 integer(kind=kint),
intent(in) :: rchsze,root
1927 integer(kind=kint) :: j,irch,inhd,node,jstrt,jstop,link,nabor
1932 100 jstrt=xadj(node)
1933 jstop=xadj(node+1)-2
1934 if(jstop.lt.jstrt)
goto 300
1937 adjncy(j)=rchset(irch)
1938 if(irch.ge.rchsze)
goto 400
1940 300 link=adjncy(jstop+1)
1942 if(link.lt.0)
goto 100
1945 adjncy(jstop+1)=-node
1948 do 600 irch=1,rchsze
1950 if(marker(node).lt.0)
goto 600
1952 jstop=xadj(node+1)-1
1953 do 500 j=jstrt,jstop
1955 if(marker(nabor).ge.0)
goto 500
1961 end subroutine qmdot
1965 subroutine qmdmrg(xadj,adjncy,deg,qsize,qlink,marker,deg0,nhdsze,nbrhd,rchset,ovrlp)
1969 integer(kind=kint),
intent(in) :: adjncy(:),nbrhd(:),xadj(:)
1970 integer(kind=kint),
intent(out) :: rchset(:),ovrlp(:)
1971 integer(kind=kint),
intent(inout) :: deg(:),marker(:),qsize(:), qlink(:)
1972 integer(kind=kint),
intent(in) :: nhdsze
1974 integer(kind=kint) :: j, deg0,deg1,head,inhd,iov,irch,jstrt,jstop,link,lnode,mark,mrgsze,nabor,node,novrlp,rchsze,root
1977 if(nhdsze.le.0)
return
1982 do 1400 inhd=1,nhdsze
1988 200 jstrt=xadj(root)
1989 jstop=xadj(root+1)-1
1990 do 600 j=jstrt,jstop
1996 elseif(nabor==0)
then
1999 300 mark=marker(nabor)
2007 rchset(rchsze)=nabor
2008 deg1=deg1+qsize(nabor)
2011 500
if(mark.gt.1)
goto 600
2018 do 1100 iov=1,novrlp
2021 jstop=xadj(node+1)-1
2022 do 800 j=jstrt,jstop
2024 if(marker(nabor).ne.0)
goto 800
2028 mrgsze=mrgsze+qsize(node)
2031 900 link=qlink(lnode)
2032 if(link.le.0)
goto 1000
2035 1000 qlink(lnode)=head
2038 if(head.le.0)
goto 1200
2040 deg(head)=deg0+deg1-1
2042 1200 root=nbrhd(inhd)
2044 if(rchsze.le.0)
goto 1400
2051 end subroutine qmdmrg
2055 subroutine ldudecomposec(xlnzr_a,colno_a,invp_a,iperm_a,ndeg,nttbr_c,irow_c,jcol_c,ncol,nrow,xlnzr_c,colno_c,lncol_c)
2061 integer(kind=kint),
intent(in) :: xlnzr_a(:)
2062 integer(kind=kint),
intent(in) :: colno_a(:)
2063 integer(kind=kint),
intent(in) :: iperm_a(:)
2064 integer(kind=kint),
intent(in) :: invp_a(:)
2065 integer(kind=kint),
intent(in) :: ndeg
2066 integer(kind=kint),
intent(in) :: nttbr_c
2067 integer(kind=kint),
intent(in) :: irow_c(:)
2068 integer(kind=kint),
intent(inout) :: jcol_c(:)
2069 integer(kind=kint),
intent(in) :: ncol
2070 integer(kind=kint),
intent(in) :: nrow
2073 integer(kind=kint),
pointer :: xlnzr_c(:)
2074 integer(kind=kint),
pointer :: colno_c(:)
2075 integer(kind=kint),
intent(out) :: lncol_c
2078 integer(kind=kint) :: i,j,k
2079 integer(kind=kint) :: ks, ke, ipass, ierr
2080 logical,
allocatable :: cnz(:)
2081 type(crs_matrix) :: crs_c
2085 jcol_c(i)=invp_a(jcol_c(i))
2092 allocate(cnz(ncol), stat=ierr)
2093 if(ierr .ne. 0)
then
2094 call errtrp(
'stop due to allocation error.')
2102 ke = crs_c%ia(k+1)-1
2103 if (ke .lt. ks)
then
2104 if (ipass .eq. 2)
then
2105 xlnzr_c(k+1)=lncol_c+1
2111 cnz(crs_c%ja(i)) = .true.
2118 if (ke .lt. ks)
then
2122 if (cnz(colno_a(j)))
then
2131 lncol_c = lncol_c + 1
2132 if (ipass .eq. 2)
then
2133 colno_c(lncol_c) = i
2137 if (ipass .eq. 2)
then
2138 xlnzr_c(k+1)=lncol_c + 1
2142 if (ipass .eq. 1)
then
2143 allocate(xlnzr_c(nrow+1),colno_c(lncol_c), stat=ierr)
2144 if(ierr .ne. 0)
then
2145 call errtrp(
'stop due to allocation error.')
2153 jcol_c(i)=iperm_a(jcol_c(i))
2158 end subroutine ldudecomposec
2166 integer(kind=kint),
intent(inout) :: iw(:)
2167 integer(kind=kint),
intent(in) :: ik
2169 integer(kind=kint) :: l,m,itemp
2183 if(iw(l).lt.iw(m))
goto 110
2196 subroutine staij1(isw,i,j,aij,dsi,ir)
2220 real(kind=
kreal),
intent(in) :: aij(:)
2221 integer(kind=kint),
intent(in) :: isw, i, j
2222 integer(kind=kint),
intent(out) :: ir
2224 integer(kind=kint) :: ndeg, neqns, nstop, ndeg2, ndeg2l, ierr
2229 ndeg2l=ndeg*(ndeg+1)/2
2236 if(dsi%stage.ne.20)
then
2237 if(dsi%stage.eq.30)
write(ilog,*)
'Warning a matrix was build up but never solved.'
2241 allocate(dsi%diag(ndeg2l,neqns), stat=ierr)
2242 if(ierr .ne. 0)
then
2243 call errtrp(
'stop due to allocation error.')
2249 allocate(dsi%zln(ndeg2,dsi%lncol), stat=ierr)
2250 if(ierr .ne. 0)
then
2251 call errtrp(
'stop due to allocation error.')
2265 call addr0(isw,i,j,aij,dsi%invp,dsi%xlnzr,dsi%colno,dsi%diag,dsi%zln,dsi%dsln,nstop,dsi%ndeg,ir)
2266 elseif(ndeg.eq.3)
then
2267 write(idbg,*)
'ndeg=1 only'
2270 write(idbg,*)
'ndeg=1 only'
2275 end subroutine staij1
2284 subroutine sum(ic,xlnzr,colno,zln,diag,nch,par,neqns)
2288 integer(kind=kint),
intent(in) :: xlnzr(:),colno(:),par(:)
2289 integer(kind=kint),
intent(in) :: ic, neqns
2290 real(kind=
kreal),
intent(inout) :: zln(:),diag(:)
2291 integer(kind=kint),
intent(inout) :: nch(:)
2293 real(kind=
kreal) :: s, t, zz, piv
2294 integer(kind=kint) :: ks, ke, kk, k, jc, jj, j, ierr
2295 integer(kind=kint) :: isem
2296 real(kind=
kreal),
allocatable :: temp(:)
2297 integer(kind=kint),
allocatable :: indx(:)
2298 allocate(temp(neqns),indx(neqns), stat=ierr)
2299 if(ierr .ne. 0)
then
2300 call errtrp(
'stop due to allocation error.')
2314 do jj=xlnzr(jc),xlnzr(jc+1)-1
2316 if(indx(j).eq.ic)
then
2330 if(dabs(piv).gt.rmin)
then
2349 subroutine sum1(ic,xlnzr,colno,zln,diag,par,neqns)
2353 integer(kind=kint),
intent(in) :: xlnzr(:),colno(:),par(:)
2354 integer(kind=kint),
intent(in) :: ic, neqns
2355 real(kind=
kreal),
intent(inout) :: zln(:),diag(:)
2357 real(kind=
kreal) :: s, t, zz
2358 integer(kind=kint) :: ks, ke, k, jc, j, jj, ierr
2359 real(kind=
kreal),
allocatable :: temp(:)
2360 integer(kind=kint),
allocatable :: indx(:)
2361 integer(kind=kint) :: i
2365 allocate(temp(neqns),indx(neqns), stat=ierr)
2366 if(ierr .ne. 0)
then
2367 call errtrp(
'stop due to allocation error.')
2384 do jj=xlnzr(jc),xlnzr(jc+1)-1
2386 if(indx(j).eq.ic)
then
2405 subroutine sum2_child(neqns,nstop,xlnzr,colno,zln,diag,spdslnidx,spdslnval,nspdsln)
2409 integer(kind=kint),
intent(in) :: neqns, nstop
2410 integer(kind=kint),
intent(in) :: xlnzr(:),colno(:)
2411 real(kind=
kreal),
intent(inout) :: zln(:),diag(:)
2412 integer(kind=kint),
pointer :: spdslnidx(:)
2413 real(kind=
kreal),
pointer :: spdslnval(:,:)
2414 integer(kind=kint),
intent(out) :: nspdsln
2416 integer(kind=kint) :: ks, ke, k, jc, jj, j, j1,j2
2417 integer(kind=kint) :: ic, i, loc, ierr
2418 integer(kind=kint) :: ispdsln
2420 real(kind=
kreal),
allocatable :: temp(:)
2421 integer(kind=kint),
allocatable :: indx(:)
2423 allocate(temp(neqns),indx(neqns), stat=ierr)
2424 if(ierr .ne. 0)
then
2425 call errtrp(
'stop due to allocation error.')
2440 do jj=xlnzr(jc),xlnzr(jc+1)-1
2442 if(indx(j).eq.ic)
then
2449 allocate(spdslnidx(nspdsln),spdslnval(1,nspdsln), stat=ierr)
2450 if(ierr .ne. 0)
then
2451 call errtrp(
'stop due to allocation error.')
2467 zln(k)=temp(jj)*diag(jj)
2469 diag(ic)=diag(ic)-temp(jj)*zln(k)
2473 do jj=xlnzr(jc),xlnzr(jc+1)-1
2475 if(indx(j).eq.ic)
then
2480 spdslnidx(ispdsln)=loc
2481 spdslnval(1,ispdsln)=spdslnval(1,ispdsln)-temp(j)*zln(jj)
2491 end subroutine sum2_child
2495 subroutine sum3(n,dsln,diag)
2499 real(kind=
kreal),
intent(inout) :: dsln(:),diag(:)
2500 integer(kind=kint),
intent(in) :: n
2502 integer(kind=kint) :: i, j, loc, ierr
2503 real(kind=
kreal),
allocatable :: temp(:)
2504 integer(kind=kint),
allocatable :: indx(:)
2505 allocate(temp(n),indx(n), stat=ierr)
2506 if(ierr .ne. 0)
then
2507 call errtrp(
'stop due to allocation error.')
2510 if(n.le.0)
goto 1000
2513 diag(1)=1.0d0/diag(1)
2517 dsln(loc)=dsln(loc)-dot_product(dsln(indx(i):indx(i)+j-2),dsln(indx(j):indx(j)+j-2))
2520 temp(1:i-1)=dsln(indx(i):indx(i)+i-2)*diag(1:i-1)
2521 diag(i)=diag(i)-dot_product(temp(1:i-1),dsln(indx(i):indx(i)+i-2))
2522 dsln(indx(i):indx(i)+i-2)=temp(1:i-1)
2523 diag(i)=1.0d0/diag(i)
2532 real(kind=
kreal)
function spdot2(b,zln,colno,ks,ke)
2536 integer(kind=kint),
intent(in) :: colno(:)
2537 integer(kind=kint),
intent(in) :: ks,ke
2538 real(kind=
kreal),
intent(in) :: zln(:),b(:)
2540 integer(kind=kint) :: j,jj
2541 real(kind=
kreal) :: s
2562 real(kind=
kreal)
function ddot(a,b,n)
2566 real(kind=
kreal),
intent(in) :: a(n),b(n)
2567 integer(kind=kint),
intent(in) :: n
2569 real(kind=
kreal) :: s
2570 integer(kind=kint) :: i
2582 subroutine addr0(isw,i,j,aij,invp,xlnzr,colno,diag,zln,dsln,nstop,ndeg,ir)
2586 integer(kind=kint),
intent(in) :: isw
2587 integer(kind=kint),
intent(in) :: i,j,nstop, ndeg, invp(:),xlnzr(:),colno(:)
2588 real(kind=
kreal),
intent(inout) :: zln(:,:),diag(:,:),dsln(:,:)
2589 real(kind=
kreal),
intent(in) :: aij(:)
2590 integer(kind=kint),
intent(out) :: ir
2592 integer(kind=kint) :: ndeg2, ii, jj, itrans, k, i0, j0, l, ks, ke
2593 integer(kind=kint),
parameter :: idbg=0
2599 if(idbg.ne.0)
write(idbg,*)
'addr0',ii,jj,aij
2605 diag(1,ii)=diag(1,ii)+aij(1)
2607 elseif(ndeg2.eq.4)
then
2613 diag(1,ii)=diag(1,ii)+aij(1)
2614 diag(2,ii)=diag(2,ii)+aij(2)
2615 diag(3,ii)=diag(3,ii)+aij(4)
2627 if(jj.ge.nstop)
then
2634 elseif(ndeg2.eq.4)
then
2635 if(itrans.eq.0)
then
2652 if(colno(k).eq.jj)
then
2656 elseif(ndeg2.eq.4)
then
2657 if(itrans.eq.0)
then
2670 zln(1,k)=zln(1,k)+aij(1)
2671 elseif(ndeg2.eq.4)
then
2672 if(itrans.eq.0)
then
2674 zln(l,k)=zln(l,k)+aij(l)
2677 zln(1,k)=zln(1,k)+aij(1)
2678 zln(2,k)=zln(2,k)+aij(3)
2679 zln(3,k)=zln(3,k)+aij(2)
2680 zln(4,k)=zln(4,k)+aij(4)
2690 end subroutine addr0
2696 subroutine verif0(ndeg,neqns_a0,nttbr_a0,irow_a0,jcol_a0,val_a0,neqns_l,nttbr_l,irow_l,jcol_l,val_l,rhs,x)
2700 integer(kind=kint),
intent(in) :: ndeg
2702 integer(kind=kint),
intent(in) :: irow_a0(:),jcol_a0(:)
2703 integer(kind=kint),
intent(in) :: neqns_a0,nttbr_a0
2704 real(kind=
kreal),
intent(in) :: val_a0(:,:)
2705 integer(kind=kint),
intent(in) :: irow_l(:),jcol_l(:)
2706 integer(kind=kint),
intent(in) :: neqns_l,nttbr_l
2707 real(kind=
kreal),
intent(in) :: val_l(:,:)
2709 real(kind=
kreal),
intent(in) :: x(:,:)
2710 real(kind=
kreal),
intent(inout) :: rhs(:,:)
2712 integer(kind=kint) :: i,j,k,l,m
2713 real(kind=
kreal) :: rel,err
2737 do i=1,neqns_a0+neqns_l
2739 rel=rel+dabs(rhs(l,i))
2749 rhs(l,i)=rhs(l,i)-val_a0(1,k)*x(m,j)
2750 if(i.ne.j) rhs(l,j)=rhs(l,j)-val_a0(1,k)*x(m,i)
2757 i=irow_l(k)+neqns_a0
2761 rhs(l,i)=rhs(l,i)-val_l(1,k)*x(m,j)
2762 if(i.ne.j) rhs(l,j)=rhs(l,j)-val_l(1,k)*x(m,i)
2768 do i=1,neqns_a0 + neqns_l
2770 err=err+dabs(rhs(l,i))
2774 write(imsg,6000) err,rel,err/rel
2775 6000
format(
' ***verification***(symmetric)'/&
2776 &
'norm(Ax-b) = ',1pd20.10/&
2777 &
'norm(b) = ',1pd20.10/&
2778 &
'norm(Ax-b)/norm(b) = ',1pd20.10)
2779 6010
format(1p4d15.7)
2781 end subroutine verif0
subroutine, public hecmw_solve_direct_serial_lag(nrows, ilag_sta, nttbr, pointers, indices, values, b)
subroutine qqsort(iw, ik)
subroutine, public symbolicirjctocrs(ndeg, nttbr, irow, jcol, ncols, nrows, c)
integer(kind=4), parameter kreal