nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
cell.hpp
Go to the documentation of this file.
1
3// toolboxes/builtin/include/nk/builtin/language/cells/cell.hpp
4#pragma once
5
6#include <memory_resource>
7#include <nk/value/fn_handle.hpp>
8#include <nk/value/value.hpp>
9
10namespace nk {
11
14
15class Engine;
16}
17
18namespace nk::runtime {
19
20void registerCellsRuntime(Engine &engine);
21void registerCellfunCallbackBuiltin(Engine &engine);
22
31Value cell(size_t n, std::pmr::memory_resource *mr = nullptr);
32
39Value cell(size_t rows, size_t cols, std::pmr::memory_resource *mr = nullptr);
40
50Value cell(size_t rows, size_t cols, size_t pages, std::pmr::memory_resource *mr = nullptr);
51
76Value cellfun(FnHandle fn, const Value &c, bool uniformOutput,
77 std::pmr::memory_resource *mr = nullptr);
78
85Value num2cell(const Value &x, std::pmr::memory_resource *mr = nullptr);
86
96Value cell2mat(const Value &c, std::pmr::memory_resource *mr = nullptr);
97
104Value iscellstr(const Value &c, std::pmr::memory_resource *mr = nullptr);
105
115Value cellstr(const Value &x, std::pmr::memory_resource *mr = nullptr);
116
133Value mat2cell(const Value &x, const Value &rowSizes,
134 const Value &colSizes = Value::Empty,
135 std::pmr::memory_resource *mr = nullptr);
136
137
139} // namespace nk::runtime
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
static const Value Empty
MATLAB-style empty matrix sentinel — a 0×0 DOUBLE value.
Definition value.hpp:136
Value iscellstr(const Value &c, std::pmr::memory_resource *mr=nullptr)
Test whether a cell array holds only char rows (tf = iscellstr(c)).
Value cell2mat(const Value &c, std::pmr::memory_resource *mr=nullptr)
Concatenate cells into a matrix (A = cell2mat(c)).
Value 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)).
Value num2cell(const Value &x, std::pmr::memory_resource *mr=nullptr)
Wrap each element in a scalar cell (c = num2cell(A)).
Value cell(size_t n, std::pmr::memory_resource *mr=nullptr)
Square cell array (c = cell(n)).
Value 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 cellstr(const Value &x, std::pmr::memory_resource *mr=nullptr)
Convert to cell-of-strings (c = cellstr(x)).