base/modules/psb_c_base_mat_mod.f90
 base/modules/psb_d_base_mat_mod.f90
 base/modules/psb_s_base_mat_mod.f90
 base/modules/psb_z_base_mat_mod.f90
 base/serial/impl/psb_c_coo_impl.f90
 base/serial/impl/psb_d_coo_impl.f90
 base/serial/impl/psb_s_coo_impl.f90
 base/serial/impl/psb_z_coo_impl.f90

Added sort status to COO.
psblas-3.2.0
Salvatore Filippone 11 years ago
parent 045d4d5e32
commit 30346971b0

@ -131,6 +131,8 @@ module psb_c_base_mat_mod
!> Coefficient values. !> Coefficient values.
complex(psb_spk_), allocatable :: val(:) complex(psb_spk_), allocatable :: val(:)
integer, private :: sort_status=psb_unsorted_
contains contains
! !
! Data management methods. ! Data management methods.
@ -160,6 +162,13 @@ module psb_c_base_mat_mod
procedure, pass(a) :: print => psb_c_coo_print procedure, pass(a) :: print => psb_c_coo_print
procedure, pass(a) :: free => c_coo_free procedure, pass(a) :: free => c_coo_free
procedure, pass(a) :: mold => psb_c_coo_mold procedure, pass(a) :: mold => psb_c_coo_mold
procedure, pass(a) :: is_sorted => c_coo_is_sorted
procedure, pass(a) :: is_by_rows => c_coo_is_by_rows
procedure, pass(a) :: is_by_cols => c_coo_is_by_cols
procedure, pass(a) :: set_by_rows => c_coo_set_by_rows
procedure, pass(a) :: set_by_cols => c_coo_set_by_cols
procedure, pass(a) :: set_sort_status => c_coo_set_sort_status
! !
! This is COO specific ! This is COO specific
! !
@ -1292,7 +1301,7 @@ module psb_c_base_mat_mod
!! \param val(:) Coefficients !! \param val(:) Coefficients
!! \param nzout Number of entries after sorting/duplicate handling !! \param nzout Number of entries after sorting/duplicate handling
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1311,7 +1320,7 @@ module psb_c_base_mat_mod
!! \memberof psb_c_coo_sparse_mat !! \memberof psb_c_coo_sparse_mat
!! \brief Make sure the entries are sorted and duplicates are handled. !! \brief Make sure the entries are sorted and duplicates are handled.
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1742,6 +1751,29 @@ contains
res = a%nnz res = a%nnz
end function c_coo_get_nzeros end function c_coo_get_nzeros
function c_coo_is_by_rows(a) result(res)
implicit none
class(psb_c_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_)
end function c_coo_is_by_rows
function c_coo_is_by_cols(a) result(res)
implicit none
class(psb_c_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_col_major_)
end function c_coo_is_by_cols
function c_coo_is_sorted(a) result(res)
implicit none
class(psb_c_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_)
end function c_coo_is_sorted
! == ================================== ! == ==================================
! !
@ -1765,6 +1797,34 @@ contains
end subroutine c_coo_set_nzeros end subroutine c_coo_set_nzeros
subroutine c_coo_set_sort_status(ist,a)
implicit none
integer(psb_ipk_), intent(in) :: ist
class(psb_c_coo_sparse_mat), intent(inout) :: a
a%sort_status = ist
call a%set_sorted((a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_))
end subroutine c_coo_set_sort_status
subroutine c_coo_set_by_rows(a)
implicit none
class(psb_c_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_row_major_
call a%set_sorted()
end subroutine c_coo_set_by_rows
subroutine c_coo_set_by_cols(a)
implicit none
class(psb_c_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_col_major_
call a%set_sorted()
end subroutine c_coo_set_by_cols
! == ================================== ! == ==================================
! !
! !

@ -131,6 +131,8 @@ module psb_d_base_mat_mod
!> Coefficient values. !> Coefficient values.
real(psb_dpk_), allocatable :: val(:) real(psb_dpk_), allocatable :: val(:)
integer, private :: sort_status=psb_unsorted_
contains contains
! !
! Data management methods. ! Data management methods.
@ -160,6 +162,13 @@ module psb_d_base_mat_mod
procedure, pass(a) :: print => psb_d_coo_print procedure, pass(a) :: print => psb_d_coo_print
procedure, pass(a) :: free => d_coo_free procedure, pass(a) :: free => d_coo_free
procedure, pass(a) :: mold => psb_d_coo_mold procedure, pass(a) :: mold => psb_d_coo_mold
procedure, pass(a) :: is_sorted => d_coo_is_sorted
procedure, pass(a) :: is_by_rows => d_coo_is_by_rows
procedure, pass(a) :: is_by_cols => d_coo_is_by_cols
procedure, pass(a) :: set_by_rows => d_coo_set_by_rows
procedure, pass(a) :: set_by_cols => d_coo_set_by_cols
procedure, pass(a) :: set_sort_status => d_coo_set_sort_status
! !
! This is COO specific ! This is COO specific
! !
@ -1292,7 +1301,7 @@ module psb_d_base_mat_mod
!! \param val(:) Coefficients !! \param val(:) Coefficients
!! \param nzout Number of entries after sorting/duplicate handling !! \param nzout Number of entries after sorting/duplicate handling
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1311,7 +1320,7 @@ module psb_d_base_mat_mod
!! \memberof psb_d_coo_sparse_mat !! \memberof psb_d_coo_sparse_mat
!! \brief Make sure the entries are sorted and duplicates are handled. !! \brief Make sure the entries are sorted and duplicates are handled.
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1742,6 +1751,29 @@ contains
res = a%nnz res = a%nnz
end function d_coo_get_nzeros end function d_coo_get_nzeros
function d_coo_is_by_rows(a) result(res)
implicit none
class(psb_d_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_)
end function d_coo_is_by_rows
function d_coo_is_by_cols(a) result(res)
implicit none
class(psb_d_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_col_major_)
end function d_coo_is_by_cols
function d_coo_is_sorted(a) result(res)
implicit none
class(psb_d_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_)
end function d_coo_is_sorted
! == ================================== ! == ==================================
! !
@ -1765,6 +1797,34 @@ contains
end subroutine d_coo_set_nzeros end subroutine d_coo_set_nzeros
subroutine d_coo_set_sort_status(ist,a)
implicit none
integer(psb_ipk_), intent(in) :: ist
class(psb_d_coo_sparse_mat), intent(inout) :: a
a%sort_status = ist
call a%set_sorted((a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_))
end subroutine d_coo_set_sort_status
subroutine d_coo_set_by_rows(a)
implicit none
class(psb_d_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_row_major_
call a%set_sorted()
end subroutine d_coo_set_by_rows
subroutine d_coo_set_by_cols(a)
implicit none
class(psb_d_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_col_major_
call a%set_sorted()
end subroutine d_coo_set_by_cols
! == ================================== ! == ==================================
! !
! !

@ -131,6 +131,8 @@ module psb_s_base_mat_mod
!> Coefficient values. !> Coefficient values.
real(psb_spk_), allocatable :: val(:) real(psb_spk_), allocatable :: val(:)
integer, private :: sort_status=psb_unsorted_
contains contains
! !
! Data management methods. ! Data management methods.
@ -160,6 +162,13 @@ module psb_s_base_mat_mod
procedure, pass(a) :: print => psb_s_coo_print procedure, pass(a) :: print => psb_s_coo_print
procedure, pass(a) :: free => s_coo_free procedure, pass(a) :: free => s_coo_free
procedure, pass(a) :: mold => psb_s_coo_mold procedure, pass(a) :: mold => psb_s_coo_mold
procedure, pass(a) :: is_sorted => s_coo_is_sorted
procedure, pass(a) :: is_by_rows => s_coo_is_by_rows
procedure, pass(a) :: is_by_cols => s_coo_is_by_cols
procedure, pass(a) :: set_by_rows => s_coo_set_by_rows
procedure, pass(a) :: set_by_cols => s_coo_set_by_cols
procedure, pass(a) :: set_sort_status => s_coo_set_sort_status
! !
! This is COO specific ! This is COO specific
! !
@ -1292,7 +1301,7 @@ module psb_s_base_mat_mod
!! \param val(:) Coefficients !! \param val(:) Coefficients
!! \param nzout Number of entries after sorting/duplicate handling !! \param nzout Number of entries after sorting/duplicate handling
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1311,7 +1320,7 @@ module psb_s_base_mat_mod
!! \memberof psb_s_coo_sparse_mat !! \memberof psb_s_coo_sparse_mat
!! \brief Make sure the entries are sorted and duplicates are handled. !! \brief Make sure the entries are sorted and duplicates are handled.
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1742,6 +1751,29 @@ contains
res = a%nnz res = a%nnz
end function s_coo_get_nzeros end function s_coo_get_nzeros
function s_coo_is_by_rows(a) result(res)
implicit none
class(psb_s_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_)
end function s_coo_is_by_rows
function s_coo_is_by_cols(a) result(res)
implicit none
class(psb_s_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_col_major_)
end function s_coo_is_by_cols
function s_coo_is_sorted(a) result(res)
implicit none
class(psb_s_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_)
end function s_coo_is_sorted
! == ================================== ! == ==================================
! !
@ -1765,6 +1797,34 @@ contains
end subroutine s_coo_set_nzeros end subroutine s_coo_set_nzeros
subroutine s_coo_set_sort_status(ist,a)
implicit none
integer(psb_ipk_), intent(in) :: ist
class(psb_s_coo_sparse_mat), intent(inout) :: a
a%sort_status = ist
call a%set_sorted((a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_))
end subroutine s_coo_set_sort_status
subroutine s_coo_set_by_rows(a)
implicit none
class(psb_s_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_row_major_
call a%set_sorted()
end subroutine s_coo_set_by_rows
subroutine s_coo_set_by_cols(a)
implicit none
class(psb_s_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_col_major_
call a%set_sorted()
end subroutine s_coo_set_by_cols
! == ================================== ! == ==================================
! !
! !

@ -131,6 +131,8 @@ module psb_z_base_mat_mod
!> Coefficient values. !> Coefficient values.
complex(psb_dpk_), allocatable :: val(:) complex(psb_dpk_), allocatable :: val(:)
integer, private :: sort_status=psb_unsorted_
contains contains
! !
! Data management methods. ! Data management methods.
@ -160,6 +162,13 @@ module psb_z_base_mat_mod
procedure, pass(a) :: print => psb_z_coo_print procedure, pass(a) :: print => psb_z_coo_print
procedure, pass(a) :: free => z_coo_free procedure, pass(a) :: free => z_coo_free
procedure, pass(a) :: mold => psb_z_coo_mold procedure, pass(a) :: mold => psb_z_coo_mold
procedure, pass(a) :: is_sorted => z_coo_is_sorted
procedure, pass(a) :: is_by_rows => z_coo_is_by_rows
procedure, pass(a) :: is_by_cols => z_coo_is_by_cols
procedure, pass(a) :: set_by_rows => z_coo_set_by_rows
procedure, pass(a) :: set_by_cols => z_coo_set_by_cols
procedure, pass(a) :: set_sort_status => z_coo_set_sort_status
! !
! This is COO specific ! This is COO specific
! !
@ -1292,7 +1301,7 @@ module psb_z_base_mat_mod
!! \param val(:) Coefficients !! \param val(:) Coefficients
!! \param nzout Number of entries after sorting/duplicate handling !! \param nzout Number of entries after sorting/duplicate handling
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1311,7 +1320,7 @@ module psb_z_base_mat_mod
!! \memberof psb_z_coo_sparse_mat !! \memberof psb_z_coo_sparse_mat
!! \brief Make sure the entries are sorted and duplicates are handled. !! \brief Make sure the entries are sorted and duplicates are handled.
!! \param info return code !! \param info return code
!! \param idir [0] Sort in: row major order (0) or col major order (1) !! \param idir [psb_row_major_] Sort in row major order or col major order
!! !!
! !
interface interface
@ -1742,6 +1751,29 @@ contains
res = a%nnz res = a%nnz
end function z_coo_get_nzeros end function z_coo_get_nzeros
function z_coo_is_by_rows(a) result(res)
implicit none
class(psb_z_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_)
end function z_coo_is_by_rows
function z_coo_is_by_cols(a) result(res)
implicit none
class(psb_z_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_col_major_)
end function z_coo_is_by_cols
function z_coo_is_sorted(a) result(res)
implicit none
class(psb_z_coo_sparse_mat), intent(in) :: a
logical :: res
res = (a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_)
end function z_coo_is_sorted
! == ================================== ! == ==================================
! !
@ -1765,6 +1797,34 @@ contains
end subroutine z_coo_set_nzeros end subroutine z_coo_set_nzeros
subroutine z_coo_set_sort_status(ist,a)
implicit none
integer(psb_ipk_), intent(in) :: ist
class(psb_z_coo_sparse_mat), intent(inout) :: a
a%sort_status = ist
call a%set_sorted((a%sort_status == psb_row_major_) &
& .or.(a%sort_status == psb_col_major_))
end subroutine z_coo_set_sort_status
subroutine z_coo_set_by_rows(a)
implicit none
class(psb_z_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_row_major_
call a%set_sorted()
end subroutine z_coo_set_by_rows
subroutine z_coo_set_by_cols(a)
implicit none
class(psb_z_coo_sparse_mat), intent(inout) :: a
a%sort_status = psb_col_major_
call a%set_sorted()
end subroutine z_coo_set_by_cols
! == ================================== ! == ==================================
! !
! !

@ -3388,7 +3388,7 @@ subroutine psb_c_fix_coo(a,info,idir)
else else
i = nza i = nza
end if end if
call a%set_sorted() call a%set_sort_status(idir_)
call a%set_nzeros(i) call a%set_nzeros(i)
call a%set_asb() call a%set_asb()

@ -3388,7 +3388,7 @@ subroutine psb_d_fix_coo(a,info,idir)
else else
i = nza i = nza
end if end if
call a%set_sorted() call a%set_sort_status(idir_)
call a%set_nzeros(i) call a%set_nzeros(i)
call a%set_asb() call a%set_asb()

@ -3388,7 +3388,7 @@ subroutine psb_s_fix_coo(a,info,idir)
else else
i = nza i = nza
end if end if
call a%set_sorted() call a%set_sort_status(idir_)
call a%set_nzeros(i) call a%set_nzeros(i)
call a%set_asb() call a%set_asb()

@ -3388,7 +3388,7 @@ subroutine psb_z_fix_coo(a,info,idir)
else else
i = nza i = nza
end if end if
call a%set_sorted() call a%set_sort_status(idir_)
call a%set_nzeros(i) call a%set_nzeros(i)
call a%set_asb() call a%set_asb()

Loading…
Cancel
Save