6#include <memory_resource>
9#include <nk/value/value.hpp>
10#include <nk/value/span.hpp>
12namespace nk::builtin {
33Value isfield(
const Value &s,
const std::string &field, std::pmr::memory_resource *mr =
nullptr);
41Value getfield(
const Value &s,
const std::string &field, std::pmr::memory_resource *mr =
nullptr);
57Value rmfield(
const Value &s,
const std::string &field, std::pmr::memory_resource *mr =
nullptr);
299Value cast(
const Value &v,
const std::string &targetType, std::pmr::memory_resource *mr =
nullptr);
356Value realmin(
const std::string &className =
"double", std::pmr::memory_resource *mr =
nullptr);
369Value realmax(
const std::string &className =
"double", std::pmr::memory_resource *mr =
nullptr);
382Value intmin(
const std::string &className =
"int32", std::pmr::memory_resource *mr =
nullptr);
395Value intmax(
const std::string &className =
"int32", std::pmr::memory_resource *mr =
nullptr);
407Value flintmax(
const std::string &className =
"double", std::pmr::memory_resource *mr =
nullptr);
Core MATLAB-compatible multidimensional array and scalar value type.
static const Value Empty
MATLAB-style empty matrix sentinel — a 0×0 DOUBLE value.
Value isfloat(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is a floating-point type (single or double) (isfloat(v)).
Value isscalar(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is a 1x1 scalar (isscalar(v)).
Value isinf(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests array elements for Infinity (isinf(v)).
Value standardizeMissing(const Value &x, const Value &indicator, std::pmr::memory_resource *mr=nullptr)
Replaces specified indicator values with standard missing values (standardizeMissing(x,...
Value uint16(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 16-bit unsigned integer (uint16(x)).
Value uint8(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 8-bit unsigned integer (uint8(x)).
Value flintmax(const std::string &className="double", std::pmr::memory_resource *mr=nullptr)
Largest consecutive integer accurately representable in floating-point format (flintmax(className)).
Value iscell(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is a cell array (iscell(v)).
Value isinteger(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is an integer class (isinteger(v)).
Value isvector(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is a 1-D vector (1xN or Nx1) (isvector(v)).
Value islogical(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is logical type (islogical(v)).
Value issingle(const Value &x, std::pmr::memory_resource *mr=nullptr)
Tests if input is single-precision floating point (issingle(x)).
Value isnan(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests array elements for NaN (isnan(v)).
Value 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 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,...
Value int8(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 8-bit signed integer (int8(x)).
Value 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 int16(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 16-bit signed integer (int16(x)).
Value 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 realmax(const std::string &className="double", std::pmr::memory_resource *mr=nullptr)
Largest finite floating-point number (realmax(className)).
Value 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 anynan(const Value &x, std::pmr::memory_resource *mr=nullptr)
True if any array element is NaN (anynan(x)).
Value isstruct(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is a structure (isstruct(v)).
Value isnumeric(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is numeric (double, single, integer) (isnumeric(v)).
Value isrow(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is a 1xN row vector (isrow(v)).
Value logical(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to logical boolean array (logical(x)).
Value 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 isfinite(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests array elements for finiteness (isfinite(v)).
Value allfinite(const Value &x, std::pmr::memory_resource *mr=nullptr)
True if all elements are finite numbers (allfinite(x)).
Value intmax(const std::string &className="int32", std::pmr::memory_resource *mr=nullptr)
Largest integer value for specified integer class (intmax(className)).
Value ismissing(const Value &x, std::pmr::memory_resource *mr=nullptr)
Finds missing entries in array using default standard missing indicators (ismissing(x)).
Value intmin(const std::string &className="int32", std::pmr::memory_resource *mr=nullptr)
Smallest integer value for specified integer class (intmin(className)).
Value issparse(const Value &x, std::pmr::memory_resource *mr=nullptr)
Tests if input is a sparse array (issparse(x)).
Value ismatrix(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is a 2-D matrix (ismatrix(v)).
Value isstring(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is string array (isstring(v)).
Value anymissing(const Value &x, std::pmr::memory_resource *mr=nullptr)
Tests if array contains any missing entries (anymissing(x)).
Value 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,...
Value single(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to single-precision floating point (single(x)).
Value isuniform(const Value &x, std::pmr::memory_resource *mr=nullptr)
Tests if array has uniform element spacing (isuniform(x)).
Value isempty(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if array is empty (any dimension is 0) (isempty(v)).
Value iscolumn(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is an Nx1 column vector (iscolumn(v)).
Value int32(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 32-bit signed integer (int32(x)).
Value ischar(const Value &v, std::pmr::memory_resource *mr=nullptr)
Tests if input is character array (ischar(v)).
Value 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 uint32(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 32-bit unsigned integer (uint32(x)).
Value 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 int64(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 64-bit signed integer (int64(x)).
Value classOf(const Value &x, std::pmr::memory_resource *mr=nullptr)
Returns the class name of an object or array (class(x)).
Value uint64(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to 64-bit unsigned integer (uint64(x)).
Value realmin(const std::string &className="double", std::pmr::memory_resource *mr=nullptr)
Smallest positive normalized floating-point number (realmin(className)).
Value 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,...
Value toDouble(const Value &x, std::pmr::memory_resource *mr=nullptr)
Converts input array to double-precision floating point (double(x)).