runmat 0.4.9-dev.2 → 0.4.10-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/artifacts/stdlib.snapshot +0 -0
  2. package/dist/builtins.d.ts +1 -0
  3. package/dist/builtins.d.ts.map +1 -1
  4. package/dist/builtins.js.map +1 -1
  5. package/dist/generated/builtin-examples-catalog.d.ts.map +1 -1
  6. package/dist/generated/builtin-examples-catalog.js +1 -1
  7. package/dist/generated/builtin-examples-catalog.js.map +1 -1
  8. package/dist/generated/builtins/complex.d.ts +4 -0
  9. package/dist/generated/builtins/complex.d.ts.map +1 -0
  10. package/dist/generated/builtins/complex.js +157 -0
  11. package/dist/generated/builtins/complex.js.map +1 -0
  12. package/dist/generated/builtins/cosd.d.ts +4 -0
  13. package/dist/generated/builtins/cosd.d.ts.map +1 -0
  14. package/dist/generated/builtins/cosd.js +109 -0
  15. package/dist/generated/builtins/cosd.js.map +1 -0
  16. package/dist/generated/builtins/db.d.ts +4 -0
  17. package/dist/generated/builtins/db.d.ts.map +1 -0
  18. package/dist/generated/builtins/db.js +122 -0
  19. package/dist/generated/builtins/db.js.map +1 -0
  20. package/dist/generated/builtins/fill3.d.ts +4 -0
  21. package/dist/generated/builtins/fill3.d.ts.map +1 -0
  22. package/dist/generated/builtins/fill3.js +152 -0
  23. package/dist/generated/builtins/fill3.js.map +1 -0
  24. package/dist/generated/builtins/fminbnd.d.ts +4 -0
  25. package/dist/generated/builtins/fminbnd.d.ts.map +1 -0
  26. package/dist/generated/builtins/fminbnd.js +104 -0
  27. package/dist/generated/builtins/fminbnd.js.map +1 -0
  28. package/dist/generated/builtins/integral.d.ts +4 -0
  29. package/dist/generated/builtins/integral.d.ts.map +1 -0
  30. package/dist/generated/builtins/integral.js +101 -0
  31. package/dist/generated/builtins/integral.js.map +1 -0
  32. package/dist/generated/builtins/mode.d.ts +4 -0
  33. package/dist/generated/builtins/mode.d.ts.map +1 -0
  34. package/dist/generated/builtins/mode.js +146 -0
  35. package/dist/generated/builtins/mode.js.map +1 -0
  36. package/dist/generated/builtins/optimset.d.ts.map +1 -1
  37. package/dist/generated/builtins/optimset.js +8 -4
  38. package/dist/generated/builtins/optimset.js.map +1 -1
  39. package/dist/generated/builtins/patch.d.ts +4 -0
  40. package/dist/generated/builtins/patch.d.ts.map +1 -0
  41. package/dist/generated/builtins/patch.js +135 -0
  42. package/dist/generated/builtins/patch.js.map +1 -0
  43. package/dist/generated/builtins/repelem.d.ts +4 -0
  44. package/dist/generated/builtins/repelem.d.ts.map +1 -0
  45. package/dist/generated/builtins/repelem.js +135 -0
  46. package/dist/generated/builtins/repelem.js.map +1 -0
  47. package/dist/generated/builtins/sawtooth.d.ts +4 -0
  48. package/dist/generated/builtins/sawtooth.d.ts.map +1 -0
  49. package/dist/generated/builtins/sawtooth.js +111 -0
  50. package/dist/generated/builtins/sawtooth.js.map +1 -0
  51. package/dist/generated/builtins/sinc.d.ts +4 -0
  52. package/dist/generated/builtins/sinc.d.ts.map +1 -0
  53. package/dist/generated/builtins/sinc.js +142 -0
  54. package/dist/generated/builtins/sinc.js.map +1 -0
  55. package/dist/generated/builtins/sind.d.ts +4 -0
  56. package/dist/generated/builtins/sind.d.ts.map +1 -0
  57. package/dist/generated/builtins/sind.js +109 -0
  58. package/dist/generated/builtins/sind.js.map +1 -0
  59. package/dist/generated/builtins/square.d.ts +4 -0
  60. package/dist/generated/builtins/square.d.ts.map +1 -0
  61. package/dist/generated/builtins/square.js +110 -0
  62. package/dist/generated/builtins/square.js.map +1 -0
  63. package/dist/generated/builtins/step.d.ts +4 -0
  64. package/dist/generated/builtins/step.d.ts.map +1 -0
  65. package/dist/generated/builtins/step.js +125 -0
  66. package/dist/generated/builtins/step.js.map +1 -0
  67. package/dist/generated/builtins/tand.d.ts +4 -0
  68. package/dist/generated/builtins/tand.d.ts.map +1 -0
  69. package/dist/generated/builtins/tand.js +109 -0
  70. package/dist/generated/builtins/tand.js.map +1 -0
  71. package/dist/generated/builtins-manifest.d.ts.map +1 -1
  72. package/dist/generated/builtins-manifest.js +323 -1
  73. package/dist/generated/builtins-manifest.js.map +1 -1
  74. package/dist/lsp/runmat_lsp.d.ts +2 -2
  75. package/dist/lsp/runmat_lsp.js +4 -4
  76. package/dist/lsp/runmat_lsp_bg.wasm +0 -0
  77. package/dist/lsp/runmat_lsp_bg.wasm.d.ts +2 -2
  78. package/dist/pkg-web/runmat_wasm_web.d.ts +42 -42
  79. package/dist/pkg-web/runmat_wasm_web.js +85 -85
  80. package/dist/pkg-web/runmat_wasm_web_bg.wasm +0 -0
  81. package/dist/pkg-web/runmat_wasm_web_bg.wasm.d.ts +35 -35
  82. package/dist/runtime/stdlib.snapshot +0 -0
  83. package/package.json +1 -1
@@ -0,0 +1,135 @@
1
+ // @generated by scripts/generate-builtins.cjs
2
+ // Do not edit by hand.
3
+ const builtinDoc = {
4
+ "title": "repelem",
5
+ "category": "array/shape",
6
+ "keywords": [
7
+ "repelem",
8
+ "replicate",
9
+ "repeat",
10
+ "array",
11
+ "cell"
12
+ ],
13
+ "summary": "Replicate each element of an array along one or more dimensions.",
14
+ "references": [],
15
+ "gpu_support": {
16
+ "elementwise": false,
17
+ "reduction": false,
18
+ "precisions": [],
19
+ "broadcasting": "none",
20
+ "notes": "GPU inputs are gathered to host memory before replication; no provider hook exists yet."
21
+ },
22
+ "fusion": {
23
+ "elementwise": false,
24
+ "reduction": false,
25
+ "max_inputs": 1,
26
+ "constants": "inline"
27
+ },
28
+ "requires_feature": null,
29
+ "tested": {
30
+ "unit": "builtins::array::shape::repelem::tests",
31
+ "integration": "crates/runmat-runtime/tests/nd_ops.rs"
32
+ },
33
+ "description": "`repelem(A, r1, r2, ..., rN)` repeats each element of `A` along the requested dimensions. Unlike `repmat`, which tiles whole arrays, `repelem` expands individual elements into runs or blocks.",
34
+ "behaviors": [
35
+ "`repelem(v, n)` repeats each element of a row or column vector `v` `n` times and preserves vector orientation.",
36
+ "`repelem(v, counts)` accepts a count vector with one non-negative integer count per element of `v`.",
37
+ "`repelem(A, r1, r2, ..., rN)` repeats matrix or N-D array elements along each dimension; scalar factors create element blocks and vector factors provide per-index counts for that dimension.",
38
+ "Numeric, logical, complex, string, char, and cell inputs are supported. Numeric, logical, complex, string, and cell arrays support N-D replication; char arrays are represented as 2-D character matrices.",
39
+ "Zero counts are allowed and remove the corresponding element or dimension slice from the output.",
40
+ "Replication counts must be finite, non-negative integers. Count vectors must match the size of the dimension they apply to.",
41
+ "The builtin checks shape and size overflow before materializing output arrays."
42
+ ],
43
+ "examples": [
44
+ {
45
+ "description": "Repeating every element of a row vector",
46
+ "input": "u = repelem([1 2 3], 2)",
47
+ "output": "u =\n 1 1 2 2 3 3"
48
+ },
49
+ {
50
+ "description": "Using a per-element count vector",
51
+ "input": "u = repelem([1 2 3], [1 2 3])",
52
+ "output": "u =\n 1 2 2 3 3 3"
53
+ },
54
+ {
55
+ "description": "Expanding a matrix into element blocks",
56
+ "input": "A = [1 2; 3 4];\nB = repelem(A, 2, 3)",
57
+ "output": "B =\n 1 1 1 2 2 2\n 1 1 1 2 2 2\n 3 3 3 4 4 4\n 3 3 3 4 4 4"
58
+ },
59
+ {
60
+ "description": "Dropping elements with zero counts",
61
+ "input": "u = repelem([1 2 3 4 5], [0 1 0 2 1])",
62
+ "output": "u =\n 2 4 4 5"
63
+ },
64
+ {
65
+ "description": "Repeating along a higher dimension",
66
+ "input": "C = {1; 2};\nD = repelem(reshape(C, [1 1 2]), 1, 1, 2);\nsize(D)",
67
+ "output": "ans =\n 1 1 4"
68
+ }
69
+ ],
70
+ "faqs": [
71
+ {
72
+ "question": "How is `repelem` different from `repmat`?",
73
+ "answer": "`repmat` tiles a whole array. `repelem` repeats each individual element, so matrix inputs expand into element-wise blocks."
74
+ },
75
+ {
76
+ "question": "Can counts be different for each element?",
77
+ "answer": "Yes. In vector form, the count vector must have one entry for each vector element. In multi-dimensional form, a count vector applies to the dimension at the same argument position."
78
+ },
79
+ {
80
+ "question": "Are zero counts valid?",
81
+ "answer": "Yes. A zero count omits that element or dimension index from the output."
82
+ },
83
+ {
84
+ "question": "Does `repelem` preserve row and column vector orientation?",
85
+ "answer": "Yes. Row vectors remain row vectors, column vectors remain column vectors, including empty column vectors."
86
+ },
87
+ {
88
+ "question": "Does `repelem` run on the GPU?",
89
+ "answer": "Not yet. The runtime gathers GPU tensors to host memory for this builtin, computes the replicated result on the CPU, and returns a host value."
90
+ }
91
+ ],
92
+ "links": [
93
+ {
94
+ "label": "repmat",
95
+ "url": "./repmat"
96
+ },
97
+ {
98
+ "label": "kron",
99
+ "url": "./kron"
100
+ },
101
+ {
102
+ "label": "reshape",
103
+ "url": "./reshape"
104
+ },
105
+ {
106
+ "label": "cat",
107
+ "url": "./cat"
108
+ },
109
+ {
110
+ "label": "size",
111
+ "url": "./size"
112
+ }
113
+ ],
114
+ "source": {
115
+ "label": "crates/runmat-runtime/src/builtins/array/shape/repelem.rs",
116
+ "url": "crates/runmat-runtime/src/builtins/array/shape/repelem.rs"
117
+ },
118
+ "gpu_residency": "`repelem` is currently a host-resident array construction builtin. If a GPU tensor reaches this builtin, RunMat gathers it before replication.",
119
+ "gpu_behavior": [
120
+ "RunMat does not yet expose a provider hook for element-wise replication. Backends can add one later without changing the MATLAB-facing behavior."
121
+ ],
122
+ "extended_capabilities": [
123
+ "`repelem` preserves the input value class for numeric dtype metadata, logical arrays, complex tensors, string arrays, char arrays, and cell arrays.",
124
+ "N-D numeric, logical, complex, string, and cell replication uses the runtime's native storage order for each value kind."
125
+ ],
126
+ "key": "repelem",
127
+ "slug": "repelem",
128
+ "aliases": [],
129
+ "categoryPath": [
130
+ "array",
131
+ "shape"
132
+ ]
133
+ };
134
+ export default builtinDoc;
135
+ //# sourceMappingURL=repelem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repelem.js","sourceRoot":"","sources":["../../../src/generated/builtins/repelem.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,uBAAuB;A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AE,2CAA2C;YACvD,QAAQ,EAAE,4HAA4H;SACvI;QACD;YACE,UAAU,EAAE,2CAA2C;YACvD,QAAQ,EAAE,sLAAsL;SACjM;QACD;YACE,UAAU,EAAE,wBAAwB;YACpC,QAAQ,EAAE,0EAA0E;SACrF;QACD;YACE,UAAU,EAAE,4DAA4D;YACxE,QAAQ,EAAE,4GAA4G;SACvH;QACD;YACE,UAAU,EAAE,gCAAgC;YAC5C,QAAQ,EAAE,gJAAgJ;SAC3J;KACF;IACD,OAAO,EAAE;QACP;YACE,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,UAAU;SAClB;QACD;YACE,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,QAAQ;SAChB;QACD;YACE,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,WAAW;SACnB;QACD;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,OAAO;SACf;QACD;YACE,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,QAAQ;SAChB;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,2DAA2D;QACpE,KAAK,EAAE,2DAA2D;KACnE;IACD,eAAe,EAAE,gJAAgJ;IACjK,cAAc,EAAE;QACd,kJAAkJ;KACnJ;IACD,uBAAuB,EAAE;QACvB,qJAAqJ;QACrJ,0HAA0H;KAC3H;IACD,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,EAAE;IACb,cAAc,EAAE;QACd,OAAO;QACP,OAAO;KACR;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BuiltinDoc } from "../../builtins.js";
2
+ declare const builtinDoc: BuiltinDoc;
3
+ export default builtinDoc;
4
+ //# sourceMappingURL=sawtooth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sawtooth.d.ts","sourceRoot":"","sources":["../../../src/generated/builtins/sawtooth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,UA0GjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,111 @@
1
+ // @generated by scripts/generate-builtins.cjs
2
+ // Do not edit by hand.
3
+ const builtinDoc = {
4
+ "title": "sawtooth",
5
+ "category": "math/signal",
6
+ "keywords": [
7
+ "sawtooth",
8
+ "waveform",
9
+ "signal processing",
10
+ "triangle",
11
+ "periodic",
12
+ "elementwise"
13
+ ],
14
+ "summary": "Generate a periodic sawtooth waveform with optional peak position.",
15
+ "references": [],
16
+ "gpu_support": {
17
+ "elementwise": true,
18
+ "reduction": false,
19
+ "precisions": [
20
+ "f64"
21
+ ],
22
+ "broadcasting": "elementwise",
23
+ "notes": "GPU inputs are gathered to the host so the reference implementation can guarantee MATLAB-compatible piecewise-linear evaluation at the period boundary."
24
+ },
25
+ "fusion": {
26
+ "elementwise": false,
27
+ "reduction": false,
28
+ "max_inputs": 1,
29
+ "constants": "inline",
30
+ "notes": "Fusion is intentionally disabled for v1 because the WGSL piecewise expression is non-trivial and brings little benefit relative to the host loop."
31
+ },
32
+ "requires_feature": null,
33
+ "tested": {
34
+ "unit": "builtins::math::signal::sawtooth::tests",
35
+ "integration": null
36
+ },
37
+ "description": "`y = sawtooth(t)` generates a sawtooth wave with period `2*pi` at the sample times in `t`, ranging in `[-1, 1]`. `y = sawtooth(t, xmax)` controls the peak position with `xmax` in `[0, 1]`: `xmax = 1` (the default) produces a rising sawtooth, `xmax = 0` produces a falling sawtooth, and intermediate values such as `xmax = 0.5` produce a triangle wave whose peak is at the centre of each period.",
38
+ "behaviors": [
39
+ "Operates element-wise on scalars, vectors, matrices, and N-D tensors; preserves input shape.",
40
+ "Reduces input modulo `2*pi` so the waveform is periodic across negative and positive sample times.",
41
+ "Returns `-1` at the start of each period and approaches `+1` just before the period boundary wraps when `xmax = 1`.",
42
+ "Returns a piecewise-linear triangle wave when `xmax = 0.5`, peaking at `1` at the centre of each period.",
43
+ "Returns a pure falling ramp when `xmax = 0` and a pure rising ramp when `xmax = 1`.",
44
+ "Integer and logical inputs are promoted to double precision before evaluation.",
45
+ "Non-finite sample times (`NaN`, `+Inf`, `-Inf`) propagate as `NaN` element-wise, matching MATLAB.",
46
+ "Complex and text inputs are rejected with a builtin-scoped error.",
47
+ "Rejects `xmax` values outside `[0, 1]` and non-scalar `xmax` arguments."
48
+ ],
49
+ "examples": [
50
+ {
51
+ "description": "Default rising sawtooth over two periods",
52
+ "input": "t = 0:pi/2:4*pi;\ny = sawtooth(t)",
53
+ "output": "y = [-1 -0.5 0 0.5 -1 -0.5 0 0.5 -1]"
54
+ },
55
+ {
56
+ "description": "Triangle wave via xmax = 0.5",
57
+ "input": "t = linspace(0, 2*pi, 5);\ny = sawtooth(t, 0.5)",
58
+ "output": "y = [-1 0 1 0 -1]"
59
+ },
60
+ {
61
+ "description": "Pure falling sawtooth via xmax = 0",
62
+ "input": "y = sawtooth([0 pi 2*pi], 0)",
63
+ "output": "y = [1 0 1]"
64
+ }
65
+ ],
66
+ "faqs": [
67
+ {
68
+ "question": "Why does `sawtooth(2*pi)` return `-1` instead of `+1`?",
69
+ "answer": "RunMat reduces the input modulo `2*pi`, so `2*pi` is folded back to the start of the next period. The default rising sawtooth therefore restarts at `-1` exactly on each period boundary, matching MATLAB."
70
+ },
71
+ {
72
+ "question": "How do I produce a triangle wave?",
73
+ "answer": "Pass `xmax = 0.5` so the peak sits at the centre of each period and the waveform ramps symmetrically up and back down."
74
+ },
75
+ {
76
+ "question": "Can `sawtooth` accept complex inputs?",
77
+ "answer": "No. `sawtooth` is defined on real samples and rejects complex inputs with a builtin-scoped error to match MATLAB."
78
+ }
79
+ ],
80
+ "links": [
81
+ {
82
+ "label": "square",
83
+ "url": "./square"
84
+ },
85
+ {
86
+ "label": "sin",
87
+ "url": "./sin"
88
+ },
89
+ {
90
+ "label": "cos",
91
+ "url": "./cos"
92
+ },
93
+ {
94
+ "label": "linspace",
95
+ "url": "./linspace"
96
+ }
97
+ ],
98
+ "source": {
99
+ "label": "`crates/runmat-runtime/src/builtins/math/signal/sawtooth.rs`",
100
+ "url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/math/signal/sawtooth.rs"
101
+ },
102
+ "key": "sawtooth",
103
+ "slug": "sawtooth",
104
+ "aliases": [],
105
+ "categoryPath": [
106
+ "math",
107
+ "signal"
108
+ ]
109
+ };
110
+ export default builtinDoc;
111
+ //# sourceMappingURL=sawtooth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sawtooth.js","sourceRoot":"","sources":["../../../src/generated/builtins/sawtooth.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,uBAAuB;AAIvB,MAAM,UAAU,GAAe;IAC7B,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE;QACV,UAAU;QACV,UAAU;QACV,mBAAmB;QACnB,UAAU;QACV,UAAU;QACV,aAAa;KACd;IACD,SAAS,EAAE,oEAAoE;IAC/E,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE;QACb,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE;YACZ,KAAK;SACN;QACD,cAAc,EAAE,aAAa;QAC7B,OAAO,EAAE,yJAAyJ;KACnK;IACD,QAAQ,EAAE;QACR,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,QAAQ;QACrB,OAAO,EAAE,mJAAmJ;KAC7J;IACD,kBAAkB,EAAE,IAAI;IACxB,QAAQ,EAAE;QACR,MAAM,EAAE,yCAAyC;QACjD,aAAa,EAAE,IAAI;KACpB;IACD,aAAa,EAAE,4YAA4Y;IAC3Z,WAAW,EAAE;QACX,8FAA8F;QAC9F,oGAAoG;QACpG,qHAAqH;QACrH,0GAA0G;QAC1G,qFAAqF;QACrF,gFAAgF;QAChF,mGAAmG;QACnG,mEAAmE;QACnE,yEAAyE;KAC1E;IACD,UAAU,EAAE;QACV;YACE,aAAa,EAAE,0CAA0C;YACzD,OAAO,EAAE,mCAAmC;YAC5C,QAAQ,EAAE,sCAAsC;SACjD;QACD;YACE,aAAa,EAAE,8BAA8B;YAC7C,OAAO,EAAE,iDAAiD;YAC1D,QAAQ,EAAE,mBAAmB;SAC9B;QACD;YACE,aAAa,EAAE,oCAAoC;YACnD,OAAO,EAAE,8BAA8B;YACvC,QAAQ,EAAE,aAAa;SACxB;KACF;IACD,MAAM,EAAE;QACN;YACE,UAAU,EAAE,wDAAwD;YACpE,QAAQ,EAAE,4MAA4M;SACvN;QACD;YACE,UAAU,EAAE,mCAAmC;YAC/C,QAAQ,EAAE,wHAAwH;SACnI;QACD;YACE,UAAU,EAAE,uCAAuC;YACnD,QAAQ,EAAE,mHAAmH;SAC9H;KACF;IACD,OAAO,EAAE;QACP;YACE,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,UAAU;SAClB;QACD;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,OAAO;SACf;QACD;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,OAAO;SACf;QACD;YACE,OAAO,EAAE,UAAU;YACnB,KAAK,EAAE,YAAY;SACpB;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,8DAA8D;QACvE,KAAK,EAAE,2GAA2G;KACnH;IACD,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,EAAE;IACb,cAAc,EAAE;QACd,MAAM;QACN,QAAQ;KACT;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BuiltinDoc } from "../../builtins.js";
2
+ declare const builtinDoc: BuiltinDoc;
3
+ export default builtinDoc;
4
+ //# sourceMappingURL=sinc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sinc.d.ts","sourceRoot":"","sources":["../../../src/generated/builtins/sinc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,UAyIjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,142 @@
1
+ // @generated by scripts/generate-builtins.cjs
2
+ // Do not edit by hand.
3
+ const builtinDoc = {
4
+ "title": "sinc",
5
+ "category": "math/signal",
6
+ "keywords": [
7
+ "sinc",
8
+ "normalized sinc",
9
+ "signal processing",
10
+ "elementwise",
11
+ "complex"
12
+ ],
13
+ "summary": "Normalized sinc, sin(pi*x)/(pi*x), evaluated element-wise.",
14
+ "references": [
15
+ "title: \"MATLAB sinc documentation\""
16
+ ],
17
+ "gpu_support": {
18
+ "elementwise": true,
19
+ "reduction": false,
20
+ "precisions": [
21
+ "f32",
22
+ "f64"
23
+ ],
24
+ "broadcasting": "matlab",
25
+ "notes": "Providers may execute sinc on-device through unary_sinc. The runtime gathers to the host only when a provider lacks that hook or cannot service the input."
26
+ },
27
+ "fusion": {
28
+ "elementwise": true,
29
+ "reduction": false,
30
+ "max_inputs": 1,
31
+ "constants": "inline"
32
+ },
33
+ "requires_feature": null,
34
+ "tested": {
35
+ "unit": "builtins::math::signal::sinc::tests",
36
+ "integration": "builtins::math::signal::sinc::tests::sinc_gpu_input_stays_resident_when_provider_supports_sinc"
37
+ },
38
+ "description": "`y = sinc(x)` evaluates the normalized sinc function element-wise using MATLAB's definition `sin(pi*x)/(pi*x)`, with `sinc(0)` defined as `1`.",
39
+ "behaviors": [
40
+ "Accepts real or complex scalars, vectors, matrices, and N-D tensors.",
41
+ "Preserves the input shape for vector, matrix, and N-D tensor inputs.",
42
+ "Returns `1` for exactly zero real inputs.",
43
+ "Returns exact `0` for finite nonzero integer-valued real inputs, matching MATLAB's `sinpi`-style integer accuracy where practical.",
44
+ "Logical and integer inputs are promoted to double precision before evaluation.",
45
+ "Complex inputs use the analytic extension `sin(pi*z)/(pi*z)` and return `1 + 0i` for `z == 0`.",
46
+ "GPU inputs stay resident when the active provider supports `unary_sinc`; otherwise RunMat gathers automatically and evaluates with the host implementation."
47
+ ],
48
+ "examples": [
49
+ {
50
+ "description": "Evaluate sinc at zero",
51
+ "input": "y = sinc(0)",
52
+ "output": "y = 1"
53
+ },
54
+ {
55
+ "description": "Evaluate sinc at integer inputs",
56
+ "input": "x = 1:5;\ny = sinc(x)",
57
+ "output": "y = [0 0 0 0 0]"
58
+ },
59
+ {
60
+ "description": "Evaluate normalized sinc values",
61
+ "input": "x = [-1 0 1 0.5];\ny = sinc(x)",
62
+ "output": "y = [0 1 0 0.6366]"
63
+ },
64
+ {
65
+ "description": "Preserve matrix shape",
66
+ "input": "A = [0 0.5; 1.5 2];\nY = sinc(A)",
67
+ "output": "Y =\n 1.0000 0.6366\n -0.2122 0"
68
+ },
69
+ {
70
+ "description": "Evaluate sinc for a complex value",
71
+ "input": "z = sinc(0.5 + 0.25i)"
72
+ },
73
+ {
74
+ "description": "Use gpuArray input",
75
+ "input": "g = gpuArray([0 0.5 1]);\ny = sinc(g);\nresult = gather(y)",
76
+ "output": "result = [1 0.6366 0]"
77
+ }
78
+ ],
79
+ "faqs": [
80
+ {
81
+ "question": "Which sinc definition does RunMat use?",
82
+ "answer": "RunMat uses MATLAB's normalized definition, `sin(pi*x)/(pi*x)`, with the removable singularity at zero defined as `1`."
83
+ },
84
+ {
85
+ "question": "Why does `sinc(1:5)` return exact zeros?",
86
+ "answer": "The implementation detects finite nonzero integer-valued real inputs before evaluating the trigonometric expression. This avoids floating-point residuals from `sin(pi*x)` and matches MATLAB's practical `sinpi` behaviour."
87
+ },
88
+ {
89
+ "question": "Does `sinc` support complex values?",
90
+ "answer": "Yes. Complex scalars and complex tensors use the analytic extension `sin(pi*z)/(pi*z)` and preserve tensor shape."
91
+ },
92
+ {
93
+ "question": "Will `sinc(gpuArray(...))` stay on the GPU?",
94
+ "answer": "Yes when the active provider implements `unary_sinc`. Providers without that hook fall back to host evaluation so zero and integer cases still use the exact MATLAB-compatible path."
95
+ }
96
+ ],
97
+ "links": [
98
+ {
99
+ "label": "sin",
100
+ "url": "./sin"
101
+ },
102
+ {
103
+ "label": "fft",
104
+ "url": "./fft"
105
+ },
106
+ {
107
+ "label": "filter",
108
+ "url": "./filter"
109
+ },
110
+ {
111
+ "label": "conv",
112
+ "url": "./conv"
113
+ },
114
+ {
115
+ "label": "gpuArray",
116
+ "url": "./gpuarray"
117
+ },
118
+ {
119
+ "label": "gather",
120
+ "url": "./gather"
121
+ }
122
+ ],
123
+ "source": {
124
+ "label": "`crates/runmat-runtime/src/builtins/math/signal/sinc.rs`",
125
+ "url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/math/signal/sinc.rs"
126
+ },
127
+ "gpu_residency": "`sinc` keeps real GPU tensors resident when the active provider exposes `unary_sinc`. The runtime preserves a host fallback for providers that do not support the hook.",
128
+ "gpu_behavior": [
129
+ "Provider-backed execution uses the same normalized sinc semantics, including `sinc(0) == 1` and exact zeros for finite nonzero integer-valued real inputs.",
130
+ "If the provider declines the operation, RunMat gathers through the active provider and evaluates with the host implementation.",
131
+ "Fusion emits a guarded normalized sinc expression with explicit zero and integer branches for real elementwise graphs."
132
+ ],
133
+ "key": "sinc",
134
+ "slug": "sinc",
135
+ "aliases": [],
136
+ "categoryPath": [
137
+ "math",
138
+ "signal"
139
+ ]
140
+ };
141
+ export default builtinDoc;
142
+ //# sourceMappingURL=sinc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sinc.js","sourceRoot":"","sources":["../../../src/generated/builtins/sinc.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,uBAAuB;AAIvB,MAAM,UAAU,GAAe;IAC7B,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE;QACV,MAAM;QACN,iBAAiB;QACjB,mBAAmB;QACnB,aAAa;QACb,SAAS;KACV;IACD,SAAS,EAAE,4DAA4D;IACvE,YAAY,EAAE;QACZ,sCAAsC;KACv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E,UAAU,EAAE,qCAAqC;YACjD,QAAQ,EAAE,mHAAmH;SAC9H;QACD;YACE,UAAU,EAAE,6CAA6C;YACzD,QAAQ,EAAE,sLAAsL;SACjM;KACF;IACD,OAAO,EAAE;QACP;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,OAAO;SACf;QACD;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,OAAO;SACf;QACD;YACE,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,UAAU;SAClB;QACD;YACE,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,QAAQ;SAChB;QACD;YACE,OAAO,EAAE,UAAU;YACnB,KAAK,EAAE,YAAY;SACpB;QACD;YACE,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,UAAU;SAClB;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,0DAA0D;QACnE,KAAK,EAAE,uGAAuG;KAC/G;IACD,eAAe,EAAE,yKAAyK;IAC1L,cAAc,EAAE;QACd,4JAA4J;QAC5J,gIAAgI;QAChI,wHAAwH;KACzH;IACD,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,EAAE;IACb,cAAc,EAAE;QACd,MAAM;QACN,QAAQ;KACT;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BuiltinDoc } from "../../builtins.js";
2
+ declare const builtinDoc: BuiltinDoc;
3
+ export default builtinDoc;
4
+ //# sourceMappingURL=sind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sind.d.ts","sourceRoot":"","sources":["../../../src/generated/builtins/sind.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,UAwGjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,109 @@
1
+ // @generated by scripts/generate-builtins.cjs
2
+ // Do not edit by hand.
3
+ const builtinDoc = {
4
+ "title": "sind",
5
+ "category": "math/trigonometry",
6
+ "keywords": [
7
+ "sind",
8
+ "sine",
9
+ "degrees",
10
+ "angle",
11
+ "trigonometry",
12
+ "elementwise"
13
+ ],
14
+ "summary": "Sine of angles expressed in degrees with MATLAB-exact values at canonical multiples.",
15
+ "references": [],
16
+ "gpu_support": {
17
+ "elementwise": true,
18
+ "reduction": false,
19
+ "precisions": [
20
+ "f64"
21
+ ],
22
+ "broadcasting": "elementwise",
23
+ "notes": "GPU inputs are gathered to the host so the reference implementation can guarantee MATLAB-exact values at canonical multiples of 30, 90, 150, and 180 degrees."
24
+ },
25
+ "fusion": {
26
+ "elementwise": false,
27
+ "reduction": false,
28
+ "max_inputs": 1,
29
+ "constants": "inline",
30
+ "notes": "Fusion is intentionally disabled for v1 because the WGSL `sin(x*pi/180)` form would lose MATLAB's exact-value guarantees at canonical angles."
31
+ },
32
+ "requires_feature": null,
33
+ "tested": {
34
+ "unit": "builtins::math::trigonometry::sind::tests",
35
+ "integration": null
36
+ },
37
+ "description": "`y = sind(x)` evaluates the sine of each angle in `x`, interpreting the values in degrees rather than radians. The implementation reduces the angle modulo 360 and special-cases 0, 30, 90, 150, and 180 (and their negative/wrapped counterparts) so the result matches MATLAB's exact 0, ±0.5, and ±1 values without floating-point noise.",
38
+ "behaviors": [
39
+ "Operates element-wise on scalars, vectors, matrices, and N-D tensors.",
40
+ "Integer and logical inputs are promoted to double precision before evaluation.",
41
+ "Returns exactly 0 at multiples of 180 and exactly ±1 at the odd multiples of 90 (±90 + 360k).",
42
+ "Returns exactly ±0.5 at angles congruent to ±30 or ±150 modulo 360.",
43
+ "Complex inputs delegate to the analytic extension of `sin` after scaling by `pi/180`; exact-value treatment for complex operands is deferred.",
44
+ "Output shape matches the input shape; non-finite inputs propagate as `NaN`.",
45
+ "String inputs are unsupported and raise a builtin-scoped error."
46
+ ],
47
+ "examples": [
48
+ {
49
+ "description": "Sine of a canonical degree angle",
50
+ "input": "y = sind(30)",
51
+ "output": "y = 0.5"
52
+ },
53
+ {
54
+ "description": "Sine of multiples of 180 returns exactly zero",
55
+ "input": "y = sind([0 180 360])",
56
+ "output": "y = [0 0 0]"
57
+ },
58
+ {
59
+ "description": "Sine of a vector of common angles",
60
+ "input": "angles = [0 30 45 60 90];\ny = sind(angles)",
61
+ "output": "y = [0 0.5 0.7071 0.8660 1]"
62
+ }
63
+ ],
64
+ "faqs": [
65
+ {
66
+ "question": "Why does `sind(180)` return exactly zero?",
67
+ "answer": "MATLAB guarantees an exact zero at multiples of 180 to avoid floating-point noise from `pi`. RunMat reduces the angle modulo 360 and short-circuits the canonical cases before delegating to `sin`."
68
+ },
69
+ {
70
+ "question": "Is `sind(x)` equivalent to `sin(x*pi/180)`?",
71
+ "answer": "Mathematically yes, but the floating-point result differs at canonical angles because `pi/180` is not exact in binary floating point. `sind` returns the exact MATLAB values at multiples of 30, 90, 150, and 180."
72
+ },
73
+ {
74
+ "question": "Does `sind` support arrays?",
75
+ "answer": "Yes. Scalars, vectors, matrices, and N-D tensors are all handled element-wise; the shape of the input is preserved."
76
+ }
77
+ ],
78
+ "links": [
79
+ {
80
+ "label": "cosd",
81
+ "url": "./cosd"
82
+ },
83
+ {
84
+ "label": "tand",
85
+ "url": "./tand"
86
+ },
87
+ {
88
+ "label": "sin",
89
+ "url": "./sin"
90
+ },
91
+ {
92
+ "label": "deg2rad",
93
+ "url": "./deg2rad"
94
+ }
95
+ ],
96
+ "source": {
97
+ "label": "`crates/runmat-runtime/src/builtins/math/trigonometry/sind.rs`",
98
+ "url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/math/trigonometry/sind.rs"
99
+ },
100
+ "key": "sind",
101
+ "slug": "sind",
102
+ "aliases": [],
103
+ "categoryPath": [
104
+ "math",
105
+ "trigonometry"
106
+ ]
107
+ };
108
+ export default builtinDoc;
109
+ //# sourceMappingURL=sind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sind.js","sourceRoot":"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6CAA6C;YACzD,QAAQ,EAAE,oNAAoN;SAC/N;QACD;YACE,UAAU,EAAE,6BAA6B;YACzC,QAAQ,EAAE,qHAAqH;SAChI;KACF;IACD,OAAO,EAAE;QACP;YACE,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,QAAQ;SAChB;QACD;YACE,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,QAAQ;SAChB;QACD;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,OAAO;SACf;QACD;YACE,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,WAAW;SACnB;KACF;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,gEAAgE;QACzE,KAAK,EAAE,6GAA6G;KACrH;IACD,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,EAAE;IACb,cAAc,EAAE;QACd,MAAM;QACN,cAAc;KACf;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BuiltinDoc } from "../../builtins.js";
2
+ declare const builtinDoc: BuiltinDoc;
3
+ export default builtinDoc;
4
+ //# sourceMappingURL=square.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"square.d.ts","sourceRoot":"","sources":["../../../src/generated/builtins/square.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,UAyGjB,CAAC;AAEF,eAAe,UAAU,CAAC"}