Skip to main content

Sort

Sort is a function for sorting a vector, which also takes the name of sorting algorithm as an input.

Calling example

ans = Sort(avec, name)

Interface

  MODULE PURE FUNCTION Sort(x, name) RESULT(ans)
INTEGER(Int8|Int16|Int32|Int64) | REAL(Real32|Real64), INTENT(IN) :: x(:)
CHARACTER(*), OPTIONAL, INTENT(IN) :: name
INTEGER(Int32) :: ans(SIZE(x))
END FUNCTION Sort
  • x is a vector of reals or integers.
  • Real32, Real64 are supported.
  • Int8, Int16, Int32, Int64 are supported.
  • name is name of sorting algorithm. Following algorithms are supported:
    • HEAPSORT
    • QUICKSORT
    • INTROSORT, default
    • INSERTIONSORT, default