|
|
|
@ -119,14 +119,14 @@ subroutine psb_dspmm(alpha,a,x,beta,y,desc_a,info,&
|
|
|
|
|
! check on blacs grid
|
|
|
|
|
call blacs_gridinfo(icontxt, nprow, npcol, myrow, mycol)
|
|
|
|
|
if (nprow == -1) then
|
|
|
|
|
info = 2010
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
info = 2010
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
else if (npcol /= 1) then
|
|
|
|
|
info = 2030
|
|
|
|
|
int_err(1) = npcol
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
info = 2030
|
|
|
|
|
int_err(1) = npcol
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ia = 1
|
|
|
|
@ -134,45 +134,46 @@ subroutine psb_dspmm(alpha,a,x,beta,y,desc_a,info,&
|
|
|
|
|
|
|
|
|
|
ix = 1
|
|
|
|
|
if (present(jx)) then
|
|
|
|
|
ijx = jx
|
|
|
|
|
ijx = jx
|
|
|
|
|
else
|
|
|
|
|
ijx = 1
|
|
|
|
|
ijx = 1
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
iy = 1
|
|
|
|
|
if (present(jy)) then
|
|
|
|
|
ijy = jy
|
|
|
|
|
ijy = jy
|
|
|
|
|
else
|
|
|
|
|
ijy = 1
|
|
|
|
|
ijy = 1
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if (present(doswap)) then
|
|
|
|
|
idoswap = doswap
|
|
|
|
|
idoswap = doswap
|
|
|
|
|
else
|
|
|
|
|
idoswap = 1
|
|
|
|
|
idoswap = 1
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if (present(k)) then
|
|
|
|
|
ik = min(k,size(x,2)-ijx+1)
|
|
|
|
|
ik = min(ik,size(y,2)-ijy+1)
|
|
|
|
|
ik = min(k,size(x,2)-ijx+1)
|
|
|
|
|
ik = min(ik,size(y,2)-ijy+1)
|
|
|
|
|
else
|
|
|
|
|
ik = min(size(x,2)-ijx+1,size(y,2)-ijy+1)
|
|
|
|
|
ik = min(size(x,2)-ijx+1,size(y,2)-ijy+1)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if (present(trans)) then
|
|
|
|
|
if((trans.eq.'N').or.(trans.eq.'T')) then
|
|
|
|
|
itrans = trans
|
|
|
|
|
else if (trans.eq.'C') then
|
|
|
|
|
info = 3020
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
else
|
|
|
|
|
info = 70
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
if ((trans.eq.'N').or.(trans.eq.'T')&
|
|
|
|
|
& .or.(trans.eq.'n').or.(trans.eq.'t')) then
|
|
|
|
|
itrans = trans
|
|
|
|
|
else if ((trans.eq.'C').or.(trans.eq.'c')) then
|
|
|
|
|
info = 3020
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
else
|
|
|
|
|
info = 70
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
else
|
|
|
|
|
itrans = 'N'
|
|
|
|
|
itrans = 'N'
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
m = desc_a%matrix_data(psb_m_)
|
|
|
|
@ -187,168 +188,168 @@ subroutine psb_dspmm(alpha,a,x,beta,y,desc_a,info,&
|
|
|
|
|
if (a%pr(1) /= 0) liwork = liwork + n * ik
|
|
|
|
|
if (a%pl(1) /= 0) liwork = liwork + m * ik
|
|
|
|
|
if (present(work)) then
|
|
|
|
|
if(size(work).lt.liwork) then
|
|
|
|
|
call psb_realloc(liwork,work,info)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_realloc'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
iwork => work
|
|
|
|
|
else
|
|
|
|
|
call psb_realloc(liwork,iwork,info)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
if(size(work).lt.liwork) then
|
|
|
|
|
call psb_realloc(liwork,work,info)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_realloc'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
iwork => work
|
|
|
|
|
else
|
|
|
|
|
call psb_realloc(liwork,iwork,info)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_realloc'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
iwork(1)=0.d0
|
|
|
|
|
|
|
|
|
|
! checking for matrix correctness
|
|
|
|
|
call psb_chkmat(m,n,ia,ja,desc_a%matrix_data,info,iia,jja)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_chkmat'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_chkmat'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (itrans.eq.'N') then
|
|
|
|
|
! Matrix is not transposed
|
|
|
|
|
if((ja.ne.ix).or.(ia.ne.iy)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3030
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
! checking for vectors correctness
|
|
|
|
|
call psb_chkvect(n,ik,size(x,1),ix,ijx,desc_a%matrix_data,info,iix,jjx)
|
|
|
|
|
call psb_chkvect(m,ik,size(y,1),iy,ijy,desc_a%matrix_data,info,iiy,jjy)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_chkvect'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if((iix.ne.1).or.(iiy.ne.1)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3040
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(idoswap.lt.0) x(nrow:ncol,1:ik)=0.d0
|
|
|
|
|
|
|
|
|
|
ib1=min(nb,ik)
|
|
|
|
|
xp => x(iix:lldx,jjx:jjx+ib1-1)
|
|
|
|
|
if(idoswap.gt.0)&
|
|
|
|
|
& call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),&
|
|
|
|
|
& ib1,dzero,xp,desc_a,iwork,info)
|
|
|
|
|
! Matrix is not transposed
|
|
|
|
|
if((ja.ne.ix).or.(ia.ne.iy)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3030
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
! checking for vectors correctness
|
|
|
|
|
call psb_chkvect(n,ik,size(x,1),ix,ijx,desc_a%matrix_data,info,iix,jjx)
|
|
|
|
|
call psb_chkvect(m,ik,size(y,1),iy,ijy,desc_a%matrix_data,info,iiy,jjy)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_chkvect'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if((iix.ne.1).or.(iiy.ne.1)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3040
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(idoswap.lt.0) x(nrow:ncol,1:ik)=0.d0
|
|
|
|
|
|
|
|
|
|
ib1=min(nb,ik)
|
|
|
|
|
xp => x(iix:lldx,jjx:jjx+ib1-1)
|
|
|
|
|
if(idoswap.gt.0)&
|
|
|
|
|
& call psi_swapdata(ior(psb_swap_send_,psb_swap_recv_),&
|
|
|
|
|
& ib1,dzero,xp,desc_a,iwork,info)
|
|
|
|
|
!!$ & call PSI_dSwapData(ior(SWAP_SEND,SWAP_RECV),ib1,&
|
|
|
|
|
!!$ & dzero,x(iix,jjx),lldx,desc_a%matrix_data,&
|
|
|
|
|
!!$ & desc_a%halo_index,iwork,liwork,info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blk: do i=1, ik, nb
|
|
|
|
|
ib=ib1
|
|
|
|
|
ib1 = max(0,min(nb,(ik)-(i-1+ib)))
|
|
|
|
|
xp => x(iix:lldx,jjx+i+ib-1:jjx+i+ib+ib1-2)
|
|
|
|
|
if((ib1.gt.0).and.(idoswap.gt.0))&
|
|
|
|
|
& call psi_swapdata(psb_swap_send_,ib1,&
|
|
|
|
|
& dzero,xp,desc_a,iwork,info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blk: do i=1, ik, nb
|
|
|
|
|
ib=ib1
|
|
|
|
|
ib1 = max(0,min(nb,(ik)-(i-1+ib)))
|
|
|
|
|
xp => x(iix:lldx,jjx+i+ib-1:jjx+i+ib+ib1-2)
|
|
|
|
|
if((ib1.gt.0).and.(idoswap.gt.0))&
|
|
|
|
|
& call psi_swapdata(psb_swap_send_,ib1,&
|
|
|
|
|
& dzero,xp,desc_a,iwork,info)
|
|
|
|
|
!!$ & call PSI_dSwapData(SWAP_SEND,ib1,&
|
|
|
|
|
!!$ & dzero,x(iix,jjx+i+ib-1),lldx,desc_a%matrix_data,&
|
|
|
|
|
!!$ & desc_a%halo_index,iwork,liwork,info)
|
|
|
|
|
if(info.ne.0) exit blk
|
|
|
|
|
|
|
|
|
|
! local Matrix-vector product
|
|
|
|
|
call dcsmm(itrans,nrow,ib,ncol,alpha,a%pr,a%fida,&
|
|
|
|
|
& a%descra,a%aspk,a%ia1,a%ia2,a%infoa,a%pl,&
|
|
|
|
|
& x(iix,jjx+i-1),lldx,beta,y(iiy,jjy+i-1),lldy,&
|
|
|
|
|
& iwork,liwork,info)
|
|
|
|
|
if(info.ne.0) exit blk
|
|
|
|
|
|
|
|
|
|
if((ib1.gt.0).and.(idoswap.gt.0))&
|
|
|
|
|
& call psi_swapdata(psb_swap_send_,ib1,&
|
|
|
|
|
& dzero,xp,desc_a,iwork,info)
|
|
|
|
|
if(info.ne.0) exit blk
|
|
|
|
|
|
|
|
|
|
! local Matrix-vector product
|
|
|
|
|
call dcsmm(itrans,nrow,ib,ncol,alpha,a%pr,a%fida,&
|
|
|
|
|
& a%descra,a%aspk,a%ia1,a%ia2,a%infoa,a%pl,&
|
|
|
|
|
& x(iix,jjx+i-1),lldx,beta,y(iiy,jjy+i-1),lldy,&
|
|
|
|
|
& iwork,liwork,info)
|
|
|
|
|
if(info.ne.0) exit blk
|
|
|
|
|
|
|
|
|
|
if((ib1.gt.0).and.(idoswap.gt.0))&
|
|
|
|
|
& call psi_swapdata(psb_swap_send_,ib1,&
|
|
|
|
|
& dzero,xp,desc_a,iwork,info)
|
|
|
|
|
!!$ & call PSI_dSwapData(SWAP_RECV,ib1,&
|
|
|
|
|
!!$ & dzero,x(iix,jjx+i+ib-1),lldx,desc_a%matrix_data,&
|
|
|
|
|
!!$ & desc_a%halo_index,iwork,liwork,info)
|
|
|
|
|
if(info.ne.0) exit blk
|
|
|
|
|
end do blk
|
|
|
|
|
if(info.ne.0) exit blk
|
|
|
|
|
end do blk
|
|
|
|
|
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info = 4011
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info = 4011
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
! Matrix is transposed
|
|
|
|
|
if((ja.ne.iy).or.(ia.ne.ix)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3030
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(desc_a%ovrlap_elem(1).ne.-1) then
|
|
|
|
|
info = 3070
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
! checking for vectors correctness
|
|
|
|
|
call psb_chkvect(m,ik,size(x,1),ix,ijx,desc_a%matrix_data,info,iix,jjx)
|
|
|
|
|
call psb_chkvect(n,ik,size(y,1),iy,ijy,desc_a%matrix_data,info,iiy,jjy)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_chkvect'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if((iix.ne.1).or.(iiy.ne.1)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3040
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(idoswap.lt.0) y(nrow:ncol,1:ik)=0.d0
|
|
|
|
|
|
|
|
|
|
! local Matrix-vector product
|
|
|
|
|
call dcsmm(itrans,ncol,ik,nrow,alpha,a%pr,a%fida,&
|
|
|
|
|
& a%descra,a%aspk,a%ia1,a%ia2,a%infoa,a%pl,&
|
|
|
|
|
& x(iix,jjx),lldx,beta,y(iiy,jjy),lldy,&
|
|
|
|
|
& iwork,liwork,info)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info = 4010
|
|
|
|
|
ch_err='dcsmm'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
yp => y(iiy:lldy,jjy:jjy+ik-1)
|
|
|
|
|
if(idoswap.gt.0)&
|
|
|
|
|
& call psi_swaptran(ior(psb_swap_send_,psb_swap_recv_),&
|
|
|
|
|
& ik,done,yp,desc_a,iwork,info)
|
|
|
|
|
! Matrix is transposed
|
|
|
|
|
if((ja.ne.iy).or.(ia.ne.ix)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3030
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(desc_a%ovrlap_elem(1).ne.-1) then
|
|
|
|
|
info = 3070
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
! checking for vectors correctness
|
|
|
|
|
call psb_chkvect(m,ik,size(x,1),ix,ijx,desc_a%matrix_data,info,iix,jjx)
|
|
|
|
|
call psb_chkvect(n,ik,size(y,1),iy,ijy,desc_a%matrix_data,info,iiy,jjy)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info=4010
|
|
|
|
|
ch_err='psb_chkvect'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if((iix.ne.1).or.(iiy.ne.1)) then
|
|
|
|
|
! this case is not yet implemented
|
|
|
|
|
info = 3040
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(idoswap.lt.0) y(nrow:ncol,1:ik)=0.d0
|
|
|
|
|
|
|
|
|
|
! local Matrix-vector product
|
|
|
|
|
call dcsmm(itrans,ncol,ik,nrow,alpha,a%pr,a%fida,&
|
|
|
|
|
& a%descra,a%aspk,a%ia1,a%ia2,a%infoa,a%pl,&
|
|
|
|
|
& x(iix,jjx),lldx,beta,y(iiy,jjy),lldy,&
|
|
|
|
|
& iwork,liwork,info)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info = 4010
|
|
|
|
|
ch_err='dcsmm'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
yp => y(iiy:lldy,jjy:jjy+ik-1)
|
|
|
|
|
if(idoswap.gt.0)&
|
|
|
|
|
& call psi_swaptran(ior(psb_swap_send_,psb_swap_recv_),&
|
|
|
|
|
& ik,done,yp,desc_a,iwork,info)
|
|
|
|
|
!!$ & call PSI_dSwapTran(ior(SWAP_SEND,SWAP_RECV),&
|
|
|
|
|
!!$ & ik,done,y(iiy,jjy),lldy,desc_a%matrix_data,&
|
|
|
|
|
!!$ & desc_a%halo_index,iwork,liwork,info)
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info = 4010
|
|
|
|
|
ch_err='PSI_dSwapTran'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
if(info.ne.0) then
|
|
|
|
|
info = 4010
|
|
|
|
|
ch_err='PSI_dSwapTran'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
@ -362,8 +363,8 @@ subroutine psb_dspmm(alpha,a,x,beta,y,desc_a,info,&
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
|
|
if (err_act.eq.act_abort) then
|
|
|
|
|
call psb_error(icontxt)
|
|
|
|
|
return
|
|
|
|
|
call psb_error(icontxt)
|
|
|
|
|
return
|
|
|
|
|
end if
|
|
|
|
|
return
|
|
|
|
|
end subroutine psb_dspmm
|
|
|
|
|