Skip to content

urbanjost/M_orderpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Name

M_orderpack(3f) - general and specialized ranking and sorting routines

Description

This repository is a derivative of ORDERPACK 2.0 from Michel Olagnon that additionally

  • supports CHARACTER variables as well as numeric variables on many of the procedures.
  • has been restructured so as to be useable as an fpm(1) package.
  • is placed in a git(1) repository for version control.
  • had man-pages and working demonstration programs of each procedure added.
  • contains a growing set of unit tests.

M_ORDERPACK 2.1 performs both conventional sorting and ranking as well as the rarer specialized ordering tasks such as partial sorting, partial ranking, unique sorting, unique ranking, inverse unique ranking, and more. These partial sort and ranking routines can greatly accelerate many computations when users need only the M largest or smallest elements out of a N-element vector.

All the specialized procedures have a range over which they far outperform a basic sort, and most have a range where they dramatically underperform. If you are not limited by memory requirements or have no issues with runtimes the simplest solution may be just to use SORT(3f) and RANK(3f).

Otherwise, your solution method may very well depend on the size of the input arrays, whether the data is already close to the required order, or how costly it is to create work arrays or an index array.

So, if you want the smallest value in an array call the intrinsic MINVAL(3f), not ORDERVAL(3f).

Authors:

  • Michel Olagnon date: 2000-2013 wrote the original ORDERPACK 2.0
  • John S. Urban, date: 2022 derived M_ORDERPACK 2.1 from ORDERPACK 2.0

LICENSE:

CC0-1.0

Building the module using makegmake

This will compile the Fortran module and basic example programs that exercise the routines:

     git clone https://github.com/urbanjost/M_orderpack.git


     cd M_orderpack/src
     # change Makefile if not using one of the listed compilers

     # for gfortran
     make clean
     make gfortran

     # for ifort
     make clean
     make ifort

     # for nvfortran
     make clean
     make nvfortran

Note that to specifically get release 2.0.0 you would use

     git clone --branch 2.0.0 https://github.com/urbanjost/M_orderpack.git

Build and test withfpm

Download the github repository and build it with fpm ( as described at Fortran Package Manager )

        git clone https://github.com/urbanjost/M_orderpack.git
        cd M_orderpack
        fpm build

or just list it as a dependency in your fpm.toml project file.

        [dependencies]
        M_orderpack        = { git = "https://github.com/urbanjost/M_orderpack.git" }

Documentation docs

User

  • routines are described in HTML form using the format of man-pages.
  • man-pages There are man-pages in the repository download in the docs/ directory that may be installed on ULS (Unix-Like Systems).

  • fpm plugin fpm-m_orderpack(1). If you build the optional program source in app/fpm-m_orderpack.f90.plugin and place it in your search-path then commands like

     fpm m_orderpack manual|more
 will display the help-text manual for the procedures. For more
 information enter
     fpm m_orderpack --help
  • CHANGELOG provides a history of significant changes

Developer


See also -

general packages containing sorting


References -