Numeric type casting, struct arrays, cell arrays, map/dictionary containers, and type introspection (isa, isnumeric).
More...
|
| Value | nk::builtin::isfield (const Value &s, const std::string &field, std::pmr::memory_resource *mr=nullptr) |
| | Tests if structure contains field by string name (isfield(s, field)).
|
| Value | nk::builtin::getfield (const Value &s, const std::string &field, std::pmr::memory_resource *mr=nullptr) |
| | Gets value of structure field by string name (getfield(s, field)).
|
| Value | nk::builtin::setfield (const Value &s, const std::string &field, const Value &val, std::pmr::memory_resource *mr=nullptr) |
| | Sets value of structure field by string name (setfield(s, field, val)).
|
| Value | nk::builtin::rmfield (const Value &s, const std::string &field, std::pmr::memory_resource *mr=nullptr) |
| | Removes field from structure by string name (rmfield(s, field)).
|
| Value | nk::builtin::toDouble (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to double-precision floating point (double(x)).
|
| Value | nk::builtin::single (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to single-precision floating point (single(x)).
|
| Value | nk::builtin::int8 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 8-bit signed integer (int8(x)).
|
| Value | nk::builtin::int16 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 16-bit signed integer (int16(x)).
|
| Value | nk::builtin::int32 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 32-bit signed integer (int32(x)).
|
| Value | nk::builtin::int64 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 64-bit signed integer (int64(x)).
|
| Value | nk::builtin::uint8 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 8-bit unsigned integer (uint8(x)).
|
| Value | nk::builtin::uint16 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 16-bit unsigned integer (uint16(x)).
|
| Value | nk::builtin::uint32 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 32-bit unsigned integer (uint32(x)).
|
| Value | nk::builtin::uint64 (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to 64-bit unsigned integer (uint64(x)).
|
| Value | nk::builtin::logical (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Converts input array to logical boolean array (logical(x)).
|
| Value | nk::builtin::iscell (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a cell array (iscell(v)).
|
| Value | nk::builtin::isstruct (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a structure (isstruct(v)).
|
| Value | nk::builtin::isnumeric (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is numeric (double, single, integer) (isnumeric(v)).
|
| Value | nk::builtin::isfloat (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a floating-point type (single or double) (isfloat(v)).
|
| Value | nk::builtin::isinteger (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is an integer class (isinteger(v)).
|
| Value | nk::builtin::islogical (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is logical type (islogical(v)).
|
| Value | nk::builtin::ischar (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is character array (ischar(v)).
|
| Value | nk::builtin::isstring (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is string array (isstring(v)).
|
| Value | nk::builtin::isnan (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests array elements for NaN (isnan(v)).
|
| Value | nk::builtin::isinf (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests array elements for Infinity (isinf(v)).
|
| Value | nk::builtin::isfinite (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests array elements for finiteness (isfinite(v)).
|
| Value | nk::builtin::isempty (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if array is empty (any dimension is 0) (isempty(v)).
|
| Value | nk::builtin::isscalar (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a 1x1 scalar (isscalar(v)).
|
| Value | nk::builtin::isvector (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a 1-D vector (1xN or Nx1) (isvector(v)).
|
| Value | nk::builtin::isrow (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a 1xN row vector (isrow(v)).
|
| Value | nk::builtin::iscolumn (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is an Nx1 column vector (iscolumn(v)).
|
| Value | nk::builtin::ismatrix (const Value &v, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a 2-D matrix (ismatrix(v)).
|
| Value | nk::builtin::issingle (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is single-precision floating point (issingle(x)).
|
| Value | nk::builtin::issparse (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Tests if input is a sparse array (issparse(x)).
|
| Value | nk::builtin::ismissing (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Finds missing entries in array using default standard missing indicators (ismissing(x)).
|
| Value | nk::builtin::ismissing (const Value &x, const Value &indicator, std::pmr::memory_resource *mr=nullptr) |
| | Finds missing entries in array matching user-specified indicators (ismissing(x, indicator)).
|
| Value | nk::builtin::issorted (const Value &x, const Value &mode=Value::Empty, std::pmr::memory_resource *mr=nullptr) |
| | Determines if array elements are sorted in ascending or descending order (issorted(x, mode)).
|
| Value | nk::builtin::isequal (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| | Determines if arrays are strictly identical in type, shape, and values (isequal(a, b)).
|
| Value | nk::builtin::isequaln (const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr) |
| | Determines if arrays are equal, treating NaNs as equal (isequaln(a, b)).
|
| Value | nk::builtin::cast (const Value &v, const std::string &targetType, std::pmr::memory_resource *mr=nullptr) |
| | Casts input array to target type name (cast(v, targetType)).
|
| Value | nk::builtin::standardizeMissing (const Value &x, const Value &indicator, std::pmr::memory_resource *mr=nullptr) |
| | Replaces specified indicator values with standard missing values (standardizeMissing(x, indicator)).
|
| Value | nk::builtin::anymissing (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Tests if array contains any missing entries (anymissing(x)).
|
| Value | nk::builtin::isuniform (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Tests if array has uniform element spacing (isuniform(x)).
|
| Value | nk::builtin::classOf (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Returns the class name of an object or array (class(x)).
|
| Value | nk::builtin::swapbytes (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Swaps byte order of array elements between little-endian and big-endian (swapbytes(x)).
|
| Value | nk::builtin::typecast (const Value &x, const std::string &datatype, std::pmr::memory_resource *mr=nullptr) |
| | Reinterprets binary data between datatypes without changing underlying bytes (typecast(x, datatype)).
|
| Value | nk::builtin::allfinite (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | True if all elements are finite numbers (allfinite(x)).
|
| Value | nk::builtin::anynan (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | True if any array element is NaN (anynan(x)).
|
| Value | nk::builtin::realmin (const std::string &className="double", std::pmr::memory_resource *mr=nullptr) |
| | Smallest positive normalized floating-point number (realmin(className)).
|
| Value | nk::builtin::realmin (const Value &t, std::pmr::memory_resource *mr=nullptr) |
| | Smallest positive normalized floating-point number (realmin(t)).
|
| Value | nk::builtin::realmax (const std::string &className="double", std::pmr::memory_resource *mr=nullptr) |
| | Largest finite floating-point number (realmax(className)).
|
| Value | nk::builtin::realmax (const Value &t, std::pmr::memory_resource *mr=nullptr) |
| | Largest finite floating-point number (realmax(t)).
|
| Value | nk::builtin::intmin (const std::string &className="int32", std::pmr::memory_resource *mr=nullptr) |
| | Smallest integer value for specified integer class (intmin(className)).
|
| Value | nk::builtin::intmin (const Value &t, std::pmr::memory_resource *mr=nullptr) |
| | Smallest integer value for specified integer class value (intmin(t)).
|
| Value | nk::builtin::intmax (const std::string &className="int32", std::pmr::memory_resource *mr=nullptr) |
| | Largest integer value for specified integer class (intmax(className)).
|
| Value | nk::builtin::intmax (const Value &t, std::pmr::memory_resource *mr=nullptr) |
| | Largest integer value for specified integer class value (intmax(t)).
|
| Value | nk::builtin::flintmax (const std::string &className="double", std::pmr::memory_resource *mr=nullptr) |
| | Largest consecutive integer accurately representable in floating-point format (flintmax(className)).
|
| Value | nk::builtin::flintmax (const Value &t, std::pmr::memory_resource *mr=nullptr) |
| | Largest consecutive integer accurately representable in floating-point format (flintmax(t)).
|
|
void | nk::runtime::registerCellsRuntime (Engine &engine) |
|
void | nk::runtime::registerCellfunCallbackBuiltin (Engine &engine) |
| Value | nk::runtime::cell (size_t n, std::pmr::memory_resource *mr=nullptr) |
| | Square cell array (c = cell(n)).
|
| Value | nk::runtime::cell (size_t rows, size_t cols, std::pmr::memory_resource *mr=nullptr) |
| | Rectangular cell array (c = cell(rows, cols)).
|
| Value | nk::runtime::cell (size_t rows, size_t cols, size_t pages, std::pmr::memory_resource *mr=nullptr) |
| | 3-D cell array (c = cell(rows, cols, pages)).
|
| Value | nk::runtime::cellfun (FnHandle fn, const Value &c, bool uniformOutput, std::pmr::memory_resource *mr=nullptr) |
| | Apply a callback to each cell (y = cellfun(fn, c, uniformOutput)).
|
| Value | nk::runtime::num2cell (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Wrap each element in a scalar cell (c = num2cell(A)).
|
| Value | nk::runtime::cell2mat (const Value &c, std::pmr::memory_resource *mr=nullptr) |
| | Concatenate cells into a matrix (A = cell2mat(c)).
|
| Value | nk::runtime::iscellstr (const Value &c, std::pmr::memory_resource *mr=nullptr) |
| | Test whether a cell array holds only char rows (tf = iscellstr(c)).
|
| Value | nk::runtime::cellstr (const Value &x, std::pmr::memory_resource *mr=nullptr) |
| | Convert to cell-of-strings (c = cellstr(x)).
|
| Value | nk::runtime::mat2cell (const Value &x, const Value &rowSizes, const Value &colSizes=Value::Empty, std::pmr::memory_resource *mr=nullptr) |
| | Split a matrix into a cell array of blocks (c = mat2cell(A, R, C)).
|
| void | nk::runtime::registerContainersRuntime (Engine &engine) |
| | Registers containers.Map and dictionary builtins in the engine.
|
| Value | nk::runtime::containers::map (std::pmr::memory_resource *mr=nullptr) |
| | Creates an empty containers.Map (handle semantics: copies alias shared state).
|
| Value | nk::runtime::containers::dictionary (std::pmr::memory_resource *mr=nullptr) |
| | Creates an empty dictionary (value semantics: copies are independent).
|
| void | nk::runtime::containers::set (Value &m, const Value &key, const Value &val) |
| | Inserts or updates key-value pair in container in place.
|
| Value | nk::runtime::containers::get (const Value &m, const Value &key) |
| | Looks up value associated with specified key (throws if key absent).
|
| bool | nk::runtime::containers::isKey (const Value &m, const Value &key) |
| | Checks whether specified key exists in container.
|
| void | nk::runtime::containers::remove (Value &m, const Value &key) |
| | Removes specified key and its associated value from container.
|
| std::size_t | nk::runtime::containers::count (const Value &m) |
| | Returns the number of key-value pairs in container.
|
| Value | nk::runtime::containers::keys (const Value &m, std::pmr::memory_resource *mr=nullptr) |
| | Extracts all keys from container as a column array.
|
| Value | nk::runtime::containers::values (const Value &m, std::pmr::memory_resource *mr=nullptr) |
| | Extracts all values from container as an array or cell array.
|
|
void | nk::runtime::registerStructuresRuntime (Engine &engine) |
|
void | nk::runtime::registerStructfunCallbackBuiltin (Engine &engine) |
| Value | nk::runtime::structure (std::pmr::memory_resource *mr=nullptr) |
| | Empty struct scalar (s = struct()).
|
| Value | nk::runtime::structure (Span< const Value > nameValuePairs, std::pmr::memory_resource *mr=nullptr) |
| | Struct from {name, value, …} pairs (s = struct(name1, val1, name2, val2, …)).
|
| Value | nk::runtime::fieldnames (const Value &s, std::pmr::memory_resource *mr=nullptr) |
| | Field names of a struct (fn = fieldnames(s)).
|
| Value | nk::runtime::isfield (const Value &s, const Value &name, std::pmr::memory_resource *mr=nullptr) |
| | Test for field existence (tf = isfield(s, name)).
|
| Value | nk::runtime::rmfield (const Value &s, const Value &name, std::pmr::memory_resource *mr=nullptr) |
| | Remove a field from a struct (s2 = rmfield(s, name)).
|
| Value | nk::runtime::structfun (FnHandle fn, const Value &s, bool uniformOutput, std::pmr::memory_resource *mr=nullptr) |
| | Apply a function handle to every field of a struct (y = structfun(fn, s, uniformOutput)).
|
| Value | nk::runtime::getfield (const Value &s, const Value &name, std::pmr::memory_resource *mr=nullptr) |
| | Gets the value of specified field in structure (v = getfield(s, 'field')).
|
| Value | nk::runtime::setfield (const Value &s, const Value &name, const Value &value, std::pmr::memory_resource *mr=nullptr) |
| | Sets the value of specified field in structure (s = setfield(s, 'field', val)).
|
| Value | nk::runtime::orderfields (const Value &s, std::pmr::memory_resource *mr=nullptr) |
| | Orders fields of structure array alphabetically (s = orderfields(s)).
|
| Value | nk::runtime::struct2cell (const Value &s, std::pmr::memory_resource *mr=nullptr) |
| | Converts structure array to cell array of field values (c = struct2cell(s)).
|