Data analysis, reductions, search, set operations, and random distributions. More...
#include <memory_resource>#include <string>#include <tuple>#include <nk/value/value.hpp>#include <nk/ops/rng.hpp>Go to the source code of this file.
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... | |
| class | nk::builtin::RngContext |
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)). | |
| Value | nk::builtin::rand (RngContext &rng, size_t rows, size_t cols=1, size_t pages=0, std::pmr::memory_resource *mr=nullptr) |
| Value | nk::builtin::randn (RngContext &rng, size_t rows, size_t cols=1, size_t pages=0, std::pmr::memory_resource *mr=nullptr) |
| Value | nk::builtin::randND (RngContext &rng, Span< const size_t > dims, std::pmr::memory_resource *mr=nullptr) |
| Value | nk::builtin::randnND (RngContext &rng, Span< const size_t > dims, std::pmr::memory_resource *mr=nullptr) |
| Value | nk::builtin::randi (RngContext &rng, int64_t imax, std::pmr::memory_resource *mr=nullptr) |
| Value | nk::builtin::randperm (RngContext &rng, size_t n, std::pmr::memory_resource *mr=nullptr) |
Data analysis, reductions, search, set operations, and random distributions.
Provides a clean, engine-free C++ API for reduction operators (sum, mean, min, max, prod), pseudo-random number distributions, and set operations.
Definition in file datafun.hpp.