MATLAB / Octave API reference
Every public function of the +kwker package for MATLAB and GNU Octave (a MEX file over the C library), with its parameters and results (Kwker 0.1.0).
Import path: kwker.<name> (the +kwker folder on the path)
kwker.sort Page
function [B, I] = kwker.sort(A, varargin)
Sort array elements with Kwker (the semantics of MATLAB's sort).
B = kwker.sort(A)sorts A along its first non-singleton dimension in ascending order.B = kwker.sort(A, DIM)sorts along dimension DIM.B = kwker.sort(..., 'descend')sorts in descending order ('ascend': ascending, the default).B = kwker.sort(..., 'MissingPlacement', P)puts NaNs 'first', 'last', or - 'auto', the default - last when ascending and first when descending.B = kwker.sort(..., 'Threads', T)sorts on T threads (large vectors, or many columns).[B, I] = kwker.sort(...)also returns the indices along DIM (B = A(I) for a vector); equal elements keep their input order (a stable sort).
Real, full numeric arrays (double, single, int8 ... uint64) run through Kwker; anything else (logical, char, complex, sparse, ...) goes to the built-in sort. As in the built-in, -0 and +0 are equal and every NaN equals every other NaN (whatever its bit pattern): such elements keep their input order, and B holds A's own values.
See also KWKER.MAXK, KWKER.MINK, KWKER.KTH.
kwker.kth Page
function [B, I] = kwker.kth(A, k, varargin)
The k-th element in sorted order along a dimension, with Kwker (a selection: no full sort).
B = kwker.kth(A, k)returns the k-th smallest element (1-based) along the first non-singleton dimension of A - what S(k, :) of S = sort(A) holds for a matrix, at the cost of a selection.B = kwker.kth(A, k, DIM)works along dimension DIM; kwker.kth(..., 'descend') returns the k-th largest; 'MissingPlacement' as for KWKER.SORT (NaNs last ascending and first descending by default).[B, I] = kwker.kth(...)also returns its index along DIM (equal elements: the stable sort's k-th).
See also KWKER.SORT.
kwker.maxk Page
function [B, I] = kwker.maxk(A, k, varargin)
The k largest elements with Kwker (a selection: no full sort).
B = kwker.maxk(A, k)returns the k largest elements along the first non-singleton dimension of A, largest first - all of them, sorted, when k exceeds the dimension's size.B = kwker.maxk(A, k, DIM)works along dimension DIM; kwker.maxk(..., 'Threads', T) on T threads.[B, I] = kwker.maxk(...)also returns their indices along DIM (equal elements: the first in input order). NaNs come after every number: they are returned only when fewer than k numbers exist.
See also KWKER.MINK, KWKER.SORT.
kwker.mink Page
function [B, I] = kwker.mink(A, k, varargin)
The k smallest elements with Kwker (a selection: no full sort).
B = kwker.mink(A, k)returns the k smallest elements along the first non-singleton dimension of A, smallest first - all of them, sorted, when k exceeds the dimension's size.B = kwker.mink(A, k, DIM)works along dimension DIM; kwker.mink(..., 'Threads', T) on T threads.[B, I] = kwker.mink(...)also returns their indices along DIM (equal elements: the first in input order). NaNs come after every number: they are returned only when fewer than k numbers exist.
See also KWKER.MAXK, KWKER.SORT.
kwker.version Page
function s = kwker.version()
The Kwker library version and the engine it runs on this machine.