diff --git a/base/modules/psb_c_base_mat_mod.f90 b/base/modules/psb_c_base_mat_mod.f90 index fa4b405c..d12afd05 100644 --- a/base/modules/psb_c_base_mat_mod.f90 +++ b/base/modules/psb_c_base_mat_mod.f90 @@ -130,6 +130,8 @@ module psb_c_base_mat_mod integer(psb_ipk_), allocatable :: ja(:) !> Coefficient values. complex(psb_spk_), allocatable :: val(:) + + integer, private :: sort_status=psb_unsorted_ contains ! @@ -160,6 +162,13 @@ module psb_c_base_mat_mod procedure, pass(a) :: print => psb_c_coo_print procedure, pass(a) :: free => c_coo_free 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 ! @@ -1292,7 +1301,7 @@ module psb_c_base_mat_mod !! \param val(:) Coefficients !! \param nzout Number of entries after sorting/duplicate handling !! \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 @@ -1311,7 +1320,7 @@ module psb_c_base_mat_mod !! \memberof psb_c_coo_sparse_mat !! \brief Make sure the entries are sorted and duplicates are handled. !! \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 @@ -1742,6 +1751,29 @@ contains res = a%nnz 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 + 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 + ! == ================================== ! ! diff --git a/base/modules/psb_d_base_mat_mod.f90 b/base/modules/psb_d_base_mat_mod.f90 index 785513c4..ce293ccb 100644 --- a/base/modules/psb_d_base_mat_mod.f90 +++ b/base/modules/psb_d_base_mat_mod.f90 @@ -130,6 +130,8 @@ module psb_d_base_mat_mod integer(psb_ipk_), allocatable :: ja(:) !> Coefficient values. real(psb_dpk_), allocatable :: val(:) + + integer, private :: sort_status=psb_unsorted_ contains ! @@ -160,6 +162,13 @@ module psb_d_base_mat_mod procedure, pass(a) :: print => psb_d_coo_print procedure, pass(a) :: free => d_coo_free 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 ! @@ -1292,7 +1301,7 @@ module psb_d_base_mat_mod !! \param val(:) Coefficients !! \param nzout Number of entries after sorting/duplicate handling !! \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 @@ -1311,7 +1320,7 @@ module psb_d_base_mat_mod !! \memberof psb_d_coo_sparse_mat !! \brief Make sure the entries are sorted and duplicates are handled. !! \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 @@ -1742,6 +1751,29 @@ contains res = a%nnz 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 + 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 + ! == ================================== ! ! diff --git a/base/modules/psb_s_base_mat_mod.f90 b/base/modules/psb_s_base_mat_mod.f90 index 5b0a2426..b77a99dd 100644 --- a/base/modules/psb_s_base_mat_mod.f90 +++ b/base/modules/psb_s_base_mat_mod.f90 @@ -130,6 +130,8 @@ module psb_s_base_mat_mod integer(psb_ipk_), allocatable :: ja(:) !> Coefficient values. real(psb_spk_), allocatable :: val(:) + + integer, private :: sort_status=psb_unsorted_ contains ! @@ -160,6 +162,13 @@ module psb_s_base_mat_mod procedure, pass(a) :: print => psb_s_coo_print procedure, pass(a) :: free => s_coo_free 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 ! @@ -1292,7 +1301,7 @@ module psb_s_base_mat_mod !! \param val(:) Coefficients !! \param nzout Number of entries after sorting/duplicate handling !! \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 @@ -1311,7 +1320,7 @@ module psb_s_base_mat_mod !! \memberof psb_s_coo_sparse_mat !! \brief Make sure the entries are sorted and duplicates are handled. !! \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 @@ -1742,6 +1751,29 @@ contains res = a%nnz 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 + 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 + ! == ================================== ! ! diff --git a/base/modules/psb_z_base_mat_mod.f90 b/base/modules/psb_z_base_mat_mod.f90 index aef49336..48551543 100644 --- a/base/modules/psb_z_base_mat_mod.f90 +++ b/base/modules/psb_z_base_mat_mod.f90 @@ -130,6 +130,8 @@ module psb_z_base_mat_mod integer(psb_ipk_), allocatable :: ja(:) !> Coefficient values. complex(psb_dpk_), allocatable :: val(:) + + integer, private :: sort_status=psb_unsorted_ contains ! @@ -160,6 +162,13 @@ module psb_z_base_mat_mod procedure, pass(a) :: print => psb_z_coo_print procedure, pass(a) :: free => z_coo_free 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 ! @@ -1292,7 +1301,7 @@ module psb_z_base_mat_mod !! \param val(:) Coefficients !! \param nzout Number of entries after sorting/duplicate handling !! \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 @@ -1311,7 +1320,7 @@ module psb_z_base_mat_mod !! \memberof psb_z_coo_sparse_mat !! \brief Make sure the entries are sorted and duplicates are handled. !! \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 @@ -1742,6 +1751,29 @@ contains res = a%nnz 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 + 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 + ! == ================================== ! ! diff --git a/base/serial/impl/psb_c_coo_impl.f90 b/base/serial/impl/psb_c_coo_impl.f90 index f20998fd..6151937e 100644 --- a/base/serial/impl/psb_c_coo_impl.f90 +++ b/base/serial/impl/psb_c_coo_impl.f90 @@ -3388,7 +3388,7 @@ subroutine psb_c_fix_coo(a,info,idir) else i = nza end if - call a%set_sorted() + call a%set_sort_status(idir_) call a%set_nzeros(i) call a%set_asb() diff --git a/base/serial/impl/psb_d_coo_impl.f90 b/base/serial/impl/psb_d_coo_impl.f90 index 91059b93..954bdf69 100644 --- a/base/serial/impl/psb_d_coo_impl.f90 +++ b/base/serial/impl/psb_d_coo_impl.f90 @@ -3388,7 +3388,7 @@ subroutine psb_d_fix_coo(a,info,idir) else i = nza end if - call a%set_sorted() + call a%set_sort_status(idir_) call a%set_nzeros(i) call a%set_asb() diff --git a/base/serial/impl/psb_s_coo_impl.f90 b/base/serial/impl/psb_s_coo_impl.f90 index 7e166348..11dc6c05 100644 --- a/base/serial/impl/psb_s_coo_impl.f90 +++ b/base/serial/impl/psb_s_coo_impl.f90 @@ -3388,7 +3388,7 @@ subroutine psb_s_fix_coo(a,info,idir) else i = nza end if - call a%set_sorted() + call a%set_sort_status(idir_) call a%set_nzeros(i) call a%set_asb() diff --git a/base/serial/impl/psb_z_coo_impl.f90 b/base/serial/impl/psb_z_coo_impl.f90 index d9927f8b..0ea2a21f 100644 --- a/base/serial/impl/psb_z_coo_impl.f90 +++ b/base/serial/impl/psb_z_coo_impl.f90 @@ -3388,7 +3388,7 @@ subroutine psb_z_fix_coo(a,info,idir) else i = nza end if - call a%set_sorted() + call a%set_sort_status(idir_) call a%set_nzeros(i) call a%set_asb()