logical pure function det_int_arr_gt(a, b, len)
! Make a comparison we can sort determinant integer arrays by. Return true if the
! first differing integer of a, b is such that a(i) > b(i).
!
! In: a, b - The arrays to compare
! len - An optional argument to specify the size to consider.
! If not provided, then min(size(a), size(b)) is used.
! Ret: - If a > b
!NOTE: These will sort by the bit-string integer length, n_int.
!Therefore, these may be 32 or 64 bit integers and should
!only be used as such.
integer(kind=n_int), intent(in), dimension(:) :: a, b
integer, intent(in), optional :: len
integer llen, i
if(present(len)) then
llen = len
else
llen = min(size(a), size(b))
endif
! Sort by the first integer first ...
i = 1
do i = 1, llen
if(a(i) /= b(i)) exit
enddo
! Make the comparison
if(i > llen) then
det_int_arr_gt = .false.
else
if(a(i) > b(i)) then
det_int_arr_gt = .true.
else
det_int_arr_gt = .false.
endif
endif
end function det_int_arr_gt