|
|
|
|
@ -29,7 +29,6 @@
|
|
|
|
|
! POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
!
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
subroutine psb_c_coo_get_diag(a,d,info)
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_c_coo_get_diag
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
@ -1936,7 +1935,6 @@ subroutine psb_c_coo_aclsum(d,a)
|
|
|
|
|
end subroutine psb_c_coo_aclsum
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! == ==================================
|
|
|
|
|
!
|
|
|
|
|
!
|
|
|
|
|
@ -4159,7 +4157,6 @@ subroutine psb_lc_coo_get_diag(a,d,info)
|
|
|
|
|
|
|
|
|
|
end subroutine psb_lc_coo_get_diag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subroutine psb_lc_coo_scal(d,a,info,side)
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_scal
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
@ -4267,6 +4264,324 @@ subroutine psb_lc_coo_scals(d,a,info)
|
|
|
|
|
end subroutine psb_lc_coo_scals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function psb_lc_coo_maxval(a) result(res)
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_maxval
|
|
|
|
|
implicit none
|
|
|
|
|
class(psb_lc_coo_sparse_mat), intent(in) :: a
|
|
|
|
|
real(psb_spk_) :: res
|
|
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: i,j,k,m,n, nnz, ir, jc, nc, info
|
|
|
|
|
character(len=20) :: name='c_coo_maxval'
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
if (a%is_dev()) call a%sync()
|
|
|
|
|
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
res = sone
|
|
|
|
|
else
|
|
|
|
|
res = szero
|
|
|
|
|
end if
|
|
|
|
|
nnz = a%get_nzeros()
|
|
|
|
|
if (allocated(a%val)) then
|
|
|
|
|
nnz = min(nnz,size(a%val))
|
|
|
|
|
res = maxval(abs(a%val(1:nnz)))
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
end function psb_lc_coo_maxval
|
|
|
|
|
|
|
|
|
|
function psb_lc_coo_csnmi(a) result(res)
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_csnmi
|
|
|
|
|
implicit none
|
|
|
|
|
class(psb_lc_coo_sparse_mat), intent(in) :: a
|
|
|
|
|
real(psb_spk_) :: res
|
|
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: i,j,k,m,n, nnz, ir, jc, nc, info
|
|
|
|
|
real(psb_spk_) :: acc
|
|
|
|
|
real(psb_spk_), allocatable :: vt(:)
|
|
|
|
|
logical :: tra, is_unit
|
|
|
|
|
integer(psb_ipk_) :: err_act
|
|
|
|
|
character(len=20) :: name='c_coo_csnmi'
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
if (a%is_dev()) call a%sync()
|
|
|
|
|
|
|
|
|
|
res = szero
|
|
|
|
|
nnz = a%get_nzeros()
|
|
|
|
|
is_unit = a%is_unit()
|
|
|
|
|
if (a%is_by_rows()) then
|
|
|
|
|
i = 1
|
|
|
|
|
j = i
|
|
|
|
|
res = szero
|
|
|
|
|
do while (i<=nnz)
|
|
|
|
|
do while ((a%ia(j) == a%ia(i)).and. (j <= nnz))
|
|
|
|
|
j = j+1
|
|
|
|
|
enddo
|
|
|
|
|
if (is_unit) then
|
|
|
|
|
acc = sone
|
|
|
|
|
else
|
|
|
|
|
acc = szero
|
|
|
|
|
end if
|
|
|
|
|
do k=i, j-1
|
|
|
|
|
acc = acc + abs(a%val(k))
|
|
|
|
|
end do
|
|
|
|
|
res = max(res,acc)
|
|
|
|
|
i = j
|
|
|
|
|
end do
|
|
|
|
|
else
|
|
|
|
|
m = a%get_nrows()
|
|
|
|
|
allocate(vt(m),stat=info)
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
if (is_unit) then
|
|
|
|
|
vt = sone
|
|
|
|
|
else
|
|
|
|
|
vt = szero
|
|
|
|
|
end if
|
|
|
|
|
do j=1, nnz
|
|
|
|
|
i = a%ia(j)
|
|
|
|
|
vt(i) = vt(i) + abs(a%val(j))
|
|
|
|
|
end do
|
|
|
|
|
res = maxval(vt(1:m))
|
|
|
|
|
deallocate(vt,stat=info)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
end function psb_lc_coo_csnmi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function psb_lc_coo_csnm1(a) result(res)
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_const_mod
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_csnm1
|
|
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
class(psb_c_coo_sparse_mat), intent(in) :: a
|
|
|
|
|
real(psb_spk_) :: res
|
|
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: i,j,k,m,n, nnz, ir, jc, nc, info
|
|
|
|
|
real(psb_spk_) :: acc
|
|
|
|
|
real(psb_spk_), allocatable :: vt(:)
|
|
|
|
|
logical :: tra
|
|
|
|
|
integer(psb_ipk_) :: err_act
|
|
|
|
|
character(len=20) :: name='lc_coo_csnm1'
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
if (a%is_dev()) call a%sync()
|
|
|
|
|
|
|
|
|
|
res = szero
|
|
|
|
|
nnz = a%get_nzeros()
|
|
|
|
|
n = a%get_ncols()
|
|
|
|
|
allocate(vt(n),stat=info)
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
vt = sone
|
|
|
|
|
else
|
|
|
|
|
vt = szero
|
|
|
|
|
end if
|
|
|
|
|
do j=1, nnz
|
|
|
|
|
i = a%ja(j)
|
|
|
|
|
vt(i) = vt(i) + abs(a%val(j))
|
|
|
|
|
end do
|
|
|
|
|
res = maxval(vt(1:n))
|
|
|
|
|
deallocate(vt,stat=info)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
end function psb_lc_coo_csnm1
|
|
|
|
|
|
|
|
|
|
subroutine psb_lc_coo_rowsum(d,a)
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_const_mod
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_rowsum
|
|
|
|
|
class(psb_lc_coo_sparse_mat), intent(in) :: a
|
|
|
|
|
complex(psb_spk_), intent(out) :: d(:)
|
|
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: i,j,k,n, nnz, ir, jc, nc
|
|
|
|
|
integer(psb_epk_) :: m
|
|
|
|
|
complex(psb_spk_) :: acc
|
|
|
|
|
complex(psb_spk_), allocatable :: vt(:)
|
|
|
|
|
logical :: tra
|
|
|
|
|
integer(psb_ipk_) :: err_act, info
|
|
|
|
|
character(len=20) :: name='rowsum'
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
if (a%is_dev()) call a%sync()
|
|
|
|
|
|
|
|
|
|
m = a%get_nrows()
|
|
|
|
|
|
|
|
|
|
if (size(d) < m) then
|
|
|
|
|
info=psb_err_input_asize_small_i_
|
|
|
|
|
call psb_errpush(info,name,e_err=(/1_psb_epk_,size(d,kind=psb_epk_),m/))
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
d = cone
|
|
|
|
|
else
|
|
|
|
|
d = czero
|
|
|
|
|
end if
|
|
|
|
|
nnz = a%get_nzeros()
|
|
|
|
|
do j=1, nnz
|
|
|
|
|
i = a%ia(j)
|
|
|
|
|
d(i) = d(i) + a%val(j)
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
9999 call psb_error_handler(err_act)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
end subroutine psb_lc_coo_rowsum
|
|
|
|
|
|
|
|
|
|
subroutine psb_lc_coo_arwsum(d,a)
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_const_mod
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_arwsum
|
|
|
|
|
class(psb_lc_coo_sparse_mat), intent(in) :: a
|
|
|
|
|
real(psb_spk_), intent(out) :: d(:)
|
|
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: i,j,k,n, nnz, ir, jc, nc
|
|
|
|
|
integer(psb_epk_) :: m
|
|
|
|
|
real(psb_spk_) :: acc
|
|
|
|
|
real(psb_spk_), allocatable :: vt(:)
|
|
|
|
|
logical :: tra
|
|
|
|
|
integer(psb_ipk_) :: err_act, info
|
|
|
|
|
character(len=20) :: name='rowsum'
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
if (a%is_dev()) call a%sync()
|
|
|
|
|
|
|
|
|
|
m = a%get_nrows()
|
|
|
|
|
if (size(d) < m) then
|
|
|
|
|
info=psb_err_input_asize_small_i_
|
|
|
|
|
call psb_errpush(info,name,e_err=(/1_psb_epk_,size(d,kind=psb_epk_),m/))
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
d = sone
|
|
|
|
|
else
|
|
|
|
|
d = szero
|
|
|
|
|
end if
|
|
|
|
|
nnz = a%get_nzeros()
|
|
|
|
|
do j=1, nnz
|
|
|
|
|
i = a%ia(j)
|
|
|
|
|
d(i) = d(i) + abs(a%val(j))
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
9999 call psb_error_handler(err_act)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
end subroutine psb_lc_coo_arwsum
|
|
|
|
|
|
|
|
|
|
subroutine psb_lc_coo_colsum(d,a)
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_const_mod
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_colsum
|
|
|
|
|
class(psb_lc_coo_sparse_mat), intent(in) :: a
|
|
|
|
|
complex(psb_spk_), intent(out) :: d(:)
|
|
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: i,j,k,m, nnz, ir, jc, nc
|
|
|
|
|
integer(psb_epk_) :: n
|
|
|
|
|
complex(psb_spk_) :: acc
|
|
|
|
|
complex(psb_spk_), allocatable :: vt(:)
|
|
|
|
|
logical :: tra
|
|
|
|
|
integer(psb_ipk_) :: err_act, info
|
|
|
|
|
character(len=20) :: name='colsum'
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
if (a%is_dev()) call a%sync()
|
|
|
|
|
|
|
|
|
|
n = a%get_ncols()
|
|
|
|
|
if (size(d) < n) then
|
|
|
|
|
info=psb_err_input_asize_small_i_
|
|
|
|
|
call psb_errpush(info,name,e_err=(/1_psb_epk_,size(d,kind=psb_epk_),n/))
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
d = cone
|
|
|
|
|
else
|
|
|
|
|
d = czero
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
nnz = a%get_nzeros()
|
|
|
|
|
do j=1, nnz
|
|
|
|
|
k = a%ja(j)
|
|
|
|
|
d(k) = d(k) + a%val(j)
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
9999 call psb_error_handler(err_act)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
end subroutine psb_lc_coo_colsum
|
|
|
|
|
|
|
|
|
|
subroutine psb_lc_coo_aclsum(d,a)
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
use psb_const_mod
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_aclsum
|
|
|
|
|
class(psb_lc_coo_sparse_mat), intent(in) :: a
|
|
|
|
|
real(psb_spk_), intent(out) :: d(:)
|
|
|
|
|
|
|
|
|
|
integer(psb_lpk_) :: i,j,k,m, nnz, ir, jc, nc
|
|
|
|
|
integer(psb_epk_) :: n
|
|
|
|
|
real(psb_spk_) :: acc
|
|
|
|
|
real(psb_spk_), allocatable :: vt(:)
|
|
|
|
|
logical :: tra
|
|
|
|
|
integer(psb_ipk_) :: err_act, info
|
|
|
|
|
character(len=20) :: name='aclsum'
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
if (a%is_dev()) call a%sync()
|
|
|
|
|
|
|
|
|
|
n = a%get_ncols()
|
|
|
|
|
if (size(d) < n) then
|
|
|
|
|
info=psb_err_input_asize_small_i_
|
|
|
|
|
call psb_errpush(info,name,e_err=(/1_psb_epk_,size(d,kind=psb_epk_),n/))
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (a%is_unit()) then
|
|
|
|
|
d = sone
|
|
|
|
|
else
|
|
|
|
|
d = szero
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
nnz = a%get_nzeros()
|
|
|
|
|
do j=1, nnz
|
|
|
|
|
k = a%ja(j)
|
|
|
|
|
d(k) = d(k) + abs(a%val(j))
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
9999 call psb_error_handler(err_act)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
end subroutine psb_lc_coo_aclsum
|
|
|
|
|
|
|
|
|
|
subroutine psb_lc_coo_reallocate_nz(nz,a)
|
|
|
|
|
use psb_c_base_mat_mod, psb_protect_name => psb_lc_coo_reallocate_nz
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|