(j3.2006) (SC22WG5.5077) Fwd: Sorting and searching in Fortran

Dan Nagle dannagle
Wed Aug 14 17:49:16 EDT 2013


Hi,

The originator of this proposal has coauthored a book on Fortran,
and is generally well-respected in the community.

He has made a suggestion for new features for Fortran.
I told him I would forward this to the wg5 list, so here 'tis.

Begin forwarded message:

> Is this what you would need as a starting point, or should I embellish them some more?
> 
> Regards,
> 
> Walter
> 
> ---------------------------------------------------------------------------
> 
> Basic sorting requirements:
> ===========================
> 
> - An intrinsic function form that can be used in expressions (ala
>   HPF 2.0 sort_up and sort_down - sans the complicated DIM argument),
> 
> - A 'graded' intrinsic function which returns a permutation array of
>   integers which can be used to permute the input array (again, ala
>   HPF grade_up and grade_down - sans the complicated DIM argument),
> 
> - An intrinsic subroutine form that supports 'in-place' sorts,
> 
> - Support INTEGER, REAL, and CHARACTER(*) types directly, e.g. without
>   requiring a user-defined comparison function,
> 
> - Support both ascending and descending sorts,
> 
> - CHARACTER sorts support either 'default' or 'ASCII' collating
>   sequence,
> 
> - Optional argument for a user-supplied comparison function for support
>   of derived types, non-standard collating sequences, etc.
> 
> 
> Basic binary search requirements:
> =================================
> 
> - Intrinsic function which returns the index of the location of a value
>   in a pre-sorted array.  If a match is not found, return 0.
> 
> - Support INTEGER, REAL, and CHARACTER(*) types directly, e.g. without
>   requiring a user-defined comparison function,
> 
> - Support both ascending and descending sorted input arrays
> 
> - CHARACTER search supports either 'default' or 'ASCII' collating
>   sequence
> 
> - Optional argument for a user-supplied comparison function for search
>   of derived types, non-standard collating sequences, tolerance in
>   floating point comparisons, etc.

-- 
Cheers!

Dan Nagle







More information about the J3 mailing list