Started reorganization of SORT modules.

The implementation needs some work yet.
ILmat
Salvatore Filippone 8 years ago
parent 0a87766fdc
commit c4af410cfc

@ -27,14 +27,19 @@ UTIL_MODS = auxil/psb_string_mod.o desc/psb_desc_const_mod.o desc/psb_indx_map_m
desc/psb_gen_block_map_mod.o desc/psb_list_map_mod.o desc/psb_repl_map_mod.o\
desc/psb_glist_map_mod.o desc/psb_hash_map_mod.o \
desc/psb_desc_mod.o auxil/psb_sort_mod.o \
serial/psb_s_serial_mod.o serial/psb_d_serial_mod.o serial/psb_c_serial_mod.o serial/psb_z_serial_mod.o \
serial/psb_s_serial_mod.o serial/psb_d_serial_mod.o \
serial/psb_c_serial_mod.o serial/psb_z_serial_mod.o \
serial/psb_serial_mod.o \
tools/psb_cd_tools_mod.o tools/psb_i_tools_mod.o tools/psb_s_tools_mod.o tools/psb_d_tools_mod.o\
tools/psb_c_tools_mod.o tools/psb_z_tools_mod.o tools/psb_tools_mod.o \
tools/psb_cd_tools_mod.o tools/psb_i_tools_mod.o \
tools/psb_s_tools_mod.o tools/psb_d_tools_mod.o\
tools/psb_c_tools_mod.o tools/psb_z_tools_mod.o \
tools/psb_tools_mod.o \
psb_penv_mod.o $(COMMINT) psb_error_impl.o \
comm/psb_base_linmap_mod.o comm/psb_linmap_mod.o \
comm/psb_s_linmap_mod.o comm/psb_d_linmap_mod.o comm/psb_c_linmap_mod.o comm/psb_z_linmap_mod.o \
comm/psb_comm_mod.o comm/psb_i_comm_mod.o comm/psb_s_comm_mod.o comm/psb_d_comm_mod.o\
comm/psb_s_linmap_mod.o comm/psb_d_linmap_mod.o \
comm/psb_c_linmap_mod.o comm/psb_z_linmap_mod.o \
comm/psb_comm_mod.o comm/psb_i_comm_mod.o \
comm/psb_s_comm_mod.o comm/psb_d_comm_mod.o\
comm/psb_c_comm_mod.o comm/psb_z_comm_mod.o \
serial/psb_i_base_vect_mod.o serial/psb_i_vect_mod.o\
serial/psb_d_base_vect_mod.o serial/psb_d_vect_mod.o\
@ -43,17 +48,34 @@ UTIL_MODS = auxil/psb_string_mod.o desc/psb_desc_const_mod.o desc/psb_indx_map_m
serial/psb_z_base_vect_mod.o serial/psb_z_vect_mod.o\
serial/psb_vect_mod.o\
psblas/psb_s_psblas_mod.o psblas/psb_c_psblas_mod.o \
psblas/psb_d_psblas_mod.o psblas/psb_z_psblas_mod.o psblas/psb_psblas_mod.o \
psblas/psb_d_psblas_mod.o psblas/psb_z_psblas_mod.o \
psblas/psb_psblas_mod.o \
auxil/psi_serial_mod.o auxil/psi_i_serial_mod.o \
auxil/psi_s_serial_mod.o auxil/psi_d_serial_mod.o auxil/psi_c_serial_mod.o auxil/psi_z_serial_mod.o \
auxil/psi_s_serial_mod.o auxil/psi_d_serial_mod.o \
auxil/psi_c_serial_mod.o auxil/psi_z_serial_mod.o \
psi_mod.o psi_i_mod.o psi_s_mod.o psi_d_mod.o psi_c_mod.o psi_z_mod.o\
auxil/psb_ip_reord_mod.o\
auxil/psb_i_ip_reord_mod.o auxil/psb_l_ip_reord_mod.o \
auxil/psb_s_ip_reord_mod.o auxil/psb_d_ip_reord_mod.o \
auxil/psb_c_ip_reord_mod.o auxil/psb_z_ip_reord_mod.o \
auxil/psb_i_sort_mod.o auxil/psb_l_sort_mod.o \
auxil/psb_s_sort_mod.o auxil/psb_d_sort_mod.o \
auxil/psb_c_sort_mod.o auxil/psb_z_sort_mod.o \
auxil/psb_m_hsort_mod.o auxil/psb_m_isort_mod.o \
auxil/psb_m_msort_mod.o auxil/psb_m_qsort_mod.o \
auxil/psb_e_hsort_mod.o auxil/psb_e_isort_mod.o \
auxil/psb_e_msort_mod.o auxil/psb_e_qsort_mod.o \
auxil/psb_s_hsort_mod.o auxil/psb_s_isort_mod.o \
auxil/psb_s_msort_mod.o auxil/psb_s_qsort_mod.o \
auxil/psb_d_hsort_mod.o auxil/psb_d_isort_mod.o \
auxil/psb_d_msort_mod.o auxil/psb_d_qsort_mod.o \
auxil/psb_c_hsort_mod.o auxil/psb_c_isort_mod.o \
auxil/psb_c_msort_mod.o auxil/psb_c_qsort_mod.o \
auxil/psb_z_hsort_mod.o auxil/psb_z_isort_mod.o \
auxil/psb_z_msort_mod.o auxil/psb_z_qsort_mod.o \
auxil/psb_i_hsort_x_mod.o \
auxil/psb_l_hsort_x_mod.o \
auxil/psb_s_hsort_x_mod.o \
auxil/psb_d_hsort_x_mod.o \
auxil/psb_c_hsort_x_mod.o \
auxil/psb_z_hsort_x_mod.o \
psb_check_mod.o auxil/psb_hash_mod.o\
serial/psb_base_mat_mod.o serial/psb_mat_mod.o\
serial/psb_s_base_mat_mod.o serial/psb_s_csr_mat_mod.o serial/psb_s_csc_mat_mod.o serial/psb_s_mat_mod.o \
@ -113,10 +135,34 @@ auxil/psb_string_mod.o desc/psb_desc_const_mod.o psi_comm_buffers_mod.o: psb_con
auxil/psb_hash_mod.o: psb_realloc_mod.o psb_const_mod.o
auxil/psb_i_sort_mod.o auxil/psb_s_sort_mod.o auxil/psb_d_sort_mod.o auxil/psb_c_sort_mod.o auxil/psb_z_sort_mod.o \
auxil/psb_ip_reord_mod.o auxil/psi_serial_mod.o auxil/psb_sort_mod.o: $(BASIC_MODS)
auxil/psb_sort_mod.o: auxil/psb_i_sort_mod.o auxil/psb_l_sort_mod.o \
auxil/psb_s_sort_mod.o auxil/psb_d_sort_mod.o \
auxil/psb_c_sort_mod.o auxil/psb_z_sort_mod.o \
auxil/psb_sort_mod.o: auxil/psb_m_hsort_mod.o auxil/psb_m_isort_mod.o \
auxil/psb_m_msort_mod.o auxil/psb_m_qsort_mod.o \
auxil/psb_e_hsort_mod.o auxil/psb_e_isort_mod.o \
auxil/psb_e_msort_mod.o auxil/psb_e_qsort_mod.o \
auxil/psb_s_hsort_mod.o auxil/psb_s_isort_mod.o \
auxil/psb_s_msort_mod.o auxil/psb_s_qsort_mod.o \
auxil/psb_d_hsort_mod.o auxil/psb_d_isort_mod.o \
auxil/psb_d_msort_mod.o auxil/psb_d_qsort_mod.o \
auxil/psb_c_hsort_mod.o auxil/psb_c_isort_mod.o \
auxil/psb_c_msort_mod.o auxil/psb_c_qsort_mod.o \
auxil/psb_z_hsort_mod.o auxil/psb_z_isort_mod.o \
auxil/psb_z_msort_mod.o auxil/psb_z_qsort_mod.o \
auxil/psb_i_hsort_x_mod.o \
auxil/psb_l_hsort_x_mod.o \
auxil/psb_s_hsort_x_mod.o \
auxil/psb_d_hsort_x_mod.o \
auxil/psb_c_hsort_x_mod.o \
auxil/psb_z_hsort_x_mod.o \
auxil/psb_ip_reord_mod.o auxil/psi_serial_mod.o
auxil/psb_i_hsort_x_mod.o: auxil/psb_m_hsort_mod.o auxil/psb_e_hsort_mod.o
auxil/psb_l_hsort_x_mod.o: auxil/psb_m_hsort_mod.o auxil/psb_e_hsort_mod.o
auxil/psb_s_hsort_x_mod.o: auxil/psb_s_hsort_mod.o
auxil/psb_d_hsort_x_mod.o: auxil/psb_d_hsort_mod.o
auxil/psb_c_hsort_x_mod.o: auxil/psb_c_hsort_mod.o
auxil/psb_z_hsort_x_mod.o: auxil/psb_z_hsort_mod.o
auxil/psi_serial_mod.o: auxil/psi_i_serial_mod.o \
auxil/psi_s_serial_mod.o auxil/psi_d_serial_mod.o auxil/psi_c_serial_mod.o auxil/psi_z_serial_mod.o
auxil/psi_i_serial_mod.o auxil/psi_s_serial_mod.o auxil/psi_d_serial_mod.o auxil/psi_c_serial_mod.o auxil/psi_z_serial_mod.o: psb_const_mod.o

@ -0,0 +1,125 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_c_hsort_mod
use psb_const_mod
interface psb_hsort
subroutine psb_chsort(x,ix,dir,flag)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_chsort
end interface psb_hsort
interface psi_insert_heap
subroutine psi_c_insert_heap(key,last,heap,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
complex(psb_spk_), intent(in) :: key
complex(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_c_insert_heap
end interface psi_insert_heap
interface psi_idx_insert_heap
subroutine psi_c_idx_insert_heap(key,index,last,heap,idxs,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
complex(psb_spk_), intent(in) :: key
complex(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: index
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_c_idx_insert_heap
end interface psi_idx_insert_heap
interface psi_heap_get_first
subroutine psi_c_heap_get_first(key,last,heap,dir,info)
import
implicit none
complex(psb_spk_), intent(inout) :: key
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(in) :: dir
complex(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_c_heap_get_first
end interface psi_heap_get_first
interface psi_idx_heap_get_first
subroutine psi_c_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
import
complex(psb_spk_), intent(inout) :: key
integer(psb_ipk_), intent(out) :: index
complex(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_c_idx_heap_get_first
end interface psi_idx_heap_get_first
end module psb_c_hsort_mod

@ -0,0 +1,308 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_c_hsort_x_mod
use psb_const_mod
use psb_c_hsort_mod
type psb_c_heap
integer(psb_ipk_) :: last, dir
complex(psb_spk_), allocatable :: keys(:)
contains
procedure, pass(heap) :: init => psb_c_init_heap
procedure, pass(heap) :: howmany => psb_c_howmany
procedure, pass(heap) :: insert => psb_c_insert_heap
procedure, pass(heap) :: get_first => psb_c_heap_get_first
procedure, pass(heap) :: dump => psb_c_dump_heap
procedure, pass(heap) :: free => psb_c_free_heap
end type psb_c_heap
type psb_c_idx_heap
integer(psb_ipk_) :: last, dir
complex(psb_spk_), allocatable :: keys(:)
integer(psb_ipk_), allocatable :: idxs(:)
contains
procedure, pass(heap) :: init => psb_c_idx_init_heap
procedure, pass(heap) :: howmany => psb_c_idx_howmany
procedure, pass(heap) :: insert => psb_c_idx_insert_heap
procedure, pass(heap) :: get_first => psb_c_idx_heap_get_first
procedure, pass(heap) :: dump => psb_c_idx_dump_heap
procedure, pass(heap) :: free => psb_c_idx_free_heap
end type psb_c_idx_heap
contains
subroutine psb_c_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_c_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_asort_up_
endif
select case(heap%dir)
case (psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_asort_up_'
heap%dir = psb_asort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
return
end subroutine psb_c_init_heap
function psb_c_howmany(heap) result(res)
implicit none
class(psb_c_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_c_howmany
subroutine psb_c_insert_heap(key,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
complex(psb_spk_), intent(in) :: key
class(psb_c_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_insert_heap(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_c_insert_heap
subroutine psb_c_heap_get_first(key,heap,info)
implicit none
class(psb_c_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
complex(psb_spk_), intent(out) :: key
info = psb_success_
call psi_heap_get_first(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_c_heap_get_first
subroutine psb_c_dump_heap(iout,heap,info)
implicit none
class(psb_c_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
end if
end subroutine psb_c_dump_heap
subroutine psb_c_free_heap(heap,info)
implicit none
class(psb_c_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
end subroutine psb_c_free_heap
subroutine psb_c_idx_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_c_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_asort_up_
endif
select case(heap%dir)
case (psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_asort_up_'
heap%dir = psb_asort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
call psb_ensure_size(psb_heap_resize,heap%idxs,info)
return
end subroutine psb_c_idx_init_heap
function psb_c_idx_howmany(heap) result(res)
implicit none
class(psb_c_idx_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_c_idx_howmany
subroutine psb_c_idx_insert_heap(key,index,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
complex(psb_spk_), intent(in) :: key
integer(psb_ipk_), intent(in) :: index
class(psb_c_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info == psb_success_) &
& call psb_ensure_size(heap%last+1,heap%idxs,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_idx_insert_heap(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_c_idx_insert_heap
subroutine psb_c_idx_heap_get_first(key,index,heap,info)
implicit none
class(psb_c_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: index
integer(psb_ipk_), intent(out) :: info
complex(psb_spk_), intent(out) :: key
info = psb_success_
call psi_idx_heap_get_first(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_c_idx_heap_get_first
subroutine psb_c_idx_dump_heap(iout,heap,info)
implicit none
class(psb_c_idx_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else if ((heap%last > 0).and.((.not.allocated(heap%idxs)).or.&
& (size(heap%idxs)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
write(iout,*) heap%idxs(1:heap%last)
end if
end subroutine psb_c_idx_dump_heap
subroutine psb_c_idx_free_heap(heap,info)
implicit none
class(psb_c_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
if ((info == psb_success_).and.(allocated(heap%idxs))) &
& deallocate(heap%idxs,stat=info)
end subroutine psb_c_idx_free_heap
end module psb_c_hsort_x_mod

@ -0,0 +1,127 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_c_isort_mod
use psb_const_mod
interface psb_isort
subroutine psb_cisort(x,ix,dir,flag)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_cisort
end interface psb_isort
interface
subroutine psi_clisrx_up(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clisrx_up
subroutine psi_clisrx_dw(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clisrx_dw
subroutine psi_clisr_up(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clisr_up
subroutine psi_clisr_dw(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clisr_dw
subroutine psi_calisrx_up(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calisrx_up
subroutine psi_calisrx_dw(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calisrx_dw
subroutine psi_calisr_up(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calisr_up
subroutine psi_calisr_dw(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calisr_dw
subroutine psi_caisrx_up(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caisrx_up
subroutine psi_caisrx_dw(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caisrx_dw
subroutine psi_caisr_up(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caisr_up
subroutine psi_caisr_dw(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caisr_dw
end interface
end module psb_c_isort_mod

@ -0,0 +1,113 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_c_msort_mod
use psb_const_mod
interface psb_msort_unique
subroutine psb_cmsort_u(x,nout,dir)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(out) :: nout
integer(psb_ipk_), optional, intent(in) :: dir
end subroutine psb_cmsort_u
end interface psb_msort_unique
interface psb_msort
subroutine psb_cmsort(x,ix,dir,flag)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_cmsort
end interface psb_msort
interface
subroutine psi_c_lmsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_c_lmsort_up
subroutine psi_c_lmsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_c_lmsort_dw
subroutine psi_c_almsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_c_almsort_up
subroutine psi_c_almsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_c_almsort_dw
end interface
interface
subroutine psi_c_amsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_c_amsort_up
subroutine psi_c_amsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_c_amsort_dw
end interface
end module psb_c_msort_mod

@ -0,0 +1,126 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_c_qsort_mod
use psb_const_mod
interface psb_qsort
subroutine psb_cqsort(x,ix,dir,flag)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_cqsort
end interface psb_qsort
interface
subroutine psi_clqsrx_up(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clqsrx_up
subroutine psi_clqsrx_dw(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clqsrx_dw
subroutine psi_clqsr_up(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clqsr_up
subroutine psi_clqsr_dw(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_clqsr_dw
subroutine psi_calqsrx_up(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calqsrx_up
subroutine psi_calqsrx_dw(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calqsrx_dw
subroutine psi_calqsr_up(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calqsr_up
subroutine psi_calqsr_dw(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_calqsr_dw
subroutine psi_caqsrx_up(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caqsrx_up
subroutine psi_caqsrx_dw(n,x,ix)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caqsrx_dw
subroutine psi_caqsr_up(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caqsr_up
subroutine psi_caqsr_dw(n,x)
import
complex(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_caqsr_dw
end interface
end module psb_c_qsort_mod

@ -0,0 +1,125 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_d_hsort_mod
use psb_const_mod
interface psb_hsort
subroutine psb_dhsort(x,ix,dir,flag)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_dhsort
end interface psb_hsort
interface psi_insert_heap
subroutine psi_d_insert_heap(key,last,heap,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
real(psb_dpk_), intent(in) :: key
real(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_d_insert_heap
end interface psi_insert_heap
interface psi_idx_insert_heap
subroutine psi_d_idx_insert_heap(key,index,last,heap,idxs,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
real(psb_dpk_), intent(in) :: key
real(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: index
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_d_idx_insert_heap
end interface psi_idx_insert_heap
interface psi_heap_get_first
subroutine psi_d_heap_get_first(key,last,heap,dir,info)
import
implicit none
real(psb_dpk_), intent(inout) :: key
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(in) :: dir
real(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_d_heap_get_first
end interface psi_heap_get_first
interface psi_idx_heap_get_first
subroutine psi_d_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
import
real(psb_dpk_), intent(inout) :: key
integer(psb_ipk_), intent(out) :: index
real(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_d_idx_heap_get_first
end interface psi_idx_heap_get_first
end module psb_d_hsort_mod

@ -0,0 +1,308 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_d_hsort_x_mod
use psb_const_mod
use psb_d_hsort_mod
type psb_d_heap
integer(psb_ipk_) :: last, dir
real(psb_dpk_), allocatable :: keys(:)
contains
procedure, pass(heap) :: init => psb_d_init_heap
procedure, pass(heap) :: howmany => psb_d_howmany
procedure, pass(heap) :: insert => psb_d_insert_heap
procedure, pass(heap) :: get_first => psb_d_heap_get_first
procedure, pass(heap) :: dump => psb_d_dump_heap
procedure, pass(heap) :: free => psb_d_free_heap
end type psb_d_heap
type psb_d_idx_heap
integer(psb_ipk_) :: last, dir
real(psb_dpk_), allocatable :: keys(:)
integer(psb_ipk_), allocatable :: idxs(:)
contains
procedure, pass(heap) :: init => psb_d_idx_init_heap
procedure, pass(heap) :: howmany => psb_d_idx_howmany
procedure, pass(heap) :: insert => psb_d_idx_insert_heap
procedure, pass(heap) :: get_first => psb_d_idx_heap_get_first
procedure, pass(heap) :: dump => psb_d_idx_dump_heap
procedure, pass(heap) :: free => psb_d_idx_free_heap
end type psb_d_idx_heap
contains
subroutine psb_d_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_d_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
return
end subroutine psb_d_init_heap
function psb_d_howmany(heap) result(res)
implicit none
class(psb_d_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_d_howmany
subroutine psb_d_insert_heap(key,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
real(psb_dpk_), intent(in) :: key
class(psb_d_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_insert_heap(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_d_insert_heap
subroutine psb_d_heap_get_first(key,heap,info)
implicit none
class(psb_d_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_), intent(out) :: key
info = psb_success_
call psi_heap_get_first(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_d_heap_get_first
subroutine psb_d_dump_heap(iout,heap,info)
implicit none
class(psb_d_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
end if
end subroutine psb_d_dump_heap
subroutine psb_d_free_heap(heap,info)
implicit none
class(psb_d_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
end subroutine psb_d_free_heap
subroutine psb_d_idx_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_d_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
call psb_ensure_size(psb_heap_resize,heap%idxs,info)
return
end subroutine psb_d_idx_init_heap
function psb_d_idx_howmany(heap) result(res)
implicit none
class(psb_d_idx_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_d_idx_howmany
subroutine psb_d_idx_insert_heap(key,index,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
real(psb_dpk_), intent(in) :: key
integer(psb_ipk_), intent(in) :: index
class(psb_d_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info == psb_success_) &
& call psb_ensure_size(heap%last+1,heap%idxs,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_idx_insert_heap(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_d_idx_insert_heap
subroutine psb_d_idx_heap_get_first(key,index,heap,info)
implicit none
class(psb_d_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: index
integer(psb_ipk_), intent(out) :: info
real(psb_dpk_), intent(out) :: key
info = psb_success_
call psi_idx_heap_get_first(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_d_idx_heap_get_first
subroutine psb_d_idx_dump_heap(iout,heap,info)
implicit none
class(psb_d_idx_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else if ((heap%last > 0).and.((.not.allocated(heap%idxs)).or.&
& (size(heap%idxs)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
write(iout,*) heap%idxs(1:heap%last)
end if
end subroutine psb_d_idx_dump_heap
subroutine psb_d_idx_free_heap(heap,info)
implicit none
class(psb_d_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
if ((info == psb_success_).and.(allocated(heap%idxs))) &
& deallocate(heap%idxs,stat=info)
end subroutine psb_d_idx_free_heap
end module psb_d_hsort_x_mod

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_d_isort_mod
use psb_const_mod
interface psb_isort
subroutine psb_disort(x,ix,dir,flag)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_disort
end interface psb_isort
interface
subroutine psi_disrx_up(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_disrx_up
subroutine psi_disrx_dw(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_disrx_dw
subroutine psi_disr_up(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_disr_up
subroutine psi_disr_dw(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_disr_dw
subroutine psi_daisrx_up(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daisrx_up
subroutine psi_daisrx_dw(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daisrx_dw
subroutine psi_daisr_up(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daisr_up
subroutine psi_daisr_dw(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daisr_dw
end interface
end module psb_d_isort_mod

@ -0,0 +1,100 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_d_msort_mod
use psb_const_mod
interface psb_msort_unique
subroutine psb_dmsort_u(x,nout,dir)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(out) :: nout
integer(psb_ipk_), optional, intent(in) :: dir
end subroutine psb_dmsort_u
end interface psb_msort_unique
interface psb_msort
subroutine psb_dmsort(x,ix,dir,flag)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_dmsort
end interface psb_msort
interface
subroutine psi_d_msort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_d_msort_up
subroutine psi_d_msort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_d_msort_dw
end interface
interface
subroutine psi_d_amsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_d_amsort_up
subroutine psi_d_amsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_d_amsort_dw
end interface
end module psb_d_msort_mod

@ -0,0 +1,123 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_d_qsort_mod
use psb_const_mod
interface psb_bsrch
function psb_dbsrch(key,n,v) result(ipos)
import
integer(psb_ipk_) :: ipos, n
real(psb_dpk_) :: key
real(psb_dpk_) :: v(:)
end function psb_dbsrch
end interface psb_bsrch
interface psb_ssrch
function psb_dssrch(key,n,v) result(ipos)
import
implicit none
integer(psb_ipk_) :: ipos, n
real(psb_dpk_) :: key
real(psb_dpk_) :: v(:)
end function psb_dssrch
end interface psb_ssrch
interface psb_qsort
subroutine psb_dqsort(x,ix,dir,flag)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_dqsort
end interface psb_qsort
interface
subroutine psi_dqsrx_up(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_dqsrx_up
subroutine psi_dqsrx_dw(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_dqsrx_dw
subroutine psi_dqsr_up(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_dqsr_up
subroutine psi_dqsr_dw(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_dqsr_dw
subroutine psi_daqsrx_up(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daqsrx_up
subroutine psi_daqsrx_dw(n,x,ix)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daqsrx_dw
subroutine psi_daqsr_up(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daqsr_up
subroutine psi_daqsr_dw(n,x)
import
real(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_daqsr_dw
end interface
end module psb_d_qsort_mod

@ -0,0 +1,125 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_e_hsort_mod
use psb_const_mod
interface psb_hsort
subroutine psb_ehsort(x,ix,dir,flag)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_epk_), optional, intent(inout) :: ix(:)
end subroutine psb_ehsort
end interface psb_hsort
interface psi_insert_heap
subroutine psi_e_insert_heap(key,last,heap,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
integer(psb_epk_), intent(in) :: key
integer(psb_epk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_e_insert_heap
end interface psi_insert_heap
interface psi_idx_insert_heap
subroutine psi_e_idx_insert_heap(key,index,last,heap,idxs,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
integer(psb_epk_), intent(in) :: key
integer(psb_epk_), intent(inout) :: heap(:)
integer(psb_epk_), intent(in) :: index
integer(psb_ipk_), intent(in) :: dir
integer(psb_epk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_e_idx_insert_heap
end interface psi_idx_insert_heap
interface psi_heap_get_first
subroutine psi_e_heap_get_first(key,last,heap,dir,info)
import
implicit none
integer(psb_epk_), intent(inout) :: key
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(in) :: dir
integer(psb_epk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_e_heap_get_first
end interface psi_heap_get_first
interface psi_idx_heap_get_first
subroutine psi_e_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
import
integer(psb_epk_), intent(inout) :: key
integer(psb_epk_), intent(out) :: index
integer(psb_epk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_epk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_e_idx_heap_get_first
end interface psi_idx_heap_get_first
end module psb_e_hsort_mod

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_e_isort_mod
use psb_const_mod
interface psb_isort
subroutine psb_eisort(x,ix,dir,flag)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_epk_), optional, intent(inout) :: ix(:)
end subroutine psb_eisort
end interface psb_isort
interface
subroutine psi_eisrx_up(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eisrx_up
subroutine psi_eisrx_dw(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eisrx_dw
subroutine psi_eisr_up(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eisr_up
subroutine psi_eisr_dw(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eisr_dw
subroutine psi_eaisrx_up(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaisrx_up
subroutine psi_eaisrx_dw(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaisrx_dw
subroutine psi_eaisr_up(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaisr_up
subroutine psi_eaisr_dw(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaisr_dw
end interface
end module psb_e_isort_mod

@ -0,0 +1,107 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_e_msort_mod
use psb_const_mod
interface psb_isaperm
logical function psb_eisaperm(n,eip)
import
integer(psb_epk_), intent(in) :: n
integer(psb_epk_), intent(in) :: eip(n)
end function psb_eisaperm
end interface psb_isaperm
interface psb_msort_unique
subroutine psb_emsort_u(x,nout,dir)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(out) :: nout
integer(psb_ipk_), optional, intent(in) :: dir
end subroutine psb_emsort_u
end interface psb_msort_unique
interface psb_msort
subroutine psb_emsort(x,ix,dir,flag)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_epk_), optional, intent(inout) :: ix(:)
end subroutine psb_emsort
end interface psb_msort
interface
subroutine psi_e_msort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_epk_) :: k(n)
integer(psb_epk_) :: l(0:n+1)
end subroutine psi_e_msort_up
subroutine psi_e_msort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_epk_) :: k(n)
integer(psb_epk_) :: l(0:n+1)
end subroutine psi_e_msort_dw
end interface
interface
subroutine psi_e_amsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_epk_) :: k(n)
integer(psb_epk_) :: l(0:n+1)
end subroutine psi_e_amsort_up
subroutine psi_e_amsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_epk_) :: k(n)
integer(psb_epk_) :: l(0:n+1)
end subroutine psi_e_amsort_dw
end interface
end module psb_e_msort_mod

@ -0,0 +1,123 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_e_qsort_mod
use psb_const_mod
interface psb_bsrch
function psb_ebsrch(key,n,v) result(ipos)
import
integer(psb_ipk_) :: ipos, n
integer(psb_epk_) :: key
integer(psb_epk_) :: v(:)
end function psb_ebsrch
end interface psb_bsrch
interface psb_ssrch
function psb_essrch(key,n,v) result(ipos)
import
implicit none
integer(psb_ipk_) :: ipos, n
integer(psb_epk_) :: key
integer(psb_epk_) :: v(:)
end function psb_essrch
end interface psb_ssrch
interface psb_qsort
subroutine psb_eqsort(x,ix,dir,flag)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_epk_), optional, intent(inout) :: ix(:)
end subroutine psb_eqsort
end interface psb_qsort
interface
subroutine psi_eqsrx_up(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eqsrx_up
subroutine psi_eqsrx_dw(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eqsrx_dw
subroutine psi_eqsr_up(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eqsr_up
subroutine psi_eqsr_dw(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eqsr_dw
subroutine psi_eaqsrx_up(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaqsrx_up
subroutine psi_eaqsrx_dw(n,x,ix)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(inout) :: ix(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaqsrx_dw
subroutine psi_eaqsr_up(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaqsr_up
subroutine psi_eaqsr_dw(n,x)
import
integer(psb_epk_), intent(inout) :: x(:)
integer(psb_epk_), intent(in) :: n
end subroutine psi_eaqsr_dw
end interface
end module psb_e_qsort_mod

@ -0,0 +1,309 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_i_hsort_x_mod
use psb_const_mod
use psb_e_hsort_mod
use psb_m_hsort_mod
type psb_i_heap
integer(psb_ipk_) :: last, dir
integer(psb_ipk_), allocatable :: keys(:)
contains
procedure, pass(heap) :: init => psb_i_init_heap
procedure, pass(heap) :: howmany => psb_i_howmany
procedure, pass(heap) :: insert => psb_i_insert_heap
procedure, pass(heap) :: get_first => psb_i_heap_get_first
procedure, pass(heap) :: dump => psb_i_dump_heap
procedure, pass(heap) :: free => psb_i_free_heap
end type psb_i_heap
type psb_i_idx_heap
integer(psb_ipk_) :: last, dir
integer(psb_ipk_), allocatable :: keys(:)
integer(psb_ipk_), allocatable :: idxs(:)
contains
procedure, pass(heap) :: init => psb_i_idx_init_heap
procedure, pass(heap) :: howmany => psb_i_idx_howmany
procedure, pass(heap) :: insert => psb_i_idx_insert_heap
procedure, pass(heap) :: get_first => psb_i_idx_heap_get_first
procedure, pass(heap) :: dump => psb_i_idx_dump_heap
procedure, pass(heap) :: free => psb_i_idx_free_heap
end type psb_i_idx_heap
contains
subroutine psb_i_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_i_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
return
end subroutine psb_i_init_heap
function psb_i_howmany(heap) result(res)
implicit none
class(psb_i_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_i_howmany
subroutine psb_i_insert_heap(key,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
integer(psb_ipk_), intent(in) :: key
class(psb_i_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_insert_heap(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_i_insert_heap
subroutine psb_i_heap_get_first(key,heap,info)
implicit none
class(psb_i_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: key
info = psb_success_
call psi_heap_get_first(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_i_heap_get_first
subroutine psb_i_dump_heap(iout,heap,info)
implicit none
class(psb_i_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
end if
end subroutine psb_i_dump_heap
subroutine psb_i_free_heap(heap,info)
implicit none
class(psb_i_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
end subroutine psb_i_free_heap
subroutine psb_i_idx_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_i_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
call psb_ensure_size(psb_heap_resize,heap%idxs,info)
return
end subroutine psb_i_idx_init_heap
function psb_i_idx_howmany(heap) result(res)
implicit none
class(psb_i_idx_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_i_idx_howmany
subroutine psb_i_idx_insert_heap(key,index,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
integer(psb_ipk_), intent(in) :: key
integer(psb_ipk_), intent(in) :: index
class(psb_i_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info == psb_success_) &
& call psb_ensure_size(heap%last+1,heap%idxs,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_idx_insert_heap(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_i_idx_insert_heap
subroutine psb_i_idx_heap_get_first(key,index,heap,info)
implicit none
class(psb_i_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: index
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(out) :: key
info = psb_success_
call psi_idx_heap_get_first(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_i_idx_heap_get_first
subroutine psb_i_idx_dump_heap(iout,heap,info)
implicit none
class(psb_i_idx_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else if ((heap%last > 0).and.((.not.allocated(heap%idxs)).or.&
& (size(heap%idxs)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
write(iout,*) heap%idxs(1:heap%last)
end if
end subroutine psb_i_idx_dump_heap
subroutine psb_i_idx_free_heap(heap,info)
implicit none
class(psb_i_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
if ((info == psb_success_).and.(allocated(heap%idxs))) &
& deallocate(heap%idxs,stat=info)
end subroutine psb_i_idx_free_heap
end module psb_i_hsort_x_mod

@ -0,0 +1,309 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_l_hsort_x_mod
use psb_const_mod
use psb_e_hsort_mod
use psb_m_hsort_mod
type psb_l_heap
integer(psb_ipk_) :: last, dir
integer(psb_lpk_), allocatable :: keys(:)
contains
procedure, pass(heap) :: init => psb_l_init_heap
procedure, pass(heap) :: howmany => psb_l_howmany
procedure, pass(heap) :: insert => psb_l_insert_heap
procedure, pass(heap) :: get_first => psb_l_heap_get_first
procedure, pass(heap) :: dump => psb_l_dump_heap
procedure, pass(heap) :: free => psb_l_free_heap
end type psb_l_heap
type psb_l_idx_heap
integer(psb_ipk_) :: last, dir
integer(psb_lpk_), allocatable :: keys(:)
integer(psb_lpk_), allocatable :: idxs(:)
contains
procedure, pass(heap) :: init => psb_l_idx_init_heap
procedure, pass(heap) :: howmany => psb_l_idx_howmany
procedure, pass(heap) :: insert => psb_l_idx_insert_heap
procedure, pass(heap) :: get_first => psb_l_idx_heap_get_first
procedure, pass(heap) :: dump => psb_l_idx_dump_heap
procedure, pass(heap) :: free => psb_l_idx_free_heap
end type psb_l_idx_heap
contains
subroutine psb_l_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_l_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
return
end subroutine psb_l_init_heap
function psb_l_howmany(heap) result(res)
implicit none
class(psb_l_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_l_howmany
subroutine psb_l_insert_heap(key,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
integer(psb_lpk_), intent(in) :: key
class(psb_l_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_insert_heap(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_l_insert_heap
subroutine psb_l_heap_get_first(key,heap,info)
implicit none
class(psb_l_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_lpk_), intent(out) :: key
info = psb_success_
call psi_heap_get_first(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_l_heap_get_first
subroutine psb_l_dump_heap(iout,heap,info)
implicit none
class(psb_l_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
end if
end subroutine psb_l_dump_heap
subroutine psb_l_free_heap(heap,info)
implicit none
class(psb_l_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
end subroutine psb_l_free_heap
subroutine psb_l_idx_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_l_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
call psb_ensure_size(psb_heap_resize,heap%idxs,info)
return
end subroutine psb_l_idx_init_heap
function psb_l_idx_howmany(heap) result(res)
implicit none
class(psb_l_idx_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_l_idx_howmany
subroutine psb_l_idx_insert_heap(key,index,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
integer(psb_lpk_), intent(in) :: key
integer(psb_lpk_), intent(in) :: index
class(psb_l_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info == psb_success_) &
& call psb_ensure_size(heap%last+1,heap%idxs,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_idx_insert_heap(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_l_idx_insert_heap
subroutine psb_l_idx_heap_get_first(key,index,heap,info)
implicit none
class(psb_l_idx_heap), intent(inout) :: heap
integer(psb_lpk_), intent(out) :: index
integer(psb_ipk_), intent(out) :: info
integer(psb_lpk_), intent(out) :: key
info = psb_success_
call psi_idx_heap_get_first(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_l_idx_heap_get_first
subroutine psb_l_idx_dump_heap(iout,heap,info)
implicit none
class(psb_l_idx_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else if ((heap%last > 0).and.((.not.allocated(heap%idxs)).or.&
& (size(heap%idxs)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
write(iout,*) heap%idxs(1:heap%last)
end if
end subroutine psb_l_idx_dump_heap
subroutine psb_l_idx_free_heap(heap,info)
implicit none
class(psb_l_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
if ((info == psb_success_).and.(allocated(heap%idxs))) &
& deallocate(heap%idxs,stat=info)
end subroutine psb_l_idx_free_heap
end module psb_l_hsort_x_mod

@ -0,0 +1,125 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_m_hsort_mod
use psb_const_mod
interface psb_hsort
subroutine psb_mhsort(x,ix,dir,flag)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_mhsort
end interface psb_hsort
interface psi_insert_heap
subroutine psi_m_insert_heap(key,last,heap,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
integer(psb_mpk_), intent(in) :: key
integer(psb_mpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_m_insert_heap
end interface psi_insert_heap
interface psi_idx_insert_heap
subroutine psi_m_idx_insert_heap(key,index,last,heap,idxs,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
integer(psb_mpk_), intent(in) :: key
integer(psb_mpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: index
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_m_idx_insert_heap
end interface psi_idx_insert_heap
interface psi_heap_get_first
subroutine psi_m_heap_get_first(key,last,heap,dir,info)
import
implicit none
integer(psb_mpk_), intent(inout) :: key
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(in) :: dir
integer(psb_mpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_m_heap_get_first
end interface psi_heap_get_first
interface psi_idx_heap_get_first
subroutine psi_m_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
import
integer(psb_mpk_), intent(inout) :: key
integer(psb_ipk_), intent(out) :: index
integer(psb_mpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_m_idx_heap_get_first
end interface psi_idx_heap_get_first
end module psb_m_hsort_mod

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_m_isort_mod
use psb_const_mod
interface psb_isort
subroutine psb_misort(x,ix,dir,flag)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_misort
end interface psb_isort
interface
subroutine psi_misrx_up(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_misrx_up
subroutine psi_misrx_dw(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_misrx_dw
subroutine psi_misr_up(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_misr_up
subroutine psi_misr_dw(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_misr_dw
subroutine psi_maisrx_up(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maisrx_up
subroutine psi_maisrx_dw(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maisrx_dw
subroutine psi_maisr_up(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maisr_up
subroutine psi_maisr_dw(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maisr_dw
end interface
end module psb_m_isort_mod

@ -0,0 +1,107 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_m_msort_mod
use psb_const_mod
interface psb_isaperm
logical function psb_misaperm(n,eip)
import
integer(psb_mpk_), intent(in) :: n
integer(psb_mpk_), intent(in) :: eip(n)
end function psb_misaperm
end interface psb_isaperm
interface psb_msort_unique
subroutine psb_mmsort_u(x,nout,dir)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(out) :: nout
integer(psb_ipk_), optional, intent(in) :: dir
end subroutine psb_mmsort_u
end interface psb_msort_unique
interface psb_msort
subroutine psb_mmsort(x,ix,dir,flag)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_mmsort
end interface psb_msort
interface
subroutine psi_m_msort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_mpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_m_msort_up
subroutine psi_m_msort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_mpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_m_msort_dw
end interface
interface
subroutine psi_m_amsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_mpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_m_amsort_up
subroutine psi_m_amsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
integer(psb_mpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_m_amsort_dw
end interface
end module psb_m_msort_mod

@ -0,0 +1,123 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_m_qsort_mod
use psb_const_mod
interface psb_bsrch
function psb_mbsrch(key,n,v) result(ipos)
import
integer(psb_ipk_) :: ipos, n
integer(psb_mpk_) :: key
integer(psb_mpk_) :: v(:)
end function psb_mbsrch
end interface psb_bsrch
interface psb_ssrch
function psb_mssrch(key,n,v) result(ipos)
import
implicit none
integer(psb_ipk_) :: ipos, n
integer(psb_mpk_) :: key
integer(psb_mpk_) :: v(:)
end function psb_mssrch
end interface psb_ssrch
interface psb_qsort
subroutine psb_mqsort(x,ix,dir,flag)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_mqsort
end interface psb_qsort
interface
subroutine psi_mqsrx_up(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_mqsrx_up
subroutine psi_mqsrx_dw(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_mqsrx_dw
subroutine psi_mqsr_up(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_mqsr_up
subroutine psi_mqsr_dw(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_mqsr_dw
subroutine psi_maqsrx_up(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maqsrx_up
subroutine psi_maqsrx_dw(n,x,ix)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maqsrx_dw
subroutine psi_maqsr_up(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maqsr_up
subroutine psi_maqsr_dw(n,x)
import
integer(psb_mpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_maqsr_dw
end interface
end module psb_m_qsort_mod

@ -0,0 +1,125 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_s_hsort_mod
use psb_const_mod
interface psb_hsort
subroutine psb_shsort(x,ix,dir,flag)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_shsort
end interface psb_hsort
interface psi_insert_heap
subroutine psi_s_insert_heap(key,last,heap,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
real(psb_spk_), intent(in) :: key
real(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_s_insert_heap
end interface psi_insert_heap
interface psi_idx_insert_heap
subroutine psi_s_idx_insert_heap(key,index,last,heap,idxs,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
real(psb_spk_), intent(in) :: key
real(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: index
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_s_idx_insert_heap
end interface psi_idx_insert_heap
interface psi_heap_get_first
subroutine psi_s_heap_get_first(key,last,heap,dir,info)
import
implicit none
real(psb_spk_), intent(inout) :: key
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(in) :: dir
real(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_s_heap_get_first
end interface psi_heap_get_first
interface psi_idx_heap_get_first
subroutine psi_s_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
import
real(psb_spk_), intent(inout) :: key
integer(psb_ipk_), intent(out) :: index
real(psb_spk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_s_idx_heap_get_first
end interface psi_idx_heap_get_first
end module psb_s_hsort_mod

@ -0,0 +1,308 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_s_hsort_x_mod
use psb_const_mod
use psb_s_hsort_mod
type psb_s_heap
integer(psb_ipk_) :: last, dir
real(psb_spk_), allocatable :: keys(:)
contains
procedure, pass(heap) :: init => psb_s_init_heap
procedure, pass(heap) :: howmany => psb_s_howmany
procedure, pass(heap) :: insert => psb_s_insert_heap
procedure, pass(heap) :: get_first => psb_s_heap_get_first
procedure, pass(heap) :: dump => psb_s_dump_heap
procedure, pass(heap) :: free => psb_s_free_heap
end type psb_s_heap
type psb_s_idx_heap
integer(psb_ipk_) :: last, dir
real(psb_spk_), allocatable :: keys(:)
integer(psb_ipk_), allocatable :: idxs(:)
contains
procedure, pass(heap) :: init => psb_s_idx_init_heap
procedure, pass(heap) :: howmany => psb_s_idx_howmany
procedure, pass(heap) :: insert => psb_s_idx_insert_heap
procedure, pass(heap) :: get_first => psb_s_idx_heap_get_first
procedure, pass(heap) :: dump => psb_s_idx_dump_heap
procedure, pass(heap) :: free => psb_s_idx_free_heap
end type psb_s_idx_heap
contains
subroutine psb_s_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_s_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
return
end subroutine psb_s_init_heap
function psb_s_howmany(heap) result(res)
implicit none
class(psb_s_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_s_howmany
subroutine psb_s_insert_heap(key,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
real(psb_spk_), intent(in) :: key
class(psb_s_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_insert_heap(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_s_insert_heap
subroutine psb_s_heap_get_first(key,heap,info)
implicit none
class(psb_s_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
real(psb_spk_), intent(out) :: key
info = psb_success_
call psi_heap_get_first(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_s_heap_get_first
subroutine psb_s_dump_heap(iout,heap,info)
implicit none
class(psb_s_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
end if
end subroutine psb_s_dump_heap
subroutine psb_s_free_heap(heap,info)
implicit none
class(psb_s_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
end subroutine psb_s_free_heap
subroutine psb_s_idx_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_s_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_sort_up_
endif
select case(heap%dir)
case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_'
heap%dir = psb_sort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
call psb_ensure_size(psb_heap_resize,heap%idxs,info)
return
end subroutine psb_s_idx_init_heap
function psb_s_idx_howmany(heap) result(res)
implicit none
class(psb_s_idx_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_s_idx_howmany
subroutine psb_s_idx_insert_heap(key,index,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
real(psb_spk_), intent(in) :: key
integer(psb_ipk_), intent(in) :: index
class(psb_s_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info == psb_success_) &
& call psb_ensure_size(heap%last+1,heap%idxs,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_idx_insert_heap(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_s_idx_insert_heap
subroutine psb_s_idx_heap_get_first(key,index,heap,info)
implicit none
class(psb_s_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: index
integer(psb_ipk_), intent(out) :: info
real(psb_spk_), intent(out) :: key
info = psb_success_
call psi_idx_heap_get_first(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_s_idx_heap_get_first
subroutine psb_s_idx_dump_heap(iout,heap,info)
implicit none
class(psb_s_idx_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else if ((heap%last > 0).and.((.not.allocated(heap%idxs)).or.&
& (size(heap%idxs)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
write(iout,*) heap%idxs(1:heap%last)
end if
end subroutine psb_s_idx_dump_heap
subroutine psb_s_idx_free_heap(heap,info)
implicit none
class(psb_s_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
if ((info == psb_success_).and.(allocated(heap%idxs))) &
& deallocate(heap%idxs,stat=info)
end subroutine psb_s_idx_free_heap
end module psb_s_hsort_x_mod

@ -0,0 +1,105 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_s_isort_mod
use psb_const_mod
interface psb_isort
subroutine psb_sisort(x,ix,dir,flag)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_sisort
end interface psb_isort
interface
subroutine psi_sisrx_up(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sisrx_up
subroutine psi_sisrx_dw(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sisrx_dw
subroutine psi_sisr_up(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sisr_up
subroutine psi_sisr_dw(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sisr_dw
subroutine psi_saisrx_up(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saisrx_up
subroutine psi_saisrx_dw(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saisrx_dw
subroutine psi_saisr_up(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saisr_up
subroutine psi_saisr_dw(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saisr_dw
end interface
end module psb_s_isort_mod

@ -0,0 +1,100 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_s_msort_mod
use psb_const_mod
interface psb_msort_unique
subroutine psb_smsort_u(x,nout,dir)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(out) :: nout
integer(psb_ipk_), optional, intent(in) :: dir
end subroutine psb_smsort_u
end interface psb_msort_unique
interface psb_msort
subroutine psb_smsort(x,ix,dir,flag)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_smsort
end interface psb_msort
interface
subroutine psi_s_msort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_s_msort_up
subroutine psi_s_msort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_s_msort_dw
end interface
interface
subroutine psi_s_amsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_s_amsort_up
subroutine psi_s_amsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
real(psb_spk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_s_amsort_dw
end interface
end module psb_s_msort_mod

@ -0,0 +1,123 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_s_qsort_mod
use psb_const_mod
interface psb_bsrch
function psb_sbsrch(key,n,v) result(ipos)
import
integer(psb_ipk_) :: ipos, n
real(psb_spk_) :: key
real(psb_spk_) :: v(:)
end function psb_sbsrch
end interface psb_bsrch
interface psb_ssrch
function psb_sssrch(key,n,v) result(ipos)
import
implicit none
integer(psb_ipk_) :: ipos, n
real(psb_spk_) :: key
real(psb_spk_) :: v(:)
end function psb_sssrch
end interface psb_ssrch
interface psb_qsort
subroutine psb_sqsort(x,ix,dir,flag)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_sqsort
end interface psb_qsort
interface
subroutine psi_sqsrx_up(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sqsrx_up
subroutine psi_sqsrx_dw(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sqsrx_dw
subroutine psi_sqsr_up(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sqsr_up
subroutine psi_sqsr_dw(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_sqsr_dw
subroutine psi_saqsrx_up(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saqsrx_up
subroutine psi_saqsrx_dw(n,x,ix)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saqsrx_dw
subroutine psi_saqsr_up(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saqsr_up
subroutine psi_saqsr_dw(n,x)
import
real(psb_spk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_saqsr_dw
end interface
end module psb_s_qsort_mod

@ -45,11 +45,47 @@
module psb_sort_mod
use psb_const_mod
use psb_ip_reord_mod
use psb_i_sort_mod
use psb_l_sort_mod
use psb_s_sort_mod
use psb_c_sort_mod
use psb_d_sort_mod
use psb_z_sort_mod
!!$ use psb_i_sort_mod
!!$ use psb_l_sort_mod
!!$ use psb_s_sort_mod
!!$ use psb_c_sort_mod
!!$ use psb_d_sort_mod
!!$ use psb_z_sort_mod
use psb_m_hsort_mod
use psb_m_isort_mod
use psb_m_msort_mod
use psb_m_qsort_mod
use psb_e_hsort_mod
use psb_e_isort_mod
use psb_e_msort_mod
use psb_e_qsort_mod
use psb_s_hsort_mod
use psb_s_isort_mod
use psb_s_msort_mod
use psb_s_qsort_mod
use psb_d_hsort_mod
use psb_d_isort_mod
use psb_d_msort_mod
use psb_d_qsort_mod
use psb_c_hsort_mod
use psb_c_isort_mod
use psb_c_msort_mod
use psb_c_qsort_mod
use psb_z_hsort_mod
use psb_z_isort_mod
use psb_z_msort_mod
use psb_z_qsort_mod
use psb_i_hsort_x_mod
use psb_l_hsort_x_mod
use psb_s_hsort_x_mod
use psb_d_hsort_x_mod
use psb_c_hsort_x_mod
use psb_z_hsort_x_mod
end module psb_sort_mod

@ -0,0 +1,125 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_z_hsort_mod
use psb_const_mod
interface psb_hsort
subroutine psb_zhsort(x,ix,dir,flag)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_zhsort
end interface psb_hsort
interface psi_insert_heap
subroutine psi_z_insert_heap(key,last,heap,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
complex(psb_dpk_), intent(in) :: key
complex(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_z_insert_heap
end interface psi_insert_heap
interface psi_idx_insert_heap
subroutine psi_z_idx_insert_heap(key,index,last,heap,idxs,dir,info)
import
implicit none
!
! Input:
! key: the new value
! last: pointer to the last occupied element in heap
! heap: the heap
! dir: sorting direction
complex(psb_dpk_), intent(in) :: key
complex(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: index
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(out) :: info
end subroutine psi_z_idx_insert_heap
end interface psi_idx_insert_heap
interface psi_heap_get_first
subroutine psi_z_heap_get_first(key,last,heap,dir,info)
import
implicit none
complex(psb_dpk_), intent(inout) :: key
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(in) :: dir
complex(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_z_heap_get_first
end interface psi_heap_get_first
interface psi_idx_heap_get_first
subroutine psi_z_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
import
complex(psb_dpk_), intent(inout) :: key
integer(psb_ipk_), intent(out) :: index
complex(psb_dpk_), intent(inout) :: heap(:)
integer(psb_ipk_), intent(in) :: dir
integer(psb_ipk_), intent(inout) :: last
integer(psb_ipk_), intent(inout) :: idxs(:)
integer(psb_ipk_), intent(out) :: info
end subroutine psi_z_idx_heap_get_first
end interface psi_idx_heap_get_first
end module psb_z_hsort_mod

@ -0,0 +1,308 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_z_hsort_x_mod
use psb_const_mod
use psb_z_hsort_mod
type psb_z_heap
integer(psb_ipk_) :: last, dir
complex(psb_dpk_), allocatable :: keys(:)
contains
procedure, pass(heap) :: init => psb_z_init_heap
procedure, pass(heap) :: howmany => psb_z_howmany
procedure, pass(heap) :: insert => psb_z_insert_heap
procedure, pass(heap) :: get_first => psb_z_heap_get_first
procedure, pass(heap) :: dump => psb_z_dump_heap
procedure, pass(heap) :: free => psb_z_free_heap
end type psb_z_heap
type psb_z_idx_heap
integer(psb_ipk_) :: last, dir
complex(psb_dpk_), allocatable :: keys(:)
integer(psb_ipk_), allocatable :: idxs(:)
contains
procedure, pass(heap) :: init => psb_z_idx_init_heap
procedure, pass(heap) :: howmany => psb_z_idx_howmany
procedure, pass(heap) :: insert => psb_z_idx_insert_heap
procedure, pass(heap) :: get_first => psb_z_idx_heap_get_first
procedure, pass(heap) :: dump => psb_z_idx_dump_heap
procedure, pass(heap) :: free => psb_z_idx_free_heap
end type psb_z_idx_heap
contains
subroutine psb_z_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_z_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_asort_up_
endif
select case(heap%dir)
case (psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_asort_up_'
heap%dir = psb_asort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
return
end subroutine psb_z_init_heap
function psb_z_howmany(heap) result(res)
implicit none
class(psb_z_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_z_howmany
subroutine psb_z_insert_heap(key,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
complex(psb_dpk_), intent(in) :: key
class(psb_z_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_insert_heap(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_z_insert_heap
subroutine psb_z_heap_get_first(key,heap,info)
implicit none
class(psb_z_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
complex(psb_dpk_), intent(out) :: key
info = psb_success_
call psi_heap_get_first(key,&
& heap%last,heap%keys,heap%dir,info)
return
end subroutine psb_z_heap_get_first
subroutine psb_z_dump_heap(iout,heap,info)
implicit none
class(psb_z_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
end if
end subroutine psb_z_dump_heap
subroutine psb_z_free_heap(heap,info)
implicit none
class(psb_z_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
end subroutine psb_z_free_heap
subroutine psb_z_idx_init_heap(heap,info,dir)
use psb_realloc_mod, only : psb_ensure_size
implicit none
class(psb_z_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in), optional :: dir
info = psb_success_
heap%last=0
if (present(dir)) then
heap%dir = dir
else
heap%dir = psb_asort_up_
endif
select case(heap%dir)
case (psb_asort_up_,psb_asort_down_)
! ok, do nothing
case default
write(psb_err_unit,*) 'Invalid direction, defaulting to psb_asort_up_'
heap%dir = psb_asort_up_
end select
call psb_ensure_size(psb_heap_resize,heap%keys,info)
call psb_ensure_size(psb_heap_resize,heap%idxs,info)
return
end subroutine psb_z_idx_init_heap
function psb_z_idx_howmany(heap) result(res)
implicit none
class(psb_z_idx_heap), intent(in) :: heap
integer(psb_ipk_) :: res
res = heap%last
end function psb_z_idx_howmany
subroutine psb_z_idx_insert_heap(key,index,heap,info)
use psb_realloc_mod, only : psb_ensure_size
implicit none
complex(psb_dpk_), intent(in) :: key
integer(psb_ipk_), intent(in) :: index
class(psb_z_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info = psb_success_
if (heap%last < 0) then
write(psb_err_unit,*) 'Invalid last in heap ',heap%last
info = heap%last
return
endif
call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize)
if (info == psb_success_) &
& call psb_ensure_size(heap%last+1,heap%idxs,info,addsz=psb_heap_resize)
if (info /= psb_success_) then
write(psb_err_unit,*) 'Memory allocation failure in heap_insert'
info = -5
return
end if
call psi_idx_insert_heap(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_z_idx_insert_heap
subroutine psb_z_idx_heap_get_first(key,index,heap,info)
implicit none
class(psb_z_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: index
integer(psb_ipk_), intent(out) :: info
complex(psb_dpk_), intent(out) :: key
info = psb_success_
call psi_idx_heap_get_first(key,index,&
& heap%last,heap%keys,heap%idxs,heap%dir,info)
return
end subroutine psb_z_idx_heap_get_first
subroutine psb_z_idx_dump_heap(iout,heap,info)
implicit none
class(psb_z_idx_heap), intent(in) :: heap
integer(psb_ipk_), intent(out) :: info
integer(psb_ipk_), intent(in) :: iout
info = psb_success_
if (iout < 0) then
write(psb_err_unit,*) 'Invalid file '
info =-1
return
end if
write(iout,*) 'Heap direction ',heap%dir
write(iout,*) 'Heap size ',heap%last
if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.&
& (size(heap%keys)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else if ((heap%last > 0).and.((.not.allocated(heap%idxs)).or.&
& (size(heap%idxs)<heap%last))) then
write(iout,*) 'Inconsistent size/allocation status!!'
else
write(iout,*) heap%keys(1:heap%last)
write(iout,*) heap%idxs(1:heap%last)
end if
end subroutine psb_z_idx_dump_heap
subroutine psb_z_idx_free_heap(heap,info)
implicit none
class(psb_z_idx_heap), intent(inout) :: heap
integer(psb_ipk_), intent(out) :: info
info=psb_success_
if (allocated(heap%keys)) deallocate(heap%keys,stat=info)
if ((info == psb_success_).and.(allocated(heap%idxs))) &
& deallocate(heap%idxs,stat=info)
end subroutine psb_z_idx_free_heap
end module psb_z_hsort_x_mod

@ -0,0 +1,127 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_z_isort_mod
use psb_const_mod
interface psb_isort
subroutine psb_zisort(x,ix,dir,flag)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_zisort
end interface psb_isort
interface
subroutine psi_zlisrx_up(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlisrx_up
subroutine psi_zlisrx_dw(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlisrx_dw
subroutine psi_zlisr_up(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlisr_up
subroutine psi_zlisr_dw(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlisr_dw
subroutine psi_zalisrx_up(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalisrx_up
subroutine psi_zalisrx_dw(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalisrx_dw
subroutine psi_zalisr_up(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalisr_up
subroutine psi_zalisr_dw(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalisr_dw
subroutine psi_zaisrx_up(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaisrx_up
subroutine psi_zaisrx_dw(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaisrx_dw
subroutine psi_zaisr_up(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaisr_up
subroutine psi_zaisr_dw(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaisr_dw
end interface
end module psb_z_isort_mod

@ -0,0 +1,113 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_z_msort_mod
use psb_const_mod
interface psb_msort_unique
subroutine psb_zmsort_u(x,nout,dir)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(out) :: nout
integer(psb_ipk_), optional, intent(in) :: dir
end subroutine psb_zmsort_u
end interface psb_msort_unique
interface psb_msort
subroutine psb_zmsort(x,ix,dir,flag)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_zmsort
end interface psb_msort
interface
subroutine psi_z_lmsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_z_lmsort_up
subroutine psi_z_lmsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_z_lmsort_dw
subroutine psi_z_almsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_z_almsort_up
subroutine psi_z_almsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_z_almsort_dw
end interface
interface
subroutine psi_z_amsort_up(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_z_amsort_up
subroutine psi_z_amsort_dw(n,k,l,iret)
import
implicit none
integer(psb_ipk_) :: n, iret
complex(psb_dpk_) :: k(n)
integer(psb_ipk_) :: l(0:n+1)
end subroutine psi_z_amsort_dw
end interface
end module psb_z_msort_mod

@ -0,0 +1,126 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! Sorting routines
! References:
! D. Knuth
! The Art of Computer Programming, vol. 3
! Addison-Wesley
!
! Aho, Hopcroft, Ullman
! Data Structures and Algorithms
! Addison-Wesley
!
module psb_z_qsort_mod
use psb_const_mod
interface psb_qsort
subroutine psb_zqsort(x,ix,dir,flag)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), optional, intent(in) :: dir, flag
integer(psb_ipk_), optional, intent(inout) :: ix(:)
end subroutine psb_zqsort
end interface psb_qsort
interface
subroutine psi_zlqsrx_up(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlqsrx_up
subroutine psi_zlqsrx_dw(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlqsrx_dw
subroutine psi_zlqsr_up(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlqsr_up
subroutine psi_zlqsr_dw(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zlqsr_dw
subroutine psi_zalqsrx_up(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalqsrx_up
subroutine psi_zalqsrx_dw(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalqsrx_dw
subroutine psi_zalqsr_up(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalqsr_up
subroutine psi_zalqsr_dw(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zalqsr_dw
subroutine psi_zaqsrx_up(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaqsrx_up
subroutine psi_zaqsrx_dw(n,x,ix)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(inout) :: ix(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaqsrx_dw
subroutine psi_zaqsr_up(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaqsr_up
subroutine psi_zaqsr_dw(n,x)
import
complex(psb_dpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: n
end subroutine psi_zaqsr_dw
end interface
end module psb_z_qsort_mod

@ -0,0 +1,133 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
module psi_l_serial_mod
use psb_const_mod, only : psb_ipk_
interface psb_gelp
! 2-D version
subroutine psb_lgelp(trans,iperm,x,info)
import :: psb_ipk_
implicit none
integer(psb_lpk_), intent(inout) :: x(:,:)
integer(psb_ipk_), intent(in) :: iperm(:)
integer(psb_ipk_), intent(out) :: info
character, intent(in) :: trans
end subroutine psb_lgelp
subroutine psb_lgelpv(trans,iperm,x,info)
import :: psb_ipk_
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
integer(psb_ipk_), intent(in) :: iperm(:)
integer(psb_ipk_), intent(out) :: info
character, intent(in) :: trans
end subroutine psb_lgelpv
end interface psb_gelp
interface psb_geaxpby
subroutine psi_laxpby(m,n,alpha, x, beta, y, info)
import :: psb_ipk_
implicit none
integer(psb_ipk_), intent(in) :: m, n
integer(psb_lpk_), intent (in) :: x(:,:)
integer(psb_lpk_), intent (inout) :: y(:,:)
integer(psb_lpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(out) :: info
end subroutine psi_laxpby
subroutine psi_laxpbyv(m,alpha, x, beta, y, info)
import :: psb_ipk_
implicit none
integer(psb_ipk_), intent(in) :: m
integer(psb_lpk_), intent (in) :: x(:)
integer(psb_lpk_), intent (inout) :: y(:)
integer(psb_lpk_), intent (in) :: alpha, beta
integer(psb_ipk_), intent(out) :: info
end subroutine psi_laxpbyv
end interface psb_geaxpby
interface psi_gth
subroutine psi_lgthmv(n,k,idx,alpha,x,beta,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, k, idx(:)
integer(psb_lpk_) :: x(:,:), y(:),alpha,beta
end subroutine psi_lgthmv
subroutine psi_lgthv(n,idx,alpha,x,beta,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, idx(:)
integer(psb_lpk_) :: x(:), y(:),alpha,beta
end subroutine psi_lgthv
subroutine psi_lgthzmv(n,k,idx,x,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, k, idx(:)
integer(psb_lpk_) :: x(:,:), y(:)
end subroutine psi_lgthzmv
subroutine psi_lgthzmm(n,k,idx,x,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, k, idx(:)
integer(psb_lpk_) :: x(:,:), y(:,:)
end subroutine psi_lgthzmm
subroutine psi_lgthzv(n,idx,x,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, idx(:)
integer(psb_lpk_) :: x(:), y(:)
end subroutine psi_lgthzv
end interface psi_gth
interface psi_sct
subroutine psi_lsctmm(n,k,idx,x,beta,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, k, idx(:)
integer(psb_lpk_) :: beta, x(:,:), y(:,:)
end subroutine psi_lsctmm
subroutine psi_lsctmv(n,k,idx,x,beta,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, k, idx(:)
integer(psb_lpk_) :: beta, x(:), y(:,:)
end subroutine psi_lsctmv
subroutine psi_lsctv(n,idx,x,beta,y)
import :: psb_ipk_
implicit none
integer(psb_ipk_) :: n, idx(:)
integer(psb_lpk_) :: beta, x(:), y(:)
end subroutine psi_lsctv
end interface psi_sct
end module psi_l_serial_mod

@ -509,7 +509,7 @@ function psb_c_coo_get_nz_row(idx,a) result(res)
nza = a%get_nzeros()
if (a%is_by_rows()) then
! In this case we can do a binary search.
ip = psb_ibsrch(idx,nza,a%ia)
ip = psb_bsrch(idx,nza,a%ia)
if (ip /= -1) return
jp = ip
do
@ -2123,7 +2123,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2148,7 +2148,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2401,7 +2401,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2426,7 +2426,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2750,7 +2750,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
ic = gtl(ic)
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2768,7 +2768,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2792,7 +2792,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2810,7 +2810,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2843,7 +2843,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2861,7 +2861,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2880,7 +2880,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2898,7 +2898,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2030,7 +2030,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2059,7 +2059,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2098,7 +2098,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2122,7 +2122,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2386,7 +2386,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2414,7 +2414,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2454,7 +2454,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2476,7 +2476,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -509,7 +509,7 @@ function psb_d_coo_get_nz_row(idx,a) result(res)
nza = a%get_nzeros()
if (a%is_by_rows()) then
! In this case we can do a binary search.
ip = psb_ibsrch(idx,nza,a%ia)
ip = psb_bsrch(idx,nza,a%ia)
if (ip /= -1) return
jp = ip
do
@ -2123,7 +2123,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2148,7 +2148,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2401,7 +2401,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2426,7 +2426,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2750,7 +2750,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
ic = gtl(ic)
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2768,7 +2768,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2792,7 +2792,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2810,7 +2810,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2843,7 +2843,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2861,7 +2861,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2880,7 +2880,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2898,7 +2898,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2030,7 +2030,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2059,7 +2059,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2098,7 +2098,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2122,7 +2122,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2386,7 +2386,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2414,7 +2414,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2454,7 +2454,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2476,7 +2476,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -509,7 +509,7 @@ function psb_s_coo_get_nz_row(idx,a) result(res)
nza = a%get_nzeros()
if (a%is_by_rows()) then
! In this case we can do a binary search.
ip = psb_ibsrch(idx,nza,a%ia)
ip = psb_bsrch(idx,nza,a%ia)
if (ip /= -1) return
jp = ip
do
@ -2123,7 +2123,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2148,7 +2148,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2401,7 +2401,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2426,7 +2426,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2750,7 +2750,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
ic = gtl(ic)
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2768,7 +2768,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2792,7 +2792,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2810,7 +2810,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2843,7 +2843,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2861,7 +2861,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2880,7 +2880,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2898,7 +2898,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2030,7 +2030,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2059,7 +2059,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2098,7 +2098,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2122,7 +2122,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2386,7 +2386,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2414,7 +2414,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2454,7 +2454,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2476,7 +2476,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -509,7 +509,7 @@ function psb_z_coo_get_nz_row(idx,a) result(res)
nza = a%get_nzeros()
if (a%is_by_rows()) then
! In this case we can do a binary search.
ip = psb_ibsrch(idx,nza,a%ia)
ip = psb_bsrch(idx,nza,a%ia)
if (ip /= -1) return
jp = ip
do
@ -2123,7 +2123,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2148,7 +2148,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2401,7 +2401,7 @@ contains
if (debug_level >= psb_debug_serial_)&
& write(debug_unit,*) trim(name), ': srtdcoo '
do
ip = psb_ibsrch(irw,nza,a%ia)
ip = psb_bsrch(irw,nza,a%ia)
if (ip /= -1) exit
irw = irw + 1
if (irw > imax) then
@ -2426,7 +2426,7 @@ contains
end if
do
jp = psb_ibsrch(lrw,nza,a%ia)
jp = psb_bsrch(lrw,nza,a%ia)
if (jp /= -1) exit
lrw = lrw - 1
if (irw > lrw) then
@ -2750,7 +2750,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
ic = gtl(ic)
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2768,7 +2768,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2792,7 +2792,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2810,7 +2810,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2843,7 +2843,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2861,7 +2861,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2880,7 +2880,7 @@ contains
if ((ir > 0).and.(ir <= nr)) then
if (ir /= ilr) then
i1 = psb_ibsrch(ir,nnz,a%ia)
i1 = psb_bsrch(ir,nnz,a%ia)
i2 = i1
do
if (i2+1 > nnz) exit
@ -2898,7 +2898,7 @@ contains
i2 = 1
end if
nc = i2-i1+1
ip = psb_issrch(ic,nc,a%ja(i1:i2))
ip = psb_ssrch(ic,nc,a%ja(i1:i2))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2030,7 +2030,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2059,7 +2059,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2098,7 +2098,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2122,7 +2122,7 @@ contains
i2 = a%icp(ic+1)
nr=i2-i1
ip = psb_ibsrch(ir,nr,a%ia(i1:i2-1))
ip = psb_bsrch(ir,nr,a%ia(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -2386,7 +2386,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2414,7 +2414,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else
@ -2454,7 +2454,7 @@ contains
i2 = a%irp(ir+1)
nc=i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = val(i)
else
@ -2476,7 +2476,7 @@ contains
i1 = a%irp(ir)
i2 = a%irp(ir+1)
nc = i2-i1
ip = psb_ibsrch(ic,nc,a%ja(i1:i2-1))
ip = psb_bsrch(ic,nc,a%ja(i1:i2-1))
if (ip>0) then
a%val(i1+ip-1) = a%val(i1+ip-1) + val(i)
else

@ -11,7 +11,7 @@ DOBJS=psb_d_hsort_impl.o psb_d_isort_impl.o psb_d_msort_impl.o psb_d_qsort_impl.
COBJS=psb_c_hsort_impl.o psb_c_isort_impl.o psb_c_msort_impl.o psb_c_qsort_impl.o
ZOBJS=psb_z_hsort_impl.o psb_z_isort_impl.o psb_z_msort_impl.o psb_z_qsort_impl.o
OBJS=$(BOBJS) $(IOBJS) $(LOBJS) $(SOBJS) $(DOBJS) $(COBJS) $(ZOBJS)
OBJS=$(BOBJS) $(SOBJS) $(DOBJS) $(COBJS) $(ZOBJS) $(IOBJS) $(LOBJS)
#
# Where the library should go, and how it is called.

@ -42,7 +42,7 @@
! Addison-Wesley
!
subroutine psb_chsort(x,ix,dir,flag)
use psb_c_sort_mod, psb_protect_name => psb_chsort
use psb_sort_mod, psb_protect_name => psb_chsort
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)
@ -116,13 +116,13 @@ subroutine psb_chsort(x,ix,dir,flag)
do i=1, n
key = x(i)
index = ix(i)
call psi_c_idx_insert_heap(key,index,l,x,ix,dir_,info)
call psi_idx_insert_heap(key,index,l,x,ix,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! '
end if
end do
do i=n, 2, -1
call psi_c_idx_heap_get_first(key,index,l,x,ix,dir_,info)
call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info)
if (l /= i-1) then
write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i
end if
@ -133,7 +133,7 @@ subroutine psb_chsort(x,ix,dir,flag)
l = 0
do i=1, n
key = x(i)
call psi_c_insert_heap(key,l,x,dir_,info)
call psi_insert_heap(key,l,x,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i
end if
@ -185,7 +185,7 @@ end subroutine psb_chsort
!
subroutine psi_c_insert_heap(key,last,heap,dir,info)
use psb_c_sort_mod, psb_protect_name => psi_c_insert_heap
use psb_sort_mod, psb_protect_name => psi_c_insert_heap
implicit none
!
@ -391,7 +391,7 @@ contains
end subroutine psi_c_insert_heap
subroutine psi_c_heap_get_first(key,last,heap,dir,info)
use psb_c_sort_mod, psb_protect_name => psi_c_heap_get_first
use psb_sort_mod, psb_protect_name => psi_c_heap_get_first
implicit none
!
@ -633,7 +633,7 @@ contains
end subroutine psi_c_heap_get_first
subroutine psi_c_idx_insert_heap(key,index,last,heap,idxs,dir,info)
use psb_c_sort_mod, psb_protect_name => psi_c_idx_insert_heap
use psb_sort_mod, psb_protect_name => psi_c_idx_insert_heap
implicit none
!
@ -869,7 +869,7 @@ end subroutine psi_c_idx_insert_heap
subroutine psi_c_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
use psb_c_sort_mod, psb_protect_name => psi_c_idx_heap_get_first
use psb_sort_mod, psb_protect_name => psi_c_idx_heap_get_first
implicit none
!

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_cisort(x,ix,dir,flag)
use psb_c_sort_mod, psb_protect_name => psb_cisort
use psb_sort_mod, psb_protect_name => psb_cisort
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)
@ -139,7 +139,7 @@ subroutine psb_cisort(x,ix,dir,flag)
end subroutine psb_cisort
subroutine psi_clisrx_up(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_clisrx_up
use psb_sort_mod, psb_protect_name => psi_clisrx_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -169,7 +169,7 @@ subroutine psi_clisrx_up(n,x,idx)
end subroutine psi_clisrx_up
subroutine psi_clisrx_dw(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_clisrx_dw
use psb_sort_mod, psb_protect_name => psi_clisrx_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -198,7 +198,7 @@ subroutine psi_clisrx_dw(n,x,idx)
end subroutine psi_clisrx_dw
subroutine psi_clisr_up(n,x)
use psb_c_sort_mod, psb_protect_name => psi_clisr_up
use psb_sort_mod, psb_protect_name => psi_clisr_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -223,7 +223,7 @@ subroutine psi_clisr_up(n,x)
end subroutine psi_clisr_up
subroutine psi_clisr_dw(n,x)
use psb_c_sort_mod, psb_protect_name => psi_clisr_dw
use psb_sort_mod, psb_protect_name => psi_clisr_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -248,7 +248,7 @@ subroutine psi_clisr_dw(n,x)
end subroutine psi_clisr_dw
subroutine psi_calisrx_up(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_calisrx_up
use psb_sort_mod, psb_protect_name => psi_calisrx_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -277,7 +277,7 @@ subroutine psi_calisrx_up(n,x,idx)
end subroutine psi_calisrx_up
subroutine psi_calisrx_dw(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_calisrx_dw
use psb_sort_mod, psb_protect_name => psi_calisrx_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -306,7 +306,7 @@ subroutine psi_calisrx_dw(n,x,idx)
end subroutine psi_calisrx_dw
subroutine psi_calisr_up(n,x)
use psb_c_sort_mod, psb_protect_name => psi_calisr_up
use psb_sort_mod, psb_protect_name => psi_calisr_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -331,7 +331,7 @@ subroutine psi_calisr_up(n,x)
end subroutine psi_calisr_up
subroutine psi_calisr_dw(n,x)
use psb_c_sort_mod, psb_protect_name => psi_calisr_dw
use psb_sort_mod, psb_protect_name => psi_calisr_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -356,7 +356,7 @@ subroutine psi_calisr_dw(n,x)
end subroutine psi_calisr_dw
subroutine psi_caisrx_up(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_caisrx_up
use psb_sort_mod, psb_protect_name => psi_caisrx_up
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)
@ -384,7 +384,7 @@ subroutine psi_caisrx_up(n,x,idx)
end subroutine psi_caisrx_up
subroutine psi_caisrx_dw(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_caisrx_dw
use psb_sort_mod, psb_protect_name => psi_caisrx_dw
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)
@ -412,7 +412,7 @@ subroutine psi_caisrx_dw(n,x,idx)
end subroutine psi_caisrx_dw
subroutine psi_caisr_up(n,x)
use psb_c_sort_mod, psb_protect_name => psi_caisr_up
use psb_sort_mod, psb_protect_name => psi_caisr_up
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)
@ -436,7 +436,7 @@ subroutine psi_caisr_up(n,x)
end subroutine psi_caisr_up
subroutine psi_caisr_dw(n,x)
use psb_c_sort_mod, psb_protect_name => psi_caisr_dw
use psb_sort_mod, psb_protect_name => psi_caisr_dw
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)

@ -42,7 +42,7 @@
!
subroutine psb_cmsort_u(x,nout,dir)
use psb_c_sort_mod, psb_protect_name => psb_cmsort_u
use psb_sort_mod, psb_protect_name => psb_cmsort_u
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)
@ -84,7 +84,7 @@
subroutine psb_cmsort(x,ix,dir,flag)
use psb_c_sort_mod, psb_protect_name => psb_cmsort
use psb_sort_mod, psb_protect_name => psb_cmsort
use psb_error_mod
use psb_ip_reord_mod
implicit none

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_cqsort(x,ix,dir,flag)
use psb_c_sort_mod, psb_protect_name => psb_cqsort
use psb_sort_mod, psb_protect_name => psb_cqsort
use psb_error_mod
implicit none
complex(psb_spk_), intent(inout) :: x(:)
@ -139,7 +139,7 @@ end subroutine psb_cqsort
subroutine psi_clqsrx_up(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_clqsrx_up
use psb_sort_mod, psb_protect_name => psi_clqsrx_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -296,7 +296,7 @@ subroutine psi_clqsrx_up(n,x,idx)
end subroutine psi_clqsrx_up
subroutine psi_clqsrx_dw(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_clqsrx_dw
use psb_sort_mod, psb_protect_name => psi_clqsrx_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -452,7 +452,7 @@ subroutine psi_clqsrx_dw(n,x,idx)
end subroutine psi_clqsrx_dw
subroutine psi_clqsr_up(n,x)
use psb_c_sort_mod, psb_protect_name => psi_clqsr_up
use psb_sort_mod, psb_protect_name => psi_clqsr_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -594,7 +594,7 @@ subroutine psi_clqsr_up(n,x)
end subroutine psi_clqsr_up
subroutine psi_clqsr_dw(n,x)
use psb_c_sort_mod, psb_protect_name => psi_clqsr_dw
use psb_sort_mod, psb_protect_name => psi_clqsr_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -735,7 +735,7 @@ subroutine psi_clqsr_dw(n,x)
end subroutine psi_clqsr_dw
subroutine psi_calqsrx_up(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_calqsrx_up
use psb_sort_mod, psb_protect_name => psi_calqsrx_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -891,7 +891,7 @@ subroutine psi_calqsrx_up(n,x,idx)
end subroutine psi_calqsrx_up
subroutine psi_calqsrx_dw(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_calqsrx_dw
use psb_sort_mod, psb_protect_name => psi_calqsrx_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -1047,7 +1047,7 @@ subroutine psi_calqsrx_dw(n,x,idx)
end subroutine psi_calqsrx_dw
subroutine psi_calqsr_up(n,x)
use psb_c_sort_mod, psb_protect_name => psi_calqsr_up
use psb_sort_mod, psb_protect_name => psi_calqsr_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -1188,7 +1188,7 @@ subroutine psi_calqsr_up(n,x)
end subroutine psi_calqsr_up
subroutine psi_calqsr_dw(n,x)
use psb_c_sort_mod, psb_protect_name => psi_calqsr_dw
use psb_sort_mod, psb_protect_name => psi_calqsr_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -1328,7 +1328,7 @@ subroutine psi_calqsr_dw(n,x)
end subroutine psi_calqsr_dw
subroutine psi_caqsrx_up(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_caqsrx_up
use psb_sort_mod, psb_protect_name => psi_caqsrx_up
use psb_error_mod
implicit none
@ -1485,7 +1485,7 @@ subroutine psi_caqsrx_up(n,x,idx)
end subroutine psi_caqsrx_up
subroutine psi_caqsrx_dw(n,x,idx)
use psb_c_sort_mod, psb_protect_name => psi_caqsrx_dw
use psb_sort_mod, psb_protect_name => psi_caqsrx_dw
use psb_error_mod
implicit none
@ -1640,7 +1640,7 @@ subroutine psi_caqsrx_dw(n,x,idx)
end subroutine psi_caqsrx_dw
subroutine psi_caqsr_up(n,x)
use psb_c_sort_mod, psb_protect_name => psi_caqsr_up
use psb_sort_mod, psb_protect_name => psi_caqsr_up
use psb_error_mod
implicit none
@ -1781,7 +1781,7 @@ subroutine psi_caqsr_up(n,x)
end subroutine psi_caqsr_up
subroutine psi_caqsr_dw(n,x)
use psb_c_sort_mod, psb_protect_name => psi_caqsr_dw
use psb_sort_mod, psb_protect_name => psi_caqsr_dw
use psb_error_mod
implicit none

@ -42,7 +42,7 @@
! Addison-Wesley
!
subroutine psb_dhsort(x,ix,dir,flag)
use psb_d_sort_mod, psb_protect_name => psb_dhsort
use psb_sort_mod, psb_protect_name => psb_dhsort
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -116,13 +116,13 @@ subroutine psb_dhsort(x,ix,dir,flag)
do i=1, n
key = x(i)
index = ix(i)
call psi_d_idx_insert_heap(key,index,l,x,ix,dir_,info)
call psi_idx_insert_heap(key,index,l,x,ix,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! '
end if
end do
do i=n, 2, -1
call psi_d_idx_heap_get_first(key,index,l,x,ix,dir_,info)
call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info)
if (l /= i-1) then
write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i
end if
@ -133,7 +133,7 @@ subroutine psb_dhsort(x,ix,dir,flag)
l = 0
do i=1, n
key = x(i)
call psi_d_insert_heap(key,l,x,dir_,info)
call psi_insert_heap(key,l,x,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i
end if
@ -185,7 +185,7 @@ end subroutine psb_dhsort
!
subroutine psi_d_insert_heap(key,last,heap,dir,info)
use psb_d_sort_mod, psb_protect_name => psi_d_insert_heap
use psb_sort_mod, psb_protect_name => psi_d_insert_heap
implicit none
!
@ -291,7 +291,7 @@ end subroutine psi_d_insert_heap
subroutine psi_d_heap_get_first(key,last,heap,dir,info)
use psb_d_sort_mod, psb_protect_name => psi_d_heap_get_first
use psb_sort_mod, psb_protect_name => psi_d_heap_get_first
implicit none
real(psb_dpk_), intent(inout) :: key
@ -415,7 +415,7 @@ end subroutine psi_d_heap_get_first
subroutine psi_d_idx_insert_heap(key,index,last,heap,idxs,dir,info)
use psb_d_sort_mod, psb_protect_name => psi_d_idx_insert_heap
use psb_sort_mod, psb_protect_name => psi_d_idx_insert_heap
implicit none
!
@ -537,7 +537,7 @@ subroutine psi_d_idx_insert_heap(key,index,last,heap,idxs,dir,info)
end subroutine psi_d_idx_insert_heap
subroutine psi_d_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
use psb_d_sort_mod, psb_protect_name => psi_d_idx_heap_get_first
use psb_sort_mod, psb_protect_name => psi_d_idx_heap_get_first
implicit none
real(psb_dpk_), intent(inout) :: heap(:)

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_disort(x,ix,dir,flag)
use psb_d_sort_mod, psb_protect_name => psb_disort
use psb_sort_mod, psb_protect_name => psb_disort
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -131,7 +131,7 @@ subroutine psb_disort(x,ix,dir,flag)
end subroutine psb_disort
subroutine psi_disrx_up(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_disrx_up
use psb_sort_mod, psb_protect_name => psi_disrx_up
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -159,7 +159,7 @@ subroutine psi_disrx_up(n,x,idx)
end subroutine psi_disrx_up
subroutine psi_disrx_dw(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_disrx_dw
use psb_sort_mod, psb_protect_name => psi_disrx_dw
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -188,7 +188,7 @@ end subroutine psi_disrx_dw
subroutine psi_disr_up(n,x)
use psb_d_sort_mod, psb_protect_name => psi_disr_up
use psb_sort_mod, psb_protect_name => psi_disr_up
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -212,7 +212,7 @@ subroutine psi_disr_up(n,x)
end subroutine psi_disr_up
subroutine psi_disr_dw(n,x)
use psb_d_sort_mod, psb_protect_name => psi_disr_dw
use psb_sort_mod, psb_protect_name => psi_disr_dw
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -236,7 +236,7 @@ subroutine psi_disr_dw(n,x)
end subroutine psi_disr_dw
subroutine psi_daisrx_up(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_daisrx_up
use psb_sort_mod, psb_protect_name => psi_daisrx_up
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -264,7 +264,7 @@ subroutine psi_daisrx_up(n,x,idx)
end subroutine psi_daisrx_up
subroutine psi_daisrx_dw(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_daisrx_dw
use psb_sort_mod, psb_protect_name => psi_daisrx_dw
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -292,7 +292,7 @@ subroutine psi_daisrx_dw(n,x,idx)
end subroutine psi_daisrx_dw
subroutine psi_daisr_up(n,x)
use psb_d_sort_mod, psb_protect_name => psi_daisr_up
use psb_sort_mod, psb_protect_name => psi_daisr_up
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -316,7 +316,7 @@ subroutine psi_daisr_up(n,x)
end subroutine psi_daisr_up
subroutine psi_daisr_dw(n,x)
use psb_d_sort_mod, psb_protect_name => psi_daisr_dw
use psb_sort_mod, psb_protect_name => psi_daisr_dw
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)

@ -42,7 +42,7 @@
!
subroutine psb_dmsort_u(x,nout,dir)
use psb_d_sort_mod, psb_protect_name => psb_dmsort_u
use psb_sort_mod, psb_protect_name => psb_dmsort_u
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -78,7 +78,7 @@
function psb_dbsrch(key,n,v) result(ipos)
use psb_d_sort_mod, psb_protect_name => psb_dbsrch
use psb_sort_mod, psb_protect_name => psb_dbsrch
implicit none
integer(psb_ipk_) :: ipos, n
real(psb_dpk_) :: key
@ -115,7 +115,7 @@
end function psb_dbsrch
function psb_dssrch(key,n,v) result(ipos)
use psb_d_sort_mod, psb_protect_name => psb_dssrch
use psb_sort_mod, psb_protect_name => psb_dssrch
implicit none
integer(psb_ipk_) :: ipos, n
real(psb_dpk_) :: key
@ -135,7 +135,7 @@
end function psb_dssrch
subroutine psb_dmsort(x,ix,dir,flag)
use psb_d_sort_mod, psb_protect_name => psb_dmsort
use psb_sort_mod, psb_protect_name => psb_dmsort
use psb_error_mod
use psb_ip_reord_mod
implicit none

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_dqsort(x,ix,dir,flag)
use psb_d_sort_mod, psb_protect_name => psb_dqsort
use psb_sort_mod, psb_protect_name => psb_dqsort
use psb_error_mod
implicit none
real(psb_dpk_), intent(inout) :: x(:)
@ -130,7 +130,7 @@ subroutine psb_dqsort(x,ix,dir,flag)
end subroutine psb_dqsort
subroutine psi_dqsrx_up(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_dqsrx_up
use psb_sort_mod, psb_protect_name => psi_dqsrx_up
use psb_error_mod
implicit none
@ -284,7 +284,7 @@ subroutine psi_dqsrx_up(n,x,idx)
end subroutine psi_dqsrx_up
subroutine psi_dqsrx_dw(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_dqsrx_dw
use psb_sort_mod, psb_protect_name => psi_dqsrx_dw
use psb_error_mod
implicit none
@ -440,7 +440,7 @@ subroutine psi_dqsrx_dw(n,x,idx)
end subroutine psi_dqsrx_dw
subroutine psi_dqsr_up(n,x)
use psb_d_sort_mod, psb_protect_name => psi_dqsr_up
use psb_sort_mod, psb_protect_name => psi_dqsr_up
use psb_error_mod
implicit none
@ -581,7 +581,7 @@ subroutine psi_dqsr_up(n,x)
end subroutine psi_dqsr_up
subroutine psi_dqsr_dw(n,x)
use psb_d_sort_mod, psb_protect_name => psi_dqsr_dw
use psb_sort_mod, psb_protect_name => psi_dqsr_dw
use psb_error_mod
implicit none
@ -722,7 +722,7 @@ subroutine psi_dqsr_dw(n,x)
end subroutine psi_dqsr_dw
subroutine psi_daqsrx_up(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_daqsrx_up
use psb_sort_mod, psb_protect_name => psi_daqsrx_up
use psb_error_mod
implicit none
@ -879,7 +879,7 @@ subroutine psi_daqsrx_up(n,x,idx)
end subroutine psi_daqsrx_up
subroutine psi_daqsrx_dw(n,x,idx)
use psb_d_sort_mod, psb_protect_name => psi_daqsrx_dw
use psb_sort_mod, psb_protect_name => psi_daqsrx_dw
use psb_error_mod
implicit none
@ -1034,7 +1034,7 @@ subroutine psi_daqsrx_dw(n,x,idx)
end subroutine psi_daqsrx_dw
subroutine psi_daqsr_up(n,x)
use psb_d_sort_mod, psb_protect_name => psi_daqsr_up
use psb_sort_mod, psb_protect_name => psi_daqsr_up
use psb_error_mod
implicit none
@ -1175,7 +1175,7 @@ subroutine psi_daqsr_up(n,x)
end subroutine psi_daqsr_up
subroutine psi_daqsr_dw(n,x)
use psb_d_sort_mod, psb_protect_name => psi_daqsr_dw
use psb_sort_mod, psb_protect_name => psi_daqsr_dw
use psb_error_mod
implicit none

@ -42,7 +42,7 @@
! Addison-Wesley
!
subroutine psb_ihsort(x,ix,dir,flag)
use psb_i_sort_mod, psb_protect_name => psb_ihsort
use psb_sort_mod, psb_protect_name => psb_ihsort
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -116,13 +116,13 @@ subroutine psb_ihsort(x,ix,dir,flag)
do i=1, n
key = x(i)
index = ix(i)
call psi_i_idx_insert_heap(key,index,l,x,ix,dir_,info)
call psi_idx_insert_heap(key,index,l,x,ix,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! '
end if
end do
do i=n, 2, -1
call psi_i_idx_heap_get_first(key,index,l,x,ix,dir_,info)
call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info)
if (l /= i-1) then
write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i
end if
@ -133,7 +133,7 @@ subroutine psb_ihsort(x,ix,dir,flag)
l = 0
do i=1, n
key = x(i)
call psi_i_insert_heap(key,l,x,dir_,info)
call psi_insert_heap(key,l,x,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i
end if
@ -185,7 +185,7 @@ end subroutine psb_ihsort
!
subroutine psi_i_insert_heap(key,last,heap,dir,info)
use psb_i_sort_mod, psb_protect_name => psi_i_insert_heap
use psb_sort_mod, psb_protect_name => psi_i_insert_heap
implicit none
!
@ -291,7 +291,7 @@ end subroutine psi_i_insert_heap
subroutine psi_i_heap_get_first(key,last,heap,dir,info)
use psb_i_sort_mod, psb_protect_name => psi_i_heap_get_first
use psb_sort_mod, psb_protect_name => psi_i_heap_get_first
implicit none
integer(psb_ipk_), intent(inout) :: key
@ -415,7 +415,7 @@ end subroutine psi_i_heap_get_first
subroutine psi_i_idx_insert_heap(key,index,last,heap,idxs,dir,info)
use psb_i_sort_mod, psb_protect_name => psi_i_idx_insert_heap
use psb_sort_mod, psb_protect_name => psi_i_idx_insert_heap
implicit none
!
@ -537,7 +537,7 @@ subroutine psi_i_idx_insert_heap(key,index,last,heap,idxs,dir,info)
end subroutine psi_i_idx_insert_heap
subroutine psi_i_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
use psb_i_sort_mod, psb_protect_name => psi_i_idx_heap_get_first
use psb_sort_mod, psb_protect_name => psi_i_idx_heap_get_first
implicit none
integer(psb_ipk_), intent(inout) :: heap(:)

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_iisort(x,ix,dir,flag)
use psb_i_sort_mod, psb_protect_name => psb_iisort
use psb_sort_mod, psb_protect_name => psb_iisort
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -131,7 +131,7 @@ subroutine psb_iisort(x,ix,dir,flag)
end subroutine psb_iisort
subroutine psi_iisrx_up(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iisrx_up
use psb_sort_mod, psb_protect_name => psi_iisrx_up
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -159,7 +159,7 @@ subroutine psi_iisrx_up(n,x,idx)
end subroutine psi_iisrx_up
subroutine psi_iisrx_dw(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iisrx_dw
use psb_sort_mod, psb_protect_name => psi_iisrx_dw
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -188,7 +188,7 @@ end subroutine psi_iisrx_dw
subroutine psi_iisr_up(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iisr_up
use psb_sort_mod, psb_protect_name => psi_iisr_up
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -212,7 +212,7 @@ subroutine psi_iisr_up(n,x)
end subroutine psi_iisr_up
subroutine psi_iisr_dw(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iisr_dw
use psb_sort_mod, psb_protect_name => psi_iisr_dw
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -236,7 +236,7 @@ subroutine psi_iisr_dw(n,x)
end subroutine psi_iisr_dw
subroutine psi_iaisrx_up(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iaisrx_up
use psb_sort_mod, psb_protect_name => psi_iaisrx_up
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -264,7 +264,7 @@ subroutine psi_iaisrx_up(n,x,idx)
end subroutine psi_iaisrx_up
subroutine psi_iaisrx_dw(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iaisrx_dw
use psb_sort_mod, psb_protect_name => psi_iaisrx_dw
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -292,7 +292,7 @@ subroutine psi_iaisrx_dw(n,x,idx)
end subroutine psi_iaisrx_dw
subroutine psi_iaisr_up(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iaisr_up
use psb_sort_mod, psb_protect_name => psi_iaisr_up
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -316,7 +316,7 @@ subroutine psi_iaisr_up(n,x)
end subroutine psi_iaisr_up
subroutine psi_iaisr_dw(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iaisr_dw
use psb_sort_mod, psb_protect_name => psi_iaisr_dw
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)

@ -41,7 +41,7 @@
! Addison-Wesley
!
logical function psb_iisaperm(n,eip)
use psb_i_sort_mod, psb_protect_name => psb_iisaperm
use psb_sort_mod, psb_protect_name => psb_iisaperm
implicit none
integer(psb_ipk_), intent(in) :: n
@ -97,7 +97,7 @@
subroutine psb_imsort_u(x,nout,dir)
use psb_i_sort_mod, psb_protect_name => psb_imsort_u
use psb_sort_mod, psb_protect_name => psb_imsort_u
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -133,7 +133,7 @@
function psb_ibsrch(key,n,v) result(ipos)
use psb_i_sort_mod, psb_protect_name => psb_ibsrch
use psb_sort_mod, psb_protect_name => psb_ibsrch
implicit none
integer(psb_ipk_) :: ipos, n
integer(psb_ipk_) :: key
@ -170,7 +170,7 @@
end function psb_ibsrch
function psb_issrch(key,n,v) result(ipos)
use psb_i_sort_mod, psb_protect_name => psb_issrch
use psb_sort_mod, psb_protect_name => psb_issrch
implicit none
integer(psb_ipk_) :: ipos, n
integer(psb_ipk_) :: key
@ -190,7 +190,7 @@
end function psb_issrch
subroutine psb_imsort(x,ix,dir,flag)
use psb_i_sort_mod, psb_protect_name => psb_imsort
use psb_sort_mod, psb_protect_name => psb_imsort
use psb_error_mod
use psb_ip_reord_mod
implicit none

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_iqsort(x,ix,dir,flag)
use psb_i_sort_mod, psb_protect_name => psb_iqsort
use psb_sort_mod, psb_protect_name => psb_iqsort
use psb_error_mod
implicit none
integer(psb_ipk_), intent(inout) :: x(:)
@ -130,7 +130,7 @@ subroutine psb_iqsort(x,ix,dir,flag)
end subroutine psb_iqsort
subroutine psi_iqsrx_up(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iqsrx_up
use psb_sort_mod, psb_protect_name => psi_iqsrx_up
use psb_error_mod
implicit none
@ -284,7 +284,7 @@ subroutine psi_iqsrx_up(n,x,idx)
end subroutine psi_iqsrx_up
subroutine psi_iqsrx_dw(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iqsrx_dw
use psb_sort_mod, psb_protect_name => psi_iqsrx_dw
use psb_error_mod
implicit none
@ -440,7 +440,7 @@ subroutine psi_iqsrx_dw(n,x,idx)
end subroutine psi_iqsrx_dw
subroutine psi_iqsr_up(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iqsr_up
use psb_sort_mod, psb_protect_name => psi_iqsr_up
use psb_error_mod
implicit none
@ -581,7 +581,7 @@ subroutine psi_iqsr_up(n,x)
end subroutine psi_iqsr_up
subroutine psi_iqsr_dw(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iqsr_dw
use psb_sort_mod, psb_protect_name => psi_iqsr_dw
use psb_error_mod
implicit none
@ -722,7 +722,7 @@ subroutine psi_iqsr_dw(n,x)
end subroutine psi_iqsr_dw
subroutine psi_iaqsrx_up(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iaqsrx_up
use psb_sort_mod, psb_protect_name => psi_iaqsrx_up
use psb_error_mod
implicit none
@ -879,7 +879,7 @@ subroutine psi_iaqsrx_up(n,x,idx)
end subroutine psi_iaqsrx_up
subroutine psi_iaqsrx_dw(n,x,idx)
use psb_i_sort_mod, psb_protect_name => psi_iaqsrx_dw
use psb_sort_mod, psb_protect_name => psi_iaqsrx_dw
use psb_error_mod
implicit none
@ -1034,7 +1034,7 @@ subroutine psi_iaqsrx_dw(n,x,idx)
end subroutine psi_iaqsrx_dw
subroutine psi_iaqsr_up(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iaqsr_up
use psb_sort_mod, psb_protect_name => psi_iaqsr_up
use psb_error_mod
implicit none
@ -1175,7 +1175,7 @@ subroutine psi_iaqsr_up(n,x)
end subroutine psi_iaqsr_up
subroutine psi_iaqsr_dw(n,x)
use psb_i_sort_mod, psb_protect_name => psi_iaqsr_dw
use psb_sort_mod, psb_protect_name => psi_iaqsr_dw
use psb_error_mod
implicit none

@ -42,7 +42,7 @@
! Addison-Wesley
!
subroutine psb_lhsort(x,ix,dir,flag)
use psb_l_sort_mod, psb_protect_name => psb_lhsort
use psb_sort_mod, psb_protect_name => psb_lhsort
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -116,13 +116,13 @@ subroutine psb_lhsort(x,ix,dir,flag)
do i=1, n
key = x(i)
index = ix(i)
call psi_l_idx_insert_heap(key,index,l,x,ix,dir_,info)
call psi_idx_insert_heap(key,index,l,x,ix,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! '
end if
end do
do i=n, 2, -1
call psi_l_idx_heap_get_first(key,index,l,x,ix,dir_,info)
call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info)
if (l /= i-1) then
write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i
end if
@ -133,7 +133,7 @@ subroutine psb_lhsort(x,ix,dir,flag)
l = 0
do i=1, n
key = x(i)
call psi_l_insert_heap(key,l,x,dir_,info)
call psi_insert_heap(key,l,x,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i
end if
@ -185,7 +185,7 @@ end subroutine psb_lhsort
!
subroutine psi_l_insert_heap(key,last,heap,dir,info)
use psb_l_sort_mod, psb_protect_name => psi_l_insert_heap
use psb_sort_mod, psb_protect_name => psi_l_insert_heap
implicit none
!
@ -291,7 +291,7 @@ end subroutine psi_l_insert_heap
subroutine psi_l_heap_get_first(key,last,heap,dir,info)
use psb_l_sort_mod, psb_protect_name => psi_l_heap_get_first
use psb_sort_mod, psb_protect_name => psi_l_heap_get_first
implicit none
integer(psb_lpk_), intent(inout) :: key
@ -415,7 +415,7 @@ end subroutine psi_l_heap_get_first
subroutine psi_l_idx_insert_heap(key,index,last,heap,idxs,dir,info)
use psb_l_sort_mod, psb_protect_name => psi_l_idx_insert_heap
use psb_sort_mod, psb_protect_name => psi_l_idx_insert_heap
implicit none
!
@ -537,7 +537,7 @@ subroutine psi_l_idx_insert_heap(key,index,last,heap,idxs,dir,info)
end subroutine psi_l_idx_insert_heap
subroutine psi_l_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
use psb_l_sort_mod, psb_protect_name => psi_l_idx_heap_get_first
use psb_sort_mod, psb_protect_name => psi_l_idx_heap_get_first
implicit none
integer(psb_lpk_), intent(inout) :: heap(:)

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_lisort(x,ix,dir,flag)
use psb_l_sort_mod, psb_protect_name => psb_lisort
use psb_sort_mod, psb_protect_name => psb_lisort
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -131,7 +131,7 @@ subroutine psb_lisort(x,ix,dir,flag)
end subroutine psb_lisort
subroutine psi_lisrx_up(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_lisrx_up
use psb_sort_mod, psb_protect_name => psi_lisrx_up
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -159,7 +159,7 @@ subroutine psi_lisrx_up(n,x,idx)
end subroutine psi_lisrx_up
subroutine psi_lisrx_dw(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_lisrx_dw
use psb_sort_mod, psb_protect_name => psi_lisrx_dw
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -188,7 +188,7 @@ end subroutine psi_lisrx_dw
subroutine psi_lisr_up(n,x)
use psb_l_sort_mod, psb_protect_name => psi_lisr_up
use psb_sort_mod, psb_protect_name => psi_lisr_up
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -212,7 +212,7 @@ subroutine psi_lisr_up(n,x)
end subroutine psi_lisr_up
subroutine psi_lisr_dw(n,x)
use psb_l_sort_mod, psb_protect_name => psi_lisr_dw
use psb_sort_mod, psb_protect_name => psi_lisr_dw
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -236,7 +236,7 @@ subroutine psi_lisr_dw(n,x)
end subroutine psi_lisr_dw
subroutine psi_laisrx_up(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_laisrx_up
use psb_sort_mod, psb_protect_name => psi_laisrx_up
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -264,7 +264,7 @@ subroutine psi_laisrx_up(n,x,idx)
end subroutine psi_laisrx_up
subroutine psi_laisrx_dw(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_laisrx_dw
use psb_sort_mod, psb_protect_name => psi_laisrx_dw
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -292,7 +292,7 @@ subroutine psi_laisrx_dw(n,x,idx)
end subroutine psi_laisrx_dw
subroutine psi_laisr_up(n,x)
use psb_l_sort_mod, psb_protect_name => psi_laisr_up
use psb_sort_mod, psb_protect_name => psi_laisr_up
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -316,7 +316,7 @@ subroutine psi_laisr_up(n,x)
end subroutine psi_laisr_up
subroutine psi_laisr_dw(n,x)
use psb_l_sort_mod, psb_protect_name => psi_laisr_dw
use psb_sort_mod, psb_protect_name => psi_laisr_dw
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)

@ -41,7 +41,7 @@
! Addison-Wesley
!
logical function psb_lisaperm(n,eip)
use psb_l_sort_mod, psb_protect_name => psb_lisaperm
use psb_sort_mod, psb_protect_name => psb_lisaperm
implicit none
integer(psb_lpk_), intent(in) :: n
@ -97,7 +97,7 @@
subroutine psb_lmsort_u(x,nout,dir)
use psb_l_sort_mod, psb_protect_name => psb_lmsort_u
use psb_sort_mod, psb_protect_name => psb_lmsort_u
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -133,7 +133,7 @@
function psb_lbsrch(key,n,v) result(ipos)
use psb_l_sort_mod, psb_protect_name => psb_lbsrch
use psb_sort_mod, psb_protect_name => psb_lbsrch
implicit none
integer(psb_ipk_) :: ipos, n
integer(psb_lpk_) :: key
@ -170,7 +170,7 @@
end function psb_lbsrch
function psb_lssrch(key,n,v) result(ipos)
use psb_l_sort_mod, psb_protect_name => psb_lssrch
use psb_sort_mod, psb_protect_name => psb_lssrch
implicit none
integer(psb_ipk_) :: ipos, n
integer(psb_lpk_) :: key
@ -190,7 +190,7 @@
end function psb_lssrch
subroutine psb_lmsort(x,ix,dir,flag)
use psb_l_sort_mod, psb_protect_name => psb_lmsort
use psb_sort_mod, psb_protect_name => psb_lmsort
use psb_error_mod
use psb_ip_reord_mod
implicit none

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_lqsort(x,ix,dir,flag)
use psb_l_sort_mod, psb_protect_name => psb_lqsort
use psb_sort_mod, psb_protect_name => psb_lqsort
use psb_error_mod
implicit none
integer(psb_lpk_), intent(inout) :: x(:)
@ -130,7 +130,7 @@ subroutine psb_lqsort(x,ix,dir,flag)
end subroutine psb_lqsort
subroutine psi_lqsrx_up(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_lqsrx_up
use psb_sort_mod, psb_protect_name => psi_lqsrx_up
use psb_error_mod
implicit none
@ -284,7 +284,7 @@ subroutine psi_lqsrx_up(n,x,idx)
end subroutine psi_lqsrx_up
subroutine psi_lqsrx_dw(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_lqsrx_dw
use psb_sort_mod, psb_protect_name => psi_lqsrx_dw
use psb_error_mod
implicit none
@ -440,7 +440,7 @@ subroutine psi_lqsrx_dw(n,x,idx)
end subroutine psi_lqsrx_dw
subroutine psi_lqsr_up(n,x)
use psb_l_sort_mod, psb_protect_name => psi_lqsr_up
use psb_sort_mod, psb_protect_name => psi_lqsr_up
use psb_error_mod
implicit none
@ -581,7 +581,7 @@ subroutine psi_lqsr_up(n,x)
end subroutine psi_lqsr_up
subroutine psi_lqsr_dw(n,x)
use psb_l_sort_mod, psb_protect_name => psi_lqsr_dw
use psb_sort_mod, psb_protect_name => psi_lqsr_dw
use psb_error_mod
implicit none
@ -722,7 +722,7 @@ subroutine psi_lqsr_dw(n,x)
end subroutine psi_lqsr_dw
subroutine psi_laqsrx_up(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_laqsrx_up
use psb_sort_mod, psb_protect_name => psi_laqsrx_up
use psb_error_mod
implicit none
@ -879,7 +879,7 @@ subroutine psi_laqsrx_up(n,x,idx)
end subroutine psi_laqsrx_up
subroutine psi_laqsrx_dw(n,x,idx)
use psb_l_sort_mod, psb_protect_name => psi_laqsrx_dw
use psb_sort_mod, psb_protect_name => psi_laqsrx_dw
use psb_error_mod
implicit none
@ -1034,7 +1034,7 @@ subroutine psi_laqsrx_dw(n,x,idx)
end subroutine psi_laqsrx_dw
subroutine psi_laqsr_up(n,x)
use psb_l_sort_mod, psb_protect_name => psi_laqsr_up
use psb_sort_mod, psb_protect_name => psi_laqsr_up
use psb_error_mod
implicit none
@ -1175,7 +1175,7 @@ subroutine psi_laqsr_up(n,x)
end subroutine psi_laqsr_up
subroutine psi_laqsr_dw(n,x)
use psb_l_sort_mod, psb_protect_name => psi_laqsr_dw
use psb_sort_mod, psb_protect_name => psi_laqsr_dw
use psb_error_mod
implicit none

@ -42,7 +42,7 @@
! Addison-Wesley
!
subroutine psb_shsort(x,ix,dir,flag)
use psb_s_sort_mod, psb_protect_name => psb_shsort
use psb_sort_mod, psb_protect_name => psb_shsort
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -116,13 +116,13 @@ subroutine psb_shsort(x,ix,dir,flag)
do i=1, n
key = x(i)
index = ix(i)
call psi_s_idx_insert_heap(key,index,l,x,ix,dir_,info)
call psi_idx_insert_heap(key,index,l,x,ix,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! '
end if
end do
do i=n, 2, -1
call psi_s_idx_heap_get_first(key,index,l,x,ix,dir_,info)
call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info)
if (l /= i-1) then
write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i
end if
@ -133,7 +133,7 @@ subroutine psb_shsort(x,ix,dir,flag)
l = 0
do i=1, n
key = x(i)
call psi_s_insert_heap(key,l,x,dir_,info)
call psi_insert_heap(key,l,x,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i
end if
@ -185,7 +185,7 @@ end subroutine psb_shsort
!
subroutine psi_s_insert_heap(key,last,heap,dir,info)
use psb_s_sort_mod, psb_protect_name => psi_s_insert_heap
use psb_sort_mod, psb_protect_name => psi_s_insert_heap
implicit none
!
@ -291,7 +291,7 @@ end subroutine psi_s_insert_heap
subroutine psi_s_heap_get_first(key,last,heap,dir,info)
use psb_s_sort_mod, psb_protect_name => psi_s_heap_get_first
use psb_sort_mod, psb_protect_name => psi_s_heap_get_first
implicit none
real(psb_spk_), intent(inout) :: key
@ -415,7 +415,7 @@ end subroutine psi_s_heap_get_first
subroutine psi_s_idx_insert_heap(key,index,last,heap,idxs,dir,info)
use psb_s_sort_mod, psb_protect_name => psi_s_idx_insert_heap
use psb_sort_mod, psb_protect_name => psi_s_idx_insert_heap
implicit none
!
@ -537,7 +537,7 @@ subroutine psi_s_idx_insert_heap(key,index,last,heap,idxs,dir,info)
end subroutine psi_s_idx_insert_heap
subroutine psi_s_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
use psb_s_sort_mod, psb_protect_name => psi_s_idx_heap_get_first
use psb_sort_mod, psb_protect_name => psi_s_idx_heap_get_first
implicit none
real(psb_spk_), intent(inout) :: heap(:)

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_sisort(x,ix,dir,flag)
use psb_s_sort_mod, psb_protect_name => psb_sisort
use psb_sort_mod, psb_protect_name => psb_sisort
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -131,7 +131,7 @@ subroutine psb_sisort(x,ix,dir,flag)
end subroutine psb_sisort
subroutine psi_sisrx_up(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_sisrx_up
use psb_sort_mod, psb_protect_name => psi_sisrx_up
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -159,7 +159,7 @@ subroutine psi_sisrx_up(n,x,idx)
end subroutine psi_sisrx_up
subroutine psi_sisrx_dw(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_sisrx_dw
use psb_sort_mod, psb_protect_name => psi_sisrx_dw
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -188,7 +188,7 @@ end subroutine psi_sisrx_dw
subroutine psi_sisr_up(n,x)
use psb_s_sort_mod, psb_protect_name => psi_sisr_up
use psb_sort_mod, psb_protect_name => psi_sisr_up
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -212,7 +212,7 @@ subroutine psi_sisr_up(n,x)
end subroutine psi_sisr_up
subroutine psi_sisr_dw(n,x)
use psb_s_sort_mod, psb_protect_name => psi_sisr_dw
use psb_sort_mod, psb_protect_name => psi_sisr_dw
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -236,7 +236,7 @@ subroutine psi_sisr_dw(n,x)
end subroutine psi_sisr_dw
subroutine psi_saisrx_up(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_saisrx_up
use psb_sort_mod, psb_protect_name => psi_saisrx_up
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -264,7 +264,7 @@ subroutine psi_saisrx_up(n,x,idx)
end subroutine psi_saisrx_up
subroutine psi_saisrx_dw(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_saisrx_dw
use psb_sort_mod, psb_protect_name => psi_saisrx_dw
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -292,7 +292,7 @@ subroutine psi_saisrx_dw(n,x,idx)
end subroutine psi_saisrx_dw
subroutine psi_saisr_up(n,x)
use psb_s_sort_mod, psb_protect_name => psi_saisr_up
use psb_sort_mod, psb_protect_name => psi_saisr_up
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -316,7 +316,7 @@ subroutine psi_saisr_up(n,x)
end subroutine psi_saisr_up
subroutine psi_saisr_dw(n,x)
use psb_s_sort_mod, psb_protect_name => psi_saisr_dw
use psb_sort_mod, psb_protect_name => psi_saisr_dw
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)

@ -42,7 +42,7 @@
!
subroutine psb_smsort_u(x,nout,dir)
use psb_s_sort_mod, psb_protect_name => psb_smsort_u
use psb_sort_mod, psb_protect_name => psb_smsort_u
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -78,7 +78,7 @@
function psb_sbsrch(key,n,v) result(ipos)
use psb_s_sort_mod, psb_protect_name => psb_sbsrch
use psb_sort_mod, psb_protect_name => psb_sbsrch
implicit none
integer(psb_ipk_) :: ipos, n
real(psb_spk_) :: key
@ -115,7 +115,7 @@
end function psb_sbsrch
function psb_sssrch(key,n,v) result(ipos)
use psb_s_sort_mod, psb_protect_name => psb_sssrch
use psb_sort_mod, psb_protect_name => psb_sssrch
implicit none
integer(psb_ipk_) :: ipos, n
real(psb_spk_) :: key
@ -135,7 +135,7 @@
end function psb_sssrch
subroutine psb_smsort(x,ix,dir,flag)
use psb_s_sort_mod, psb_protect_name => psb_smsort
use psb_sort_mod, psb_protect_name => psb_smsort
use psb_error_mod
use psb_ip_reord_mod
implicit none

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_sqsort(x,ix,dir,flag)
use psb_s_sort_mod, psb_protect_name => psb_sqsort
use psb_sort_mod, psb_protect_name => psb_sqsort
use psb_error_mod
implicit none
real(psb_spk_), intent(inout) :: x(:)
@ -130,7 +130,7 @@ subroutine psb_sqsort(x,ix,dir,flag)
end subroutine psb_sqsort
subroutine psi_sqsrx_up(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_sqsrx_up
use psb_sort_mod, psb_protect_name => psi_sqsrx_up
use psb_error_mod
implicit none
@ -284,7 +284,7 @@ subroutine psi_sqsrx_up(n,x,idx)
end subroutine psi_sqsrx_up
subroutine psi_sqsrx_dw(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_sqsrx_dw
use psb_sort_mod, psb_protect_name => psi_sqsrx_dw
use psb_error_mod
implicit none
@ -440,7 +440,7 @@ subroutine psi_sqsrx_dw(n,x,idx)
end subroutine psi_sqsrx_dw
subroutine psi_sqsr_up(n,x)
use psb_s_sort_mod, psb_protect_name => psi_sqsr_up
use psb_sort_mod, psb_protect_name => psi_sqsr_up
use psb_error_mod
implicit none
@ -581,7 +581,7 @@ subroutine psi_sqsr_up(n,x)
end subroutine psi_sqsr_up
subroutine psi_sqsr_dw(n,x)
use psb_s_sort_mod, psb_protect_name => psi_sqsr_dw
use psb_sort_mod, psb_protect_name => psi_sqsr_dw
use psb_error_mod
implicit none
@ -722,7 +722,7 @@ subroutine psi_sqsr_dw(n,x)
end subroutine psi_sqsr_dw
subroutine psi_saqsrx_up(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_saqsrx_up
use psb_sort_mod, psb_protect_name => psi_saqsrx_up
use psb_error_mod
implicit none
@ -879,7 +879,7 @@ subroutine psi_saqsrx_up(n,x,idx)
end subroutine psi_saqsrx_up
subroutine psi_saqsrx_dw(n,x,idx)
use psb_s_sort_mod, psb_protect_name => psi_saqsrx_dw
use psb_sort_mod, psb_protect_name => psi_saqsrx_dw
use psb_error_mod
implicit none
@ -1034,7 +1034,7 @@ subroutine psi_saqsrx_dw(n,x,idx)
end subroutine psi_saqsrx_dw
subroutine psi_saqsr_up(n,x)
use psb_s_sort_mod, psb_protect_name => psi_saqsr_up
use psb_sort_mod, psb_protect_name => psi_saqsr_up
use psb_error_mod
implicit none
@ -1175,7 +1175,7 @@ subroutine psi_saqsr_up(n,x)
end subroutine psi_saqsr_up
subroutine psi_saqsr_dw(n,x)
use psb_s_sort_mod, psb_protect_name => psi_saqsr_dw
use psb_sort_mod, psb_protect_name => psi_saqsr_dw
use psb_error_mod
implicit none

@ -42,7 +42,7 @@
! Addison-Wesley
!
subroutine psb_zhsort(x,ix,dir,flag)
use psb_z_sort_mod, psb_protect_name => psb_zhsort
use psb_sort_mod, psb_protect_name => psb_zhsort
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)
@ -116,13 +116,13 @@ subroutine psb_zhsort(x,ix,dir,flag)
do i=1, n
key = x(i)
index = ix(i)
call psi_z_idx_insert_heap(key,index,l,x,ix,dir_,info)
call psi_idx_insert_heap(key,index,l,x,ix,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! '
end if
end do
do i=n, 2, -1
call psi_z_idx_heap_get_first(key,index,l,x,ix,dir_,info)
call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info)
if (l /= i-1) then
write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i
end if
@ -133,7 +133,7 @@ subroutine psb_zhsort(x,ix,dir,flag)
l = 0
do i=1, n
key = x(i)
call psi_z_insert_heap(key,l,x,dir_,info)
call psi_insert_heap(key,l,x,dir_,info)
if (l /= i) then
write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i
end if
@ -185,7 +185,7 @@ end subroutine psb_zhsort
!
subroutine psi_z_insert_heap(key,last,heap,dir,info)
use psb_z_sort_mod, psb_protect_name => psi_z_insert_heap
use psb_sort_mod, psb_protect_name => psi_z_insert_heap
implicit none
!
@ -391,7 +391,7 @@ contains
end subroutine psi_z_insert_heap
subroutine psi_z_heap_get_first(key,last,heap,dir,info)
use psb_z_sort_mod, psb_protect_name => psi_z_heap_get_first
use psb_sort_mod, psb_protect_name => psi_z_heap_get_first
implicit none
!
@ -633,7 +633,7 @@ contains
end subroutine psi_z_heap_get_first
subroutine psi_z_idx_insert_heap(key,index,last,heap,idxs,dir,info)
use psb_z_sort_mod, psb_protect_name => psi_z_idx_insert_heap
use psb_sort_mod, psb_protect_name => psi_z_idx_insert_heap
implicit none
!
@ -869,7 +869,7 @@ end subroutine psi_z_idx_insert_heap
subroutine psi_z_idx_heap_get_first(key,index,last,heap,idxs,dir,info)
use psb_z_sort_mod, psb_protect_name => psi_z_idx_heap_get_first
use psb_sort_mod, psb_protect_name => psi_z_idx_heap_get_first
implicit none
!

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_zisort(x,ix,dir,flag)
use psb_z_sort_mod, psb_protect_name => psb_zisort
use psb_sort_mod, psb_protect_name => psb_zisort
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)
@ -139,7 +139,7 @@ subroutine psb_zisort(x,ix,dir,flag)
end subroutine psb_zisort
subroutine psi_zlisrx_up(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zlisrx_up
use psb_sort_mod, psb_protect_name => psi_zlisrx_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -169,7 +169,7 @@ subroutine psi_zlisrx_up(n,x,idx)
end subroutine psi_zlisrx_up
subroutine psi_zlisrx_dw(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zlisrx_dw
use psb_sort_mod, psb_protect_name => psi_zlisrx_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -198,7 +198,7 @@ subroutine psi_zlisrx_dw(n,x,idx)
end subroutine psi_zlisrx_dw
subroutine psi_zlisr_up(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zlisr_up
use psb_sort_mod, psb_protect_name => psi_zlisr_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -223,7 +223,7 @@ subroutine psi_zlisr_up(n,x)
end subroutine psi_zlisr_up
subroutine psi_zlisr_dw(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zlisr_dw
use psb_sort_mod, psb_protect_name => psi_zlisr_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -248,7 +248,7 @@ subroutine psi_zlisr_dw(n,x)
end subroutine psi_zlisr_dw
subroutine psi_zalisrx_up(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zalisrx_up
use psb_sort_mod, psb_protect_name => psi_zalisrx_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -277,7 +277,7 @@ subroutine psi_zalisrx_up(n,x,idx)
end subroutine psi_zalisrx_up
subroutine psi_zalisrx_dw(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zalisrx_dw
use psb_sort_mod, psb_protect_name => psi_zalisrx_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -306,7 +306,7 @@ subroutine psi_zalisrx_dw(n,x,idx)
end subroutine psi_zalisrx_dw
subroutine psi_zalisr_up(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zalisr_up
use psb_sort_mod, psb_protect_name => psi_zalisr_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -331,7 +331,7 @@ subroutine psi_zalisr_up(n,x)
end subroutine psi_zalisr_up
subroutine psi_zalisr_dw(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zalisr_dw
use psb_sort_mod, psb_protect_name => psi_zalisr_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -356,7 +356,7 @@ subroutine psi_zalisr_dw(n,x)
end subroutine psi_zalisr_dw
subroutine psi_zaisrx_up(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zaisrx_up
use psb_sort_mod, psb_protect_name => psi_zaisrx_up
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)
@ -384,7 +384,7 @@ subroutine psi_zaisrx_up(n,x,idx)
end subroutine psi_zaisrx_up
subroutine psi_zaisrx_dw(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zaisrx_dw
use psb_sort_mod, psb_protect_name => psi_zaisrx_dw
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)
@ -412,7 +412,7 @@ subroutine psi_zaisrx_dw(n,x,idx)
end subroutine psi_zaisrx_dw
subroutine psi_zaisr_up(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zaisr_up
use psb_sort_mod, psb_protect_name => psi_zaisr_up
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)
@ -436,7 +436,7 @@ subroutine psi_zaisr_up(n,x)
end subroutine psi_zaisr_up
subroutine psi_zaisr_dw(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zaisr_dw
use psb_sort_mod, psb_protect_name => psi_zaisr_dw
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)

@ -42,7 +42,7 @@
!
subroutine psb_zmsort_u(x,nout,dir)
use psb_z_sort_mod, psb_protect_name => psb_zmsort_u
use psb_sort_mod, psb_protect_name => psb_zmsort_u
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)
@ -84,7 +84,7 @@
subroutine psb_zmsort(x,ix,dir,flag)
use psb_z_sort_mod, psb_protect_name => psb_zmsort
use psb_sort_mod, psb_protect_name => psb_zmsort
use psb_error_mod
use psb_ip_reord_mod
implicit none

@ -41,7 +41,7 @@
! Addison-Wesley
!
subroutine psb_zqsort(x,ix,dir,flag)
use psb_z_sort_mod, psb_protect_name => psb_zqsort
use psb_sort_mod, psb_protect_name => psb_zqsort
use psb_error_mod
implicit none
complex(psb_dpk_), intent(inout) :: x(:)
@ -139,7 +139,7 @@ end subroutine psb_zqsort
subroutine psi_zlqsrx_up(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zlqsrx_up
use psb_sort_mod, psb_protect_name => psi_zlqsrx_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -296,7 +296,7 @@ subroutine psi_zlqsrx_up(n,x,idx)
end subroutine psi_zlqsrx_up
subroutine psi_zlqsrx_dw(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zlqsrx_dw
use psb_sort_mod, psb_protect_name => psi_zlqsrx_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -452,7 +452,7 @@ subroutine psi_zlqsrx_dw(n,x,idx)
end subroutine psi_zlqsrx_dw
subroutine psi_zlqsr_up(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zlqsr_up
use psb_sort_mod, psb_protect_name => psi_zlqsr_up
use psb_error_mod
use psi_lcx_mod
implicit none
@ -594,7 +594,7 @@ subroutine psi_zlqsr_up(n,x)
end subroutine psi_zlqsr_up
subroutine psi_zlqsr_dw(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zlqsr_dw
use psb_sort_mod, psb_protect_name => psi_zlqsr_dw
use psb_error_mod
use psi_lcx_mod
implicit none
@ -735,7 +735,7 @@ subroutine psi_zlqsr_dw(n,x)
end subroutine psi_zlqsr_dw
subroutine psi_zalqsrx_up(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zalqsrx_up
use psb_sort_mod, psb_protect_name => psi_zalqsrx_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -891,7 +891,7 @@ subroutine psi_zalqsrx_up(n,x,idx)
end subroutine psi_zalqsrx_up
subroutine psi_zalqsrx_dw(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zalqsrx_dw
use psb_sort_mod, psb_protect_name => psi_zalqsrx_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -1047,7 +1047,7 @@ subroutine psi_zalqsrx_dw(n,x,idx)
end subroutine psi_zalqsrx_dw
subroutine psi_zalqsr_up(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zalqsr_up
use psb_sort_mod, psb_protect_name => psi_zalqsr_up
use psb_error_mod
use psi_alcx_mod
implicit none
@ -1188,7 +1188,7 @@ subroutine psi_zalqsr_up(n,x)
end subroutine psi_zalqsr_up
subroutine psi_zalqsr_dw(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zalqsr_dw
use psb_sort_mod, psb_protect_name => psi_zalqsr_dw
use psb_error_mod
use psi_alcx_mod
implicit none
@ -1328,7 +1328,7 @@ subroutine psi_zalqsr_dw(n,x)
end subroutine psi_zalqsr_dw
subroutine psi_zaqsrx_up(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zaqsrx_up
use psb_sort_mod, psb_protect_name => psi_zaqsrx_up
use psb_error_mod
implicit none
@ -1485,7 +1485,7 @@ subroutine psi_zaqsrx_up(n,x,idx)
end subroutine psi_zaqsrx_up
subroutine psi_zaqsrx_dw(n,x,idx)
use psb_z_sort_mod, psb_protect_name => psi_zaqsrx_dw
use psb_sort_mod, psb_protect_name => psi_zaqsrx_dw
use psb_error_mod
implicit none
@ -1640,7 +1640,7 @@ subroutine psi_zaqsrx_dw(n,x,idx)
end subroutine psi_zaqsrx_dw
subroutine psi_zaqsr_up(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zaqsr_up
use psb_sort_mod, psb_protect_name => psi_zaqsr_up
use psb_error_mod
implicit none
@ -1781,7 +1781,7 @@ subroutine psi_zaqsr_up(n,x)
end subroutine psi_zaqsr_up
subroutine psi_zaqsr_dw(n,x)
use psb_z_sort_mod, psb_protect_name => psi_zaqsr_dw
use psb_sort_mod, psb_protect_name => psi_zaqsr_dw
use psb_error_mod
implicit none

Loading…
Cancel
Save