Reductions, basic summary statistics, cumulative operations, numerical differences, 1D/2D/N-D Fourier transforms, and accumarray. More...
Files | |
| file | datafun.hpp |
| Data analysis, reductions, search, set operations, and random distributions. | |
Classes | |
| struct | nk::builtin::HistBinSpec |
| Specification for automatic histogram bin estimation. More... | |
| struct | nk::builtin::FindgroupsResult |
| Result of findgroups — [G, ID]. More... | |
| struct | nk::builtin::GroupcountsResult |
| Result of groupcounts — [C, GR, P]. More... | |
| struct | nk::builtin::GroupsummaryResult |
| Result of the array form of groupsummary — [B, BG, BC]. More... | |
Enumerations | |
| enum class | nk::builtin::HistBinMethod { Auto , Scott , Fd , Integers , Sturges , Sqrt } |
| Binning method for histograms. More... | |
| enum class | nk::builtin::HistNorm { Count , Probability , CountDensity , Pdf , CumCount , Cdf } |
| Histogram normalization type. More... | |
| enum class | nk::builtin::AccumReducer { AccumReducer::Sum , AccumReducer::Max , AccumReducer::Min , AccumReducer::Prod , AccumReducer::Mean , AccumReducer::Any , AccumReducer::All } |
| Built-in reducers recognised by accumarray. More... | |
Functions | |
| Value | nk::builtin::sum (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Sum of array elements along first non-singleton dimension (sum(x)). | |
| Value | nk::builtin::sum (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Sum of array elements along specified dimension (sum(x, dim)). | |
| Value | nk::builtin::prod (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Product of array elements along first non-singleton dimension (prod(x)). | |
| Value | nk::builtin::prod (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Product of array elements along specified dimension (prod(x, dim)). | |
| Value | nk::builtin::mean (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Mean (arithmetic average) of array elements (mean(x)). | |
| Value | nk::builtin::mean (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Mean (arithmetic average) of array elements along dimension (mean(x, dim)). | |
| std::tuple< Value, Value > | nk::builtin::max (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Largest elements in array. | |
| std::tuple< Value, Value > | nk::builtin::max (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Largest elements in array along specified dimension ([M, I] = max(x, [], dim)). | |
| Value | nk::builtin::max (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| Element-wise maximum of two arrays (max(a, b)). | |
| std::tuple< Value, Value > | nk::builtin::maxOmitNan (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Largest elements in array along dimension omitting NaN values (max(x, [], dim, 'omitnan')). | |
| Value | nk::builtin::maxOmitNanBinary (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| Element-wise maximum of two arrays omitting NaNs (max(a, b, 'omitnan')). | |
| std::tuple< Value, Value > | nk::builtin::min (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Smallest elements in array. | |
| std::tuple< Value, Value > | nk::builtin::min (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Smallest elements in array along dimension ([M, I] = min(x, [], dim)). | |
| Value | nk::builtin::min (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| Element-wise minimum of two arrays (min(a, b)). | |
| std::tuple< Value, Value > | nk::builtin::minOmitNan (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Smallest elements in array along dimension omitting NaNs (min(x, [], dim, 'omitnan')). | |
| Value | nk::builtin::minOmitNanBinary (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| Element-wise minimum of two arrays omitting NaNs (min(a, b, 'omitnan')). | |
| Value | nk::builtin::cumsum (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Cumulative sum of array elements (cumsum(x)). | |
| Value | nk::builtin::cumsum (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative sum of array elements along specified dimension (cumsum(x, dim)). | |
| Value | nk::builtin::cumprod (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Cumulative product of array elements (cumprod(x)). | |
| Value | nk::builtin::cumprod (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative product of array elements along specified dimension (cumprod(x, dim)). | |
| Value | nk::builtin::cummax (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Cumulative maximum of array elements (cummax(x)). | |
| Value | nk::builtin::cummax (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative maximum of array elements along dimension (cummax(x, dim)). | |
| Value | nk::builtin::cummin (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Cumulative minimum of array elements (cummin(x)). | |
| Value | nk::builtin::cummin (const Value &x, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative minimum of array elements along dimension (cummin(x, dim)). | |
| Value | nk::builtin::diff (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Differences between adjacent elements (diff(x)). | |
| Value | nk::builtin::diff (const Value &x, int n, int dim=0, std::pmr::memory_resource *mr=nullptr) |
| Nth-order differences between elements along dimension (diff(x, n, dim)). | |
| Value | nk::builtin::anyOf (const Value &x, int dim=0, std::pmr::memory_resource *mr=nullptr) |
| True if any element along dimension is nonzero (any(x, dim)). | |
| Value | nk::builtin::allOf (const Value &x, int dim=0, std::pmr::memory_resource *mr=nullptr) |
| True if all elements along dimension are nonzero (all(x, dim)). | |
| Value | nk::builtin::unique (const Value &x, std::pmr::memory_resource *mr=nullptr, bool stable=false) |
| Unique values in array (unique(x)). | |
| Value | nk::builtin::uniqueRows (const Value &x, std::pmr::memory_resource *mr=nullptr, bool stable=false) |
| Unique rows of 2-D matrix (unique(x, 'rows')). | |
| std::tuple< Value, Value, Value > | nk::builtin::uniqueWithIndices (const Value &x, std::pmr::memory_resource *mr=nullptr, bool stable=false, bool last=false) |
| Unique values with index mappings ([C, ia, ic] = unique(x)). | |
| std::tuple< Value, Value, Value > | nk::builtin::uniqueRowsWithIndices (const Value &x, std::pmr::memory_resource *mr=nullptr, bool stable=false, bool last=false) |
| Unique rows with index mappings ([C, ia, ic] = unique(x, 'rows')). | |
| Value | nk::builtin::ismember (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| Tests if array elements are members of set (ismember(a, b)). | |
| std::pair< Value, Value > | nk::builtin::ismemberComplex (const Value &a, const Value &b, bool wantLoc, std::pmr::memory_resource *mr) |
| Tests membership for complex/general types with location indices ([lia, loc] = ismember(...)). | |
| Value | nk::builtin::setUnion (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr, bool stable=false) |
| Set union of two arrays (union(a, b)). | |
| Value | nk::builtin::setIntersect (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr, bool stable=false) |
| Set intersection of two arrays (intersect(a, b)). | |
| Value | nk::builtin::setDiff (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr, bool stable=false) |
| Set difference (setdiff(a, b)). | |
| Value | nk::builtin::setxor (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| Set exclusive OR (setxor(a, b)). | |
| Value | nk::builtin::discretize (const Value &x, const Value &edges, std::pmr::memory_resource *mr=nullptr) |
| Groups numeric data into bins (discretize(x, edges)). | |
| Value | nk::builtin::histc (const Value &x, const Value &edges, std::pmr::memory_resource *mr=nullptr) |
| Histogram count of data into bins (histc(x, edges)). | |
| Value | nk::builtin::histcounts (const Value &x, const Value &edges, std::pmr::memory_resource *mr=nullptr) |
| Computes histogram bin counts (histcounts(x, edges)). | |
| Value | nk::builtin::histcounts (const Value &x, const Value &edges, HistNorm norm, std::pmr::memory_resource *mr=nullptr) |
| Computes normalized histogram bin values (histcounts(x, edges, norm)). | |
| Value | nk::builtin::histcountsAutoEdges (const Value &x, const HistBinSpec &spec, std::pmr::memory_resource *mr=nullptr) |
| Computes histogram with automatic bin edges selection (histcounts(x, spec)). | |
| Value | nk::builtin::allunique (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| True if all elements in array are unique (allunique(x)). | |
| Value | nk::builtin::numunique (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Number of unique elements in array (numunique(x)). | |
| Value | nk::builtin::ismembertol (const Value &a, const Value &s, double tol=1e-6, std::pmr::memory_resource *mr=nullptr) |
| Membership test within numerical tolerance (ismembertol(a, s, tol)). | |
| Value | nk::builtin::uniquetol (const Value &x, double tol=1e-6, std::pmr::memory_resource *mr=nullptr) |
| Unique elements within numerical tolerance (uniquetol(x, tol)). | |
| FindgroupsResult | nk::builtin::findgroups (const Value &g, std::pmr::memory_resource *mr=nullptr) |
| Assign 1-based group IDs ([G, ID] = findgroups(g)). | |
| GroupcountsResult | nk::builtin::groupcounts (const Value &g, std::pmr::memory_resource *mr=nullptr) |
| Count elements per group ([C, GR, P] = groupcounts(g)). | |
| GroupsummaryResult | nk::builtin::groupsummary (const Value &A, const Value &G, const std::string &method, std::pmr::memory_resource *mr=nullptr) |
| Per-group reduction ([B, BG, BC] = groupsummary(A, G, method)). | |
| Value | nk::builtin::grouptransform (const Value &A, const Value &G, const std::string &method, std::pmr::memory_resource *mr=nullptr) |
| Group transformation (grouptransform(A, G, method)). | |
| Value | nk::builtin::accumarray (const Value &subs, const Value &vals, Span< const size_t > outShape, AccumReducer op=AccumReducer::Sum, double fillVal=0.0, std::pmr::memory_resource *mr=nullptr) |
| Group-by reduction (A = accumarray(subs, vals, sz, fn, fillVal)). | |
Reductions, basic summary statistics, cumulative operations, numerical differences, 1D/2D/N-D Fourier transforms, and accumarray.
|
strong |
Built-in reducers recognised by accumarray.
| Enumerator | |
|---|---|
| Sum | @sum (additive identity 0). |
| Max | @max. |
| Min | @min. |
| Prod | @prod (multiplicative identity 1). |
| Mean | @mean. |
| Any | @any (logical OR). |
| All | @all (logical AND). |
Definition at line 499 of file datafun.hpp.
|
strong |
Binning method for histograms.
Definition at line 240 of file datafun.hpp.
|
strong |
Histogram normalization type.
Definition at line 250 of file datafun.hpp.
| Value nk::builtin::accumarray | ( | const Value & | subs, |
| const Value & | vals, | ||
| Span< const size_t > | outShape, | ||
| AccumReducer | op = AccumReducer::Sum, | ||
| double | fillVal = 0.0, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Group-by reduction (A = accumarray(subs, vals, sz, fn, fillVal)).
Each row of subs is a 1-based multi-dim index into the output A. vals(i) is contributed to A(subs(i, :)) via the reducer op. Output shape is outShape; pass empty span to auto-derive from max(subs) per column. Cells with no contributions get fillVal.
| subs | N x D matrix of 1-based subscripts. |
| vals | Length-N vector of contributions, or a scalar (broadcast). |
| outShape | Output shape; empty span -> derive from max(subs). |
| op | Built-in reducer (see AccumReducer). |
| fillVal | Default value for untouched cells (default 0). |
| mr | Memory resource (nullptr -> process default). |
True if all elements along dimension are nonzero (all(x, dim)).
| x | Input array. |
| dim | Operating dimension (0 for first non-singleton). |
| mr | Memory resource. |
True if all elements in array are unique (allunique(x)).
| x | Input array. |
| mr | Memory resource. |
True if any element along dimension is nonzero (any(x, dim)).
| x | Input array. |
| dim | Operating dimension (0 for first non-singleton). |
| mr | Memory resource. |
Cumulative maximum of array elements along dimension (cummax(x, dim)).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
Cumulative minimum of array elements along dimension (cummin(x, dim)).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
Cumulative product of array elements along specified dimension (cumprod(x, dim)).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
Cumulative sum of array elements along specified dimension (cumsum(x, dim)).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
| Value nk::builtin::diff | ( | const Value & | x, |
| int | n, | ||
| int | dim = 0, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Nth-order differences between elements along dimension (diff(x, n, dim)).
| x | Input array. |
| n | Difference order (default 1). |
| dim | Operating dimension (default 0 for first non-singleton). |
| mr | Memory resource. |
Differences between adjacent elements (diff(x)).
| x | Input array. |
| mr | Memory resource. |
| Value nk::builtin::discretize | ( | const Value & | x, |
| const Value & | edges, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Groups numeric data into bins (discretize(x, edges)).
| x | Data array. |
| edges | Bin edges vector. |
| mr | Memory resource. |
| FindgroupsResult nk::builtin::findgroups | ( | const Value & | g, |
| std::pmr::memory_resource * | mr = nullptr ) |
Assign 1-based group IDs ([G, ID] = findgroups(g)).
G[i] is the group ID of g[i], based on the sorted-unique order of the finite values of g; ID is the column of those unique values. NaN entries are treated as missing (G[i] = NaN, excluded from ID), matching MATLAB R2025b. G takes the shape of g.
| g | Grouping variable (numeric / logical / char). |
| mr | Memory resource. |
| GroupcountsResult nk::builtin::groupcounts | ( | const Value & | g, |
| std::pmr::memory_resource * | mr = nullptr ) |
Count elements per group ([C, GR, P] = groupcounts(g)).
C is the per-group element count over the sorted-unique values of g; GR the matching representatives; P the percentages. NaN entries form a single trailing bucket (matching MATLAB R2025b).
| g | Grouping variable. |
| mr | Memory resource. |
| GroupsummaryResult nk::builtin::groupsummary | ( | const Value & | A, |
| const Value & | G, | ||
| const std::string & | method, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Per-group reduction ([B, BG, BC] = groupsummary(A, G, method)).
Groups the rows of A (length-size(A,1) grouping vector G) and applies method per group, per column. Supported method strings: "sum", "mean", "median", "max", "min", "std", "var", "numunique", "nnz", "mode", "all", "any". NaN group values form a single trailing bucket.
| A | Column vector or matrix (DOUBLE). |
| G | Grouping vector, length size(A,1). |
| method | Reduction method string. |
| mr | Memory resource. |
| Value nk::builtin::grouptransform | ( | const Value & | A, |
| const Value & | G, | ||
| const std::string & | method, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Group transformation (grouptransform(A, G, method)).
Supported string methods: "meancenter", "zscore", "norm", "rescale", "meanfill", "linearfill".
| A | Column vector or matrix (DOUBLE). |
| G | Grouping vector, length size(A,1). |
| method | Transformation method string. |
| mr | Memory resource. |
A. | Value nk::builtin::histc | ( | const Value & | x, |
| const Value & | edges, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Histogram count of data into bins (histc(x, edges)).
| x | Data array. |
| edges | Bin edges vector. |
| mr | Memory resource. |
| Value nk::builtin::histcounts | ( | const Value & | x, |
| const Value & | edges, | ||
| HistNorm | norm, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Computes normalized histogram bin values (histcounts(x, edges, norm)).
| x | Data array. |
| edges | Bin edges vector. |
| norm | Normalization scheme (Count, Probability, Pdf, etc.). |
| mr | Memory resource. |
| Value nk::builtin::histcounts | ( | const Value & | x, |
| const Value & | edges, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Computes histogram bin counts (histcounts(x, edges)).
| x | Data array. |
| edges | Bin edges vector. |
| mr | Memory resource. |
| Value nk::builtin::histcountsAutoEdges | ( | const Value & | x, |
| const HistBinSpec & | spec, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Computes histogram with automatic bin edges selection (histcounts(x, spec)).
| x | Data array. |
| spec | Bin specification struct. |
| mr | Memory resource. |
| Value nk::builtin::ismember | ( | const Value & | a, |
| const Value & | b, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Tests if array elements are members of set (ismember(a, b)).
| a | Query array. |
| b | Set array. |
| mr | Memory resource. |
| std::pair< Value, Value > nk::builtin::ismemberComplex | ( | const Value & | a, |
| const Value & | b, | ||
| bool | wantLoc, | ||
| std::pmr::memory_resource * | mr ) |
Tests membership for complex/general types with location indices ([lia, loc] = ismember(...)).
| a | Query array. |
| b | Set array. |
| wantLoc | True to return matched index locations. |
| mr | Memory resource. |
| Value nk::builtin::ismembertol | ( | const Value & | a, |
| const Value & | s, | ||
| double | tol = 1e-6, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Membership test within numerical tolerance (ismembertol(a, s, tol)).
| a | Query array. |
| s | Set array. |
| tol | Relative/absolute tolerance. |
| mr | Memory resource. |
| Value nk::builtin::max | ( | const Value & | a, |
| const Value & | b, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Element-wise maximum of two arrays (max(a, b)).
| a | First array. |
| b | Second array. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::max | ( | const Value & | x, |
| int | dim, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Largest elements in array along specified dimension ([M, I] = max(x, [], dim)).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::max | ( | const Value & | x, |
| std::pmr::memory_resource * | mr = nullptr ) |
Largest elements in array.
Returns tuple (values, indices) ([M, I] = max(x)).
| x | Input array. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::maxOmitNan | ( | const Value & | x, |
| int | dim, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Largest elements in array along dimension omitting NaN values (max(x, [], dim, 'omitnan')).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
| Value nk::builtin::maxOmitNanBinary | ( | const Value & | a, |
| const Value & | b, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Element-wise maximum of two arrays omitting NaNs (max(a, b, 'omitnan')).
| a | First array. |
| b | Second array. |
| mr | Memory resource. |
Mean (arithmetic average) of array elements along dimension (mean(x, dim)).
| x | Input array. |
| dim | Operating dimension (1-based, 0 = first non-singleton). |
| mr | Memory resource. |
Mean (arithmetic average) of array elements (mean(x)).
| x | Input array. |
| mr | Memory resource. |
| Value nk::builtin::min | ( | const Value & | a, |
| const Value & | b, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Element-wise minimum of two arrays (min(a, b)).
| a | First array. |
| b | Second array. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::min | ( | const Value & | x, |
| int | dim, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Smallest elements in array along dimension ([M, I] = min(x, [], dim)).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::min | ( | const Value & | x, |
| std::pmr::memory_resource * | mr = nullptr ) |
Smallest elements in array.
Returns tuple (values, indices) ([M, I] = min(x)).
| x | Input array. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::minOmitNan | ( | const Value & | x, |
| int | dim, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Smallest elements in array along dimension omitting NaNs (min(x, [], dim, 'omitnan')).
| x | Input array. |
| dim | Operating dimension. |
| mr | Memory resource. |
| Value nk::builtin::minOmitNanBinary | ( | const Value & | a, |
| const Value & | b, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Element-wise minimum of two arrays omitting NaNs (min(a, b, 'omitnan')).
| a | First array. |
| b | Second array. |
| mr | Memory resource. |
Number of unique elements in array (numunique(x)).
| x | Input array. |
| mr | Memory resource. |
| Value nk::builtin::setUnion | ( | const Value & | a, |
| const Value & | b, | ||
| std::pmr::memory_resource * | mr = nullptr, | ||
| bool | stable = false ) |
Set union of two arrays (union(a, b)).
| a | First set array. |
| b | Second set array. |
| mr | Memory resource. |
| stable | True to keep occurrence order. |
| Value nk::builtin::setxor | ( | const Value & | a, |
| const Value & | b, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Set exclusive OR (setxor(a, b)).
| a | First set array. |
| b | Second set array. |
| mr | Memory resource. |
| Value nk::builtin::uniqueRows | ( | const Value & | x, |
| std::pmr::memory_resource * | mr = nullptr, | ||
| bool | stable = false ) |
Unique rows of 2-D matrix (unique(x, 'rows')).
| x | 2-D matrix. |
| mr | Memory resource. |
| stable | True to preserve order. |
| std::tuple< Value, Value, Value > nk::builtin::uniqueRowsWithIndices | ( | const Value & | x, |
| std::pmr::memory_resource * | mr = nullptr, | ||
| bool | stable = false, | ||
| bool | last = false ) |
Unique rows with index mappings ([C, ia, ic] = unique(x, 'rows')).
| x | 2-D matrix. |
| mr | Memory resource. |
| stable | True for occurrence ordering. |
| last | True to return last occurrence index. |
| Value nk::builtin::uniquetol | ( | const Value & | x, |
| double | tol = 1e-6, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Unique elements within numerical tolerance (uniquetol(x, tol)).
| x | Input array. |
| tol | Relative/absolute tolerance. |
| mr | Memory resource. |
| std::tuple< Value, Value, Value > nk::builtin::uniqueWithIndices | ( | const Value & | x, |
| std::pmr::memory_resource * | mr = nullptr, | ||
| bool | stable = false, | ||
| bool | last = false ) |
Unique values with index mappings ([C, ia, ic] = unique(x)).
| x | Input array. |
| mr | Memory resource. |
| stable | True for occurrence ordering. |
| last | True to return last occurrence index instead of first. |