mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-20 21:02:26 +00:00
psblas:
base/serial/impl/psb_c_coo_impl.f90 base/serial/impl/psb_c_csc_impl.f90 base/serial/impl/psb_c_csr_impl.f90 base/serial/impl/psb_d_coo_impl.f90 base/serial/impl/psb_d_csc_impl.f90 base/serial/impl/psb_d_csr_impl.f90 base/serial/impl/psb_s_coo_impl.f90 base/serial/impl/psb_s_csc_impl.f90 base/serial/impl/psb_s_csr_impl.f90 base/serial/impl/psb_z_coo_impl.f90 base/serial/impl/psb_z_csc_impl.f90 base/serial/impl/psb_z_csr_impl.f90 Make sure allocation is at least size 1.
This commit is contained in:
@@ -193,14 +193,15 @@ subroutine psb_c_coo_reallocate_nz(nz,a)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: nz
|
||||
class(psb_c_coo_sparse_mat), intent(inout) :: a
|
||||
integer(psb_ipk_) :: err_act, info
|
||||
integer(psb_ipk_) :: err_act, info, nz_
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
character(len=20) :: name='c_coo_reallocate_nz'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,a%ja,a%val,info)
|
||||
nz_ = max(nz,ione)
|
||||
call psb_realloc(nz_,a%ia,a%ja,a%val,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
@@ -357,9 +358,9 @@ subroutine psb_c_coo_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -2537,9 +2537,10 @@ subroutine psb_c_csc_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,a%get_ncols()+1),a%icp,info)
|
||||
call psb_realloc(max(nz,ione),a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,&
|
||||
& a%get_ncols()+1), a%icp,info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
goto 9999
|
||||
@@ -2715,9 +2716,9 @@ subroutine psb_c_csc_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -1710,8 +1710,8 @@ subroutine psb_c_csr_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
call psb_realloc(max(nz,ione),a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(&
|
||||
& max(nz,a%get_nrows()+1,a%get_ncols()+1),a%irp,info)
|
||||
if (info /= psb_success_) then
|
||||
@@ -1789,9 +1789,9 @@ subroutine psb_c_csr_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -193,14 +193,15 @@ subroutine psb_d_coo_reallocate_nz(nz,a)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: nz
|
||||
class(psb_d_coo_sparse_mat), intent(inout) :: a
|
||||
integer(psb_ipk_) :: err_act, info
|
||||
integer(psb_ipk_) :: err_act, info, nz_
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
character(len=20) :: name='d_coo_reallocate_nz'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,a%ja,a%val,info)
|
||||
nz_ = max(nz,ione)
|
||||
call psb_realloc(nz_,a%ia,a%ja,a%val,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
@@ -357,9 +358,9 @@ subroutine psb_d_coo_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -2537,9 +2537,10 @@ subroutine psb_d_csc_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,a%get_ncols()+1),a%icp,info)
|
||||
call psb_realloc(max(nz,ione),a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,&
|
||||
& a%get_ncols()+1), a%icp,info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
goto 9999
|
||||
@@ -2715,9 +2716,9 @@ subroutine psb_d_csc_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -1710,8 +1710,8 @@ subroutine psb_d_csr_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
call psb_realloc(max(nz,ione),a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(&
|
||||
& max(nz,a%get_nrows()+1,a%get_ncols()+1),a%irp,info)
|
||||
if (info /= psb_success_) then
|
||||
@@ -1789,9 +1789,9 @@ subroutine psb_d_csr_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -193,14 +193,15 @@ subroutine psb_s_coo_reallocate_nz(nz,a)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: nz
|
||||
class(psb_s_coo_sparse_mat), intent(inout) :: a
|
||||
integer(psb_ipk_) :: err_act, info
|
||||
integer(psb_ipk_) :: err_act, info, nz_
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
character(len=20) :: name='s_coo_reallocate_nz'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,a%ja,a%val,info)
|
||||
nz_ = max(nz,ione)
|
||||
call psb_realloc(nz_,a%ia,a%ja,a%val,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
@@ -357,9 +358,9 @@ subroutine psb_s_coo_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -2537,9 +2537,10 @@ subroutine psb_s_csc_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,a%get_ncols()+1),a%icp,info)
|
||||
call psb_realloc(max(nz,ione),a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,&
|
||||
& a%get_ncols()+1), a%icp,info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
goto 9999
|
||||
@@ -2715,9 +2716,9 @@ subroutine psb_s_csc_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -1710,8 +1710,8 @@ subroutine psb_s_csr_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
call psb_realloc(max(nz,ione),a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(&
|
||||
& max(nz,a%get_nrows()+1,a%get_ncols()+1),a%irp,info)
|
||||
if (info /= psb_success_) then
|
||||
@@ -1789,9 +1789,9 @@ subroutine psb_s_csr_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -193,14 +193,15 @@ subroutine psb_z_coo_reallocate_nz(nz,a)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: nz
|
||||
class(psb_z_coo_sparse_mat), intent(inout) :: a
|
||||
integer(psb_ipk_) :: err_act, info
|
||||
integer(psb_ipk_) :: err_act, info, nz_
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
character(len=20) :: name='z_coo_reallocate_nz'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,a%ja,a%val,info)
|
||||
nz_ = max(nz,ione)
|
||||
call psb_realloc(nz_,a%ia,a%ja,a%val,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
@@ -357,9 +358,9 @@ subroutine psb_z_coo_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -2537,9 +2537,10 @@ subroutine psb_z_csc_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,a%get_ncols()+1),a%icp,info)
|
||||
call psb_realloc(max(nz,ione),a%ia,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,a%get_nrows()+1,&
|
||||
& a%get_ncols()+1), a%icp,info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_alloc_dealloc_,name)
|
||||
goto 9999
|
||||
@@ -2715,9 +2716,9 @@ subroutine psb_z_csc_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
@@ -1710,8 +1710,8 @@ subroutine psb_z_csr_reallocate_nz(nz,a)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_realloc(nz,a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(nz,a%val,info)
|
||||
call psb_realloc(max(nz,ione),a%ja,info)
|
||||
if (info == psb_success_) call psb_realloc(max(nz,ione),a%val,info)
|
||||
if (info == psb_success_) call psb_realloc(&
|
||||
& max(nz,a%get_nrows()+1,a%get_ncols()+1),a%irp,info)
|
||||
if (info /= psb_success_) then
|
||||
@@ -1789,9 +1789,9 @@ subroutine psb_z_csr_allocate_mnnz(m,n,a,nz)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(nz)) then
|
||||
nz_ = nz
|
||||
nz_ = max(nz,ione)
|
||||
else
|
||||
nz_ = max(7*m,7*n,1)
|
||||
nz_ = max(7*m,7*n,ione)
|
||||
end if
|
||||
if (nz_ < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
|
||||
Reference in New Issue
Block a user