gsl-ocaml / lib / gsl_sort.ml

external vector : Vector.vector -> unit = "ml_gsl_sort_vector"
external _vector_index : Permut.permut -> Vector.vector -> unit = "ml_gsl_sort_vector_index"
let vector_index v =
  let p = Permut.create (Vector.length v) in
  _vector_index p v ;
  p

external _vector_smallest : float array -> Vector.vector -> unit = "ml_gsl_sort_vector_smallest"
external _vector_largest : float array -> Vector.vector -> unit = "ml_gsl_sort_vector_largest"

let vector_smallest k v =
  let dest = Array.make k 0. in
  _vector_smallest dest v ;
  dest

let vector_largest k v =
  let dest = Array.make k 0. in
  _vector_largest dest v ;
  dest

external _vector_smallest_index : Permut.permut -> Vector.vector -> unit = "ml_gsl_sort_vector_smallest_index"
external _vector_largest_index : Permut.permut -> Vector.vector -> unit = "ml_gsl_sort_vector_largest_index"

let vector_smallest_index k v =
  let p = Permut.create k in
  _vector_smallest_index p v ;
  p

let vector_largest_index k v =
  let p = Permut.create k in
  _vector_largest_index p v ;
  p



external vector_flat : Vector_flat.vector -> unit = "ml_gsl_sort_vector"
external _vector_flat_index : Permut.permut -> Vector_flat.vector -> unit = "ml_gsl_sort_vector_index"
let vector_flat_index v =
  let p = Permut.create (Vector_flat.length v) in
  _vector_flat_index p v ;
  p

external _vector_flat_smallest : float array -> Vector_flat.vector -> unit = "ml_gsl_sort_vector_smallest"
external _vector_flat_largest : float array -> Vector_flat.vector -> unit = "ml_gsl_sort_vector_largest"

let vector_flat_smallest k v =
  let dest = Array.make k 0. in
  _vector_flat_smallest dest v ;
  dest

let vector_flat_largest k v =
  let dest = Array.make k 0. in
  _vector_flat_largest dest v ;
  dest

external _vector_flat_smallest_index : Permut.permut -> Vector_flat.vector -> unit = "ml_gsl_sort_vector_smallest_index"
external _vector_flat_largest_index : Permut.permut -> Vector_flat.vector -> unit = "ml_gsl_sort_vector_largest_index"

let vector_flat_smallest_index k v =
  let p = Permut.create k in
  _vector_flat_smallest_index p v ;
  p

let vector_flat_largest_index k v =
  let p = Permut.create k in
  _vector_flat_largest_index p v ;
  p
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.