numbl 0.4.21 → 0.4.22

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 (281) hide show
  1. package/binding.gyp +12 -6
  2. package/dist-browser/browser/index.d.ts +1 -1
  3. package/dist-browser/browser/mip.d.ts +7 -0
  4. package/dist-browser/browser/protocol.d.ts +1 -1
  5. package/dist-browser/browser.js +1 -1
  6. package/dist-browser/db/operations.d.ts +0 -1
  7. package/dist-browser/gpuHelper.d.ts +29 -0
  8. package/dist-browser/hooks/projectFilesState.d.ts +37 -0
  9. package/dist-browser/numbl-core/execSession.d.ts +39 -0
  10. package/dist-browser/numbl-core/executeCode.d.ts +10 -1
  11. package/dist-browser/numbl-core/executors/classification.d.ts +2 -10
  12. package/dist-browser/numbl-core/executors/jit/backend.d.ts +65 -0
  13. package/dist-browser/numbl-core/executors/jit/cBackend.d.ts +22 -0
  14. package/dist-browser/numbl-core/executors/jit/callExecutor.d.ts +13 -44
  15. package/dist-browser/numbl-core/executors/jit/hostHelpers.d.ts +24 -0
  16. package/dist-browser/numbl-core/executors/jit/jsBackend.d.ts +15 -0
  17. package/dist-browser/numbl-core/executors/jit/loopExecutor.d.ts +13 -40
  18. package/dist-browser/numbl-core/executors/jit/session.d.ts +1 -1
  19. package/dist-browser/numbl-core/executors/jit/topLevelExecutor.d.ts +13 -33
  20. package/dist-browser/numbl-core/executors/jit/valueAdapterC.d.ts +32 -48
  21. package/dist-browser/numbl-core/executors/lowering.d.ts +38 -96
  22. package/dist-browser/numbl-core/executors/plugins.d.ts +14 -28
  23. package/dist-browser/numbl-core/executors/registry.d.ts +32 -133
  24. package/dist-browser/numbl-core/executors/types.d.ts +30 -92
  25. package/dist-browser/numbl-core/functionResolve.d.ts +3 -13
  26. package/dist-browser/numbl-core/helpers/check-helpers.d.ts +0 -5
  27. package/dist-browser/numbl-core/helpers/glob.d.ts +14 -0
  28. package/dist-browser/numbl-core/helpers/linsolve.d.ts +3 -13
  29. package/dist-browser/numbl-core/helpers/reduction-helpers.d.ts +2 -4
  30. package/dist-browser/numbl-core/helpers/shape-utils.d.ts +10 -0
  31. package/dist-browser/numbl-core/interpreter/builtins/index.d.ts +3 -1
  32. package/dist-browser/numbl-core/interpreter/builtins/time-system.d.ts +0 -1
  33. package/dist-browser/numbl-core/interpreter/builtins/types.d.ts +7 -7
  34. package/dist-browser/numbl-core/interpreter/interpreter.d.ts +6 -6
  35. package/dist-browser/numbl-core/interpreter/interpreterFunctions.d.ts +9 -1
  36. package/dist-browser/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
  37. package/dist-browser/numbl-core/jit/builtins/defs/_shared.d.ts +1 -5
  38. package/dist-browser/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +1 -2
  39. package/dist-browser/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +3 -3
  40. package/dist-browser/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +1 -1
  41. package/dist-browser/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +1 -1
  42. package/dist-browser/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +5 -2
  43. package/dist-browser/numbl-core/jit/builtins/defs/math/realsqrt.d.ts +6 -0
  44. package/dist-browser/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +0 -5
  45. package/dist-browser/numbl-core/jit/builtins/defs/shape/_construct.d.ts +0 -4
  46. package/dist-browser/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +2 -8
  47. package/dist-browser/numbl-core/jit/builtins/defs/system/deal.d.ts +4 -5
  48. package/dist-browser/numbl-core/jit/builtins/defs/system/feval.d.ts +7 -29
  49. package/dist-browser/numbl-core/jit/builtins/registry.d.ts +15 -30
  50. package/dist-browser/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
  51. package/dist-browser/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +4 -0
  52. package/dist-browser/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +45 -15
  53. package/dist-browser/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +5 -5
  54. package/dist-browser/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +6 -0
  55. package/dist-browser/numbl-core/jit/codegen/emit.d.ts +9 -30
  56. package/dist-browser/numbl-core/jit/codegen/emitJs.d.ts +9 -27
  57. package/dist-browser/numbl-core/jit/codegen/emitStmt.d.ts +8 -31
  58. package/dist-browser/numbl-core/jit/codegen/emitTensorFused.d.ts +10 -9
  59. package/dist-browser/numbl-core/jit/codegen/inlinePass.d.ts +39 -48
  60. package/dist-browser/numbl-core/jit/codegen/prettyIR.d.ts +1 -6
  61. package/dist-browser/numbl-core/jit/codegen/runtime.d.ts +7 -28
  62. package/dist-browser/numbl-core/jit/compileSpec.d.ts +3 -6
  63. package/dist-browser/numbl-core/jit/compileSpecC.d.ts +5 -0
  64. package/dist-browser/numbl-core/jit/lowering/assignedFlags.d.ts +24 -0
  65. package/dist-browser/numbl-core/jit/lowering/definiteAssign.d.ts +3 -1
  66. package/dist-browser/numbl-core/jit/lowering/errors.d.ts +3 -15
  67. package/dist-browser/numbl-core/jit/lowering/ir.d.ts +0 -2
  68. package/dist-browser/numbl-core/jit/lowering/lower.d.ts +4 -12
  69. package/dist-browser/numbl-core/jit/lowering/types.d.ts +2 -7
  70. package/dist-browser/numbl-core/jit/numbl/index.d.ts +5 -14
  71. package/dist-browser/numbl-core/jit/parser/index.d.ts +4 -9
  72. package/dist-browser/numbl-core/jit/workspace/workspace.d.ts +32 -136
  73. package/dist-browser/numbl-core/jitDeclineDiagnostics.d.ts +1 -1
  74. package/dist-browser/numbl-core/jsUserFunctions.d.ts +10 -12
  75. package/dist-browser/numbl-core/lowering/classInfo.d.ts +4 -1
  76. package/dist-browser/numbl-core/lowering/loweringContext.d.ts +15 -23
  77. package/dist-browser/numbl-core/native/lapack-bridge.d.ts +111 -130
  78. package/dist-browser/numbl-core/native/ts-lapack-bridge.d.ts +4 -5
  79. package/dist-browser/numbl-core/native/ts-lapack-complex.d.ts +23 -0
  80. package/dist-browser/numbl-core/native/ts-lapack-qr-lu.d.ts +37 -0
  81. package/dist-browser/numbl-core/native/wasm-lapack-bridge.d.ts +4 -5
  82. package/dist-browser/numbl-core/ops/dispatch.d.ts +4 -5
  83. package/dist-browser/numbl-core/parser/types.d.ts +1 -21
  84. package/{dist-lib/numbl-core/runtime → dist-browser/numbl-core/plotting}/axisCommand.d.ts +2 -2
  85. package/dist-browser/{graphics → numbl-core/plotting}/axisLimits.d.ts +14 -2
  86. package/dist-browser/numbl-core/plotting/builtins.d.ts +8 -0
  87. package/dist-browser/numbl-core/plotting/colormaps.d.ts +10 -0
  88. package/dist-browser/numbl-core/{runtime/plotBuiltinDispatch.d.ts → plotting/dispatch.d.ts} +14 -25
  89. package/dist-browser/numbl-core/plotting/imagescExtent.d.ts +19 -0
  90. package/dist-browser/numbl-core/{runtime/runtimePlot.d.ts → plotting/instructions.d.ts} +5 -17
  91. package/dist-browser/numbl-core/plotting/parseArgsChart.d.ts +94 -0
  92. package/dist-browser/numbl-core/plotting/parseArgsCommon.d.ts +64 -0
  93. package/dist-browser/numbl-core/plotting/parseArgsLine.d.ts +103 -0
  94. package/dist-browser/numbl-core/plotting/parseArgsPatch.d.ts +38 -0
  95. package/dist-browser/numbl-core/plotting/parseArgsQuiver.d.ts +32 -0
  96. package/dist-browser/numbl-core/plotting/parseArgsSurface.d.ts +75 -0
  97. package/dist-browser/numbl-core/plotting/streamline.d.ts +16 -0
  98. package/{dist-graphics/graphics → dist-browser/numbl-core/plotting}/types.d.ts +9 -7
  99. package/dist-browser/numbl-core/runtime/cow.d.ts +0 -8
  100. package/dist-browser/numbl-core/runtime/refcount.d.ts +0 -3
  101. package/dist-browser/numbl-core/runtime/registerSpecial.d.ts +15 -0
  102. package/dist-browser/numbl-core/runtime/runtime.d.ts +11 -35
  103. package/dist-browser/numbl-core/runtime/runtimeDispatch.d.ts +6 -0
  104. package/dist-browser/numbl-core/runtime/specialBuiltins.d.ts +3 -9
  105. package/dist-browser/numbl-core/runtime/uihtmlSession.d.ts +5 -13
  106. package/dist-browser/numbl-core/runtime/utils.d.ts +4 -1
  107. package/dist-browser/numbl-core/version.d.ts +1 -1
  108. package/dist-browser/numbl-core/workspace/workspace.d.ts +64 -0
  109. package/dist-browser/vfs/syncVfsChanges.d.ts +2 -2
  110. package/dist-cli/cli.js +74244 -80566
  111. package/dist-graphics/graphics/FigureView.d.ts +1 -1
  112. package/dist-graphics/graphics/SurfView.d.ts +3 -2
  113. package/dist-graphics/graphics/drawPlot.d.ts +1 -1
  114. package/dist-graphics/graphics/exportFigureHdf5.d.ts +1 -1
  115. package/dist-graphics/graphics/figureHashTransport.d.ts +1 -1
  116. package/dist-graphics/graphics/figureUpload.d.ts +1 -1
  117. package/dist-graphics/graphics/importFigureHdf5.d.ts +1 -1
  118. package/dist-graphics/graphics/openInFigureViewer.d.ts +1 -1
  119. package/dist-graphics/graphics/plotHelpers.d.ts +1 -1
  120. package/dist-graphics/graphics/plotLegend.d.ts +1 -1
  121. package/dist-graphics/graphics/plotMarkers.d.ts +1 -1
  122. package/dist-graphics/graphics/restoreNaNs.d.ts +1 -1
  123. package/dist-graphics/graphics/uihtmlRelay.d.ts +16 -0
  124. package/dist-graphics/graphics-lib.d.ts +3 -3
  125. package/dist-graphics/index.js +294 -328
  126. package/{dist-lib/graphics → dist-graphics/numbl-core/plotting}/axisLimits.d.ts +14 -2
  127. package/dist-graphics/numbl-core/plotting/colormaps.d.ts +10 -0
  128. package/dist-graphics/numbl-core/plotting/imagescExtent.d.ts +19 -0
  129. package/{dist-browser/graphics → dist-graphics/numbl-core/plotting}/types.d.ts +9 -7
  130. package/dist-lib/browser/mip.d.ts +17 -0
  131. package/dist-lib/cli-scan.d.ts +8 -1
  132. package/dist-lib/lib.d.ts +1 -1
  133. package/dist-lib/lib.js +29201 -35301
  134. package/dist-lib/node.js +22 -14
  135. package/dist-lib/numbl-core/execSession.d.ts +39 -0
  136. package/dist-lib/numbl-core/executeCode.d.ts +10 -1
  137. package/dist-lib/numbl-core/executors/classification.d.ts +2 -10
  138. package/dist-lib/numbl-core/executors/jit/backend.d.ts +65 -0
  139. package/dist-lib/numbl-core/executors/jit/cBackend.d.ts +22 -0
  140. package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +13 -44
  141. package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +24 -0
  142. package/dist-lib/numbl-core/executors/jit/jsBackend.d.ts +15 -0
  143. package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +13 -40
  144. package/dist-lib/numbl-core/executors/jit/session.d.ts +1 -1
  145. package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +13 -33
  146. package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +32 -48
  147. package/dist-lib/numbl-core/executors/lowering.d.ts +38 -96
  148. package/dist-lib/numbl-core/executors/plugins.d.ts +14 -28
  149. package/dist-lib/numbl-core/executors/registry.d.ts +32 -133
  150. package/dist-lib/numbl-core/executors/types.d.ts +30 -92
  151. package/dist-lib/numbl-core/functionResolve.d.ts +3 -13
  152. package/dist-lib/numbl-core/helpers/check-helpers.d.ts +0 -5
  153. package/dist-lib/numbl-core/helpers/glob.d.ts +14 -0
  154. package/dist-lib/numbl-core/helpers/linsolve.d.ts +3 -13
  155. package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +2 -4
  156. package/dist-lib/numbl-core/helpers/shape-utils.d.ts +10 -0
  157. package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +3 -1
  158. package/dist-lib/numbl-core/interpreter/builtins/time-system.d.ts +0 -1
  159. package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +7 -7
  160. package/dist-lib/numbl-core/interpreter/interpreter.d.ts +6 -6
  161. package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +9 -1
  162. package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
  163. package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +1 -5
  164. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +1 -2
  165. package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +3 -3
  166. package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +1 -1
  167. package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +1 -1
  168. package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +5 -2
  169. package/dist-lib/numbl-core/jit/builtins/defs/math/realsqrt.d.ts +6 -0
  170. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +0 -5
  171. package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +0 -4
  172. package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +2 -8
  173. package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +4 -5
  174. package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +7 -29
  175. package/dist-lib/numbl-core/jit/builtins/registry.d.ts +15 -30
  176. package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
  177. package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +4 -0
  178. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +45 -15
  179. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +5 -5
  180. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +6 -0
  181. package/dist-lib/numbl-core/jit/codegen/emit.d.ts +9 -30
  182. package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +9 -27
  183. package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +8 -31
  184. package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +10 -9
  185. package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +39 -48
  186. package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +1 -6
  187. package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +7 -28
  188. package/dist-lib/numbl-core/jit/compileSpec.d.ts +3 -6
  189. package/dist-lib/numbl-core/jit/compileSpecC.d.ts +5 -0
  190. package/dist-lib/numbl-core/jit/lowering/assignedFlags.d.ts +24 -0
  191. package/dist-lib/numbl-core/jit/lowering/definiteAssign.d.ts +3 -1
  192. package/dist-lib/numbl-core/jit/lowering/errors.d.ts +3 -15
  193. package/dist-lib/numbl-core/jit/lowering/ir.d.ts +0 -2
  194. package/dist-lib/numbl-core/jit/lowering/lower.d.ts +4 -12
  195. package/dist-lib/numbl-core/jit/lowering/types.d.ts +2 -7
  196. package/dist-lib/numbl-core/jit/numbl/index.d.ts +5 -14
  197. package/dist-lib/numbl-core/jit/parser/index.d.ts +4 -9
  198. package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +32 -136
  199. package/dist-lib/numbl-core/jitDeclineDiagnostics.d.ts +1 -1
  200. package/dist-lib/numbl-core/jsUserFunctions.d.ts +10 -12
  201. package/dist-lib/numbl-core/lowering/classInfo.d.ts +4 -1
  202. package/dist-lib/numbl-core/lowering/loweringContext.d.ts +15 -23
  203. package/dist-lib/numbl-core/native/lapack-bridge.d.ts +111 -130
  204. package/dist-lib/numbl-core/native/ts-lapack-bridge.d.ts +4 -5
  205. package/dist-lib/numbl-core/native/ts-lapack-complex.d.ts +23 -0
  206. package/dist-lib/numbl-core/native/ts-lapack-qr-lu.d.ts +37 -0
  207. package/dist-lib/numbl-core/native/wasm-lapack-bridge.d.ts +4 -5
  208. package/dist-lib/numbl-core/ops/dispatch.d.ts +4 -5
  209. package/dist-lib/numbl-core/parser/types.d.ts +1 -21
  210. package/{dist-browser/numbl-core/runtime → dist-lib/numbl-core/plotting}/axisCommand.d.ts +2 -2
  211. package/{dist-graphics/graphics → dist-lib/numbl-core/plotting}/axisLimits.d.ts +14 -2
  212. package/dist-lib/numbl-core/plotting/builtins.d.ts +8 -0
  213. package/dist-lib/numbl-core/plotting/colormaps.d.ts +10 -0
  214. package/dist-lib/numbl-core/{runtime/plotBuiltinDispatch.d.ts → plotting/dispatch.d.ts} +14 -25
  215. package/dist-lib/numbl-core/plotting/imagescExtent.d.ts +19 -0
  216. package/dist-lib/numbl-core/{runtime/runtimePlot.d.ts → plotting/instructions.d.ts} +5 -17
  217. package/dist-lib/numbl-core/plotting/parseArgsChart.d.ts +94 -0
  218. package/dist-lib/numbl-core/plotting/parseArgsCommon.d.ts +64 -0
  219. package/dist-lib/numbl-core/plotting/parseArgsLine.d.ts +103 -0
  220. package/dist-lib/numbl-core/plotting/parseArgsPatch.d.ts +38 -0
  221. package/dist-lib/numbl-core/plotting/parseArgsQuiver.d.ts +32 -0
  222. package/dist-lib/numbl-core/plotting/parseArgsSurface.d.ts +75 -0
  223. package/dist-lib/numbl-core/plotting/streamline.d.ts +16 -0
  224. package/dist-lib/{graphics → numbl-core/plotting}/types.d.ts +9 -7
  225. package/dist-lib/numbl-core/runtime/cow.d.ts +0 -8
  226. package/dist-lib/numbl-core/runtime/refcount.d.ts +0 -3
  227. package/dist-lib/numbl-core/runtime/registerSpecial.d.ts +15 -0
  228. package/dist-lib/numbl-core/runtime/runtime.d.ts +11 -35
  229. package/dist-lib/numbl-core/runtime/runtimeDispatch.d.ts +6 -0
  230. package/dist-lib/numbl-core/runtime/specialBuiltins.d.ts +3 -9
  231. package/dist-lib/numbl-core/runtime/uihtmlSession.d.ts +5 -13
  232. package/dist-lib/numbl-core/runtime/utils.d.ts +4 -1
  233. package/dist-lib/numbl-core/version.d.ts +1 -1
  234. package/dist-lib/numbl-core/workspace/workspace.d.ts +64 -0
  235. package/dist-lib/vfs/unzipToFiles.d.ts +7 -0
  236. package/dist-plot-viewer/assets/index-C0fIevlp.js +4504 -0
  237. package/dist-plot-viewer/index.html +1 -1
  238. package/dist-site-viewer/assets/index-BDaviCH6.js +4832 -0
  239. package/dist-site-viewer/assets/numbl-worker-D6m4K2PP.js +5691 -0
  240. package/dist-site-viewer/index.html +2 -2
  241. package/native/numbl_addon.cpp +2 -12
  242. package/native/numbl_addon_common.h +0 -5
  243. package/package.json +6 -5
  244. package/dist-browser/hooks/useProjectFiles.d.ts +0 -45
  245. package/dist-browser/numbl-core/executors/context.d.ts +0 -76
  246. package/dist-browser/numbl-core/executors/index.d.ts +0 -14
  247. package/dist-browser/numbl-core/executors/jit/cJitCallExecutor.d.ts +0 -35
  248. package/dist-browser/numbl-core/executors/jit/cJitLoopExecutor.d.ts +0 -31
  249. package/dist-browser/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +0 -29
  250. package/dist-browser/numbl-core/helpers/dummy.d.ts +0 -5
  251. package/dist-browser/numbl-core/jit/runtime/context.d.ts +0 -23
  252. package/dist-browser/numbl-core/jit/runtime/inferType.d.ts +0 -10
  253. package/dist-browser/numbl-core/jit/runtime/value.d.ts +0 -101
  254. package/dist-browser/numbl-core/jit/workspace/driverPrologue.d.ts +0 -59
  255. package/dist-browser/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +0 -62
  256. package/dist-browser/numbl-core/native/bridge-resolve.d.ts +0 -14
  257. package/dist-browser/numbl-core/runtime/plotUtils.d.ts +0 -336
  258. package/dist-browser/numbl-core/runtime/specialBuiltinNames.d.ts +0 -2
  259. package/dist-graphics/graphics/surfColormap.d.ts +0 -2
  260. package/dist-lib/numbl-core/executors/context.d.ts +0 -76
  261. package/dist-lib/numbl-core/executors/index.d.ts +0 -14
  262. package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +0 -35
  263. package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +0 -31
  264. package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +0 -29
  265. package/dist-lib/numbl-core/helpers/dummy.d.ts +0 -5
  266. package/dist-lib/numbl-core/jit/runtime/context.d.ts +0 -23
  267. package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +0 -10
  268. package/dist-lib/numbl-core/jit/runtime/value.d.ts +0 -101
  269. package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +0 -59
  270. package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +0 -62
  271. package/dist-lib/numbl-core/native/bridge-resolve.d.ts +0 -14
  272. package/dist-lib/numbl-core/runtime/plotUtils.d.ts +0 -336
  273. package/dist-lib/numbl-core/runtime/specialBuiltinNames.d.ts +0 -2
  274. package/dist-plot-viewer/assets/index-YeXWXIxH.js +0 -4504
  275. package/dist-site-viewer/assets/index-DrtkDG_M.js +0 -4832
  276. package/dist-site-viewer/assets/numbl-worker-Dz_Z8B9u.js +0 -5327
  277. package/native/elemwise.cpp +0 -360
  278. package/native/unary_elemwise.cpp +0 -67
  279. /package/dist-browser/{graphics → numbl-core/plotting}/figuresReducer.d.ts +0 -0
  280. /package/dist-graphics/{graphics → numbl-core/plotting}/figuresReducer.d.ts +0 -0
  281. /package/dist-lib/{graphics → numbl-core/plotting}/figuresReducer.d.ts +0 -0
@@ -5,20 +5,10 @@
5
5
  * If A is non-square, uses QR / LQ factorisation (dgels / dgeqrf+solve):
6
6
  * overdetermined (m > n): least-squares solution minimising ||A*X - B||₂
7
7
  * underdetermined (m < n): minimum-norm solution minimising ||X||₂
8
- *
9
- * Both the native LAPACK addon and the ts-lapack TypeScript fallback are
10
- * supported; the native addon is preferred when available.
11
- */
12
- /**
13
- * Dispatch linsolve to the native addon (preferred) or ts-lapack fallback.
14
- * Returns null only when neither bridge exposes `linsolve` (should not happen
15
- * in practice since ts-lapack always has it).
16
- */
17
- export declare function linsolveLapack(A: Float64Array, m: number, n: number, B: Float64Array, nrhs: number): Float64Array | null;
18
- /**
19
- * Dispatch complex linsolve to the native addon (preferred) or ts-lapack fallback.
20
- * The ts-lapack fallback throws — native addon is required for complex linsolve.
21
8
  */
9
+ /** Real A \ B through the LAPACK bridge. */
10
+ export declare function linsolveLapack(A: Float64Array, m: number, n: number, B: Float64Array, nrhs: number): Float64Array;
11
+ /** Complex A \ B through the LAPACK bridge. */
22
12
  export declare function linsolveComplexLapack(ARe: Float64Array, AIm: Float64Array, m: number, n: number, BRe: Float64Array, BIm: Float64Array, nrhs: number): {
23
13
  re: Float64Array;
24
14
  im: Float64Array;
@@ -34,9 +34,6 @@ export declare function logicalAlongDim(v: RuntimeTensor, dim: number, mode: "an
34
34
  /** Sum a sparse matrix along dim 1 (columns) or dim 2 (rows).
35
35
  * Returns sparse for dim=1, dense tensor for dim=2. */
36
36
  export declare function sparseSum(v: RuntimeSparseMatrix, dim: number): RuntimeValue;
37
- /** any/all on sparse matrix along a dimension.
38
- * Returns sparse for dim=1, dense for dim=2. */
39
- export declare function sparseAnyAll(v: RuntimeSparseMatrix, dim: number, mode: "any" | "all"): RuntimeValue;
40
37
  /** Type check for reductions that return Num without dim arg, Tensor with dim arg. */
41
38
  /** Strip trailing 'omitnan'/'includenan' from args. Returns cleaned args and flag. */
42
39
  export declare function parseNanFlag(args: RuntimeValue[]): {
@@ -62,5 +59,6 @@ export declare function sliceKernel(sliceFn: (slice: ArrayLike<number>) => numbe
62
59
  export declare function accumKernelOmitNaN(reduceFn: (acc: number, val: number) => number, initial: number, finalizeFn?: (acc: number, count: number) => number): ReductionKernel;
63
60
  /** Create a slice kernel that filters NaN before applying the function. */
64
61
  export declare function sliceKernelOmitNaN(sliceFn: (slice: ArrayLike<number>) => number): ReductionKernel;
65
- /** Helper: extract all numeric values from a RuntimeValue as a plain array. */
62
+ /** The values of a numeric or logical scalar or array as a plain array (real
63
+ * parts only). Errors for other types. */
66
64
  export declare function toNumArray(v: RuntimeValue, name: string): number[];
@@ -5,3 +5,13 @@ import { type RuntimeValue } from "../runtime/index.js";
5
5
  import { type RuntimeTensor } from "../runtime/types.js";
6
6
  /** Promote a scalar (number, logical, complex) to a 1×1 tensor. Tensors pass through. */
7
7
  export declare function coerceToTensor(v: RuntimeValue, name: string): RuntimeTensor;
8
+ /** Validate one dimension value: MATLAB rejects NaN, Inf, and non-integer
9
+ * sizes; negative integers are silently clamped to 0. */
10
+ export declare function validateDim(x: number): number;
11
+ /** Extract a single scalar dimension. With multiple size args MATLAB requires
12
+ * each to be a scalar — a 1×1 array counts, but a multi-element vector errors
13
+ * with "Size inputs must be scalar." */
14
+ export declare function toScalarDim(v: RuntimeValue): number;
15
+ /** Parse shape arguments: zeros(2,3) or zeros([2,3]) -> [2, 3].
16
+ * Negative dimensions are clamped to 0. */
17
+ export declare function parseShapeArgs(args: RuntimeValue[]): number[];
@@ -36,6 +36,8 @@ import "./misc.js";
36
36
  import "./dictionary.js";
37
37
  import "./hash.js";
38
38
  import "./help-text.js";
39
- export { getIBuiltin, getIBuiltinHelp, getIBuiltinNargin, getAllIBuiltinNames, registerBuiltinHelp, inferJitType, } from "./types.js";
39
+ export { getIBuiltin, getIBuiltinHelp, getIBuiltinNargin, getAllIBuiltinNames, registerBuiltinHelp, inferJitType, inferDispatchType, } from "./types.js";
40
40
  export type { IBuiltin, IBuiltinResolution, BuiltinHelp } from "./types.js";
41
41
  export { resetAppdataStore, convertJsonValue } from "./misc.js";
42
+ import "../../runtime/specialBuiltins.js";
43
+ import "../../plotting/builtins.js";
@@ -3,4 +3,3 @@
3
3
  * ismac, ispc, isunix.
4
4
  */
5
5
  export declare function getTicTime(): number;
6
- export declare function setTicTime(ms: number): void;
@@ -20,16 +20,16 @@ export interface IBuiltin {
20
20
  }
21
21
  export declare function getIBuiltin(name: string): IBuiltin | undefined;
22
22
  export declare function registerIBuiltin(b: IBuiltin): void;
23
- /** Register a dynamic IBuiltin (e.g. .js user functions), replacing any
24
- * existing entry with the same name without error. */
25
- export declare function registerDynamicIBuiltin(b: IBuiltin): void;
26
- export declare function unregisterIBuiltin(name: string): void;
27
23
  export declare function getAllIBuiltinNames(): string[];
28
24
  export declare function getIBuiltinHelp(name: string): BuiltinHelp | undefined;
29
25
  export declare function registerBuiltinHelp(name: string, help: BuiltinHelp): void;
30
26
  /** Probe an IBuiltin to determine its nargin (number of input args).
31
27
  * Tries resolve with 1, 2, 3 number-type args to find the accepted count. */
32
28
  export declare function getIBuiltinNargin(name: string): number | undefined;
29
+ /** Builtin dispatch only looks at the kind and class of a struct or object
30
+ * argument, never its field types, so it skips the walk over the fields
31
+ * that the JIT's specialization needs. */
32
+ export declare function inferDispatchType(value: unknown): JitType;
33
33
  export declare function inferJitType(value: unknown): JitType;
34
34
  export declare function mkc(re: number, im: number): number | RuntimeComplexNumber;
35
35
  export declare function makeTensor(data: Float64Array, imag: Float64Array | undefined, shape: number[]): RuntimeTensor;
@@ -83,9 +83,9 @@ interface UnaryElemwiseSpec {
83
83
  };
84
84
  /** Use applyUnaryElemwiseMaybeComplex instead of applyUnaryElemwise */
85
85
  maybeComplex?: boolean;
86
- /** Opcode for the native unaryElemwise dispatch (see unary_elemwise.cpp).
87
- * Used by the maybeComplex path so that e.g. sqrt/log can run in native C
88
- * on the common all-in-domain case, then fall back for NaN entries only. */
86
+ /** OpUnary code for the tensor-ops dispatch. Used by the maybeComplex path
87
+ * so that e.g. sqrt/log can run in native C on the common all-in-domain
88
+ * case, then fall back for NaN entries only. */
89
89
  nativeOpCode?: number;
90
90
  }
91
91
  /** Generate cases for a unary element-wise builtin. Each accepted kind gets
@@ -72,6 +72,10 @@ export declare class Interpreter {
72
72
  * post-loop liveness scan can't see reads after the enclosing block —
73
73
  * the classifier must then keep every loop-assigned name live-out. */
74
74
  condBlockDepth: number;
75
+ /** @internal Number of enclosing `try` bodies being executed, across
76
+ * calls. The C-JIT declines while it is non-zero: a runtime error in
77
+ * compiled C exits the process, so it can't be caught. */
78
+ tryDepth: number;
75
79
  /** @internal */
76
80
  functionDefCache: Map<string, FunctionDef>;
77
81
  /** @internal Pre-built line break tables for offset→line lookup per file. */
@@ -103,11 +107,6 @@ export declare class Interpreter {
103
107
  /** Bridge for loading native shared libraries. Undefined in browser
104
108
  * contexts. */
105
109
  nativeBridge?: import("../workspace/types.js").NativeBridge;
106
- /** Telemetry: invoked after a registered executor's `run()` succeeds.
107
- * Used to track which optimizers fire in a session. The kind is the
108
- * LoweredStmt kind the executor handled ("top-level", "loop", "call",
109
- * ...). Hot path — keep the callback cheap. */
110
- onExecutorFired?: (name: string, kind: string) => void;
111
110
  /** Verbose log sink (plumbed from ExecOptions.log). */
112
111
  log?: (message: string) => void;
113
112
  /** Executor registry. Holds the strategies (JS-JIT, C-kernel, ...)
@@ -207,6 +206,7 @@ export declare class Interpreter {
207
206
  propertyDefaults: Map<string, Expr>;
208
207
  };
209
208
  isHandleClass: (classInfo: ClassInfo) => boolean;
210
- evalInLocalScope: (codeArg: unknown, fileName?: string) => unknown;
209
+ evalPropertyDefault: (className: string, propName: string, defaultExpr: Expr) => RuntimeValue;
210
+ evalInLocalScope: (codeArg: unknown, fileName?: string, nargout?: number) => unknown;
211
211
  processArgumentsBlocks: (fn: FunctionDef, args: unknown[]) => void;
212
212
  }
@@ -49,12 +49,20 @@ export declare function findFunctionInWorkspaceFile(this: Interpreter, wsName: s
49
49
  export declare function findFunctionInClassFile(this: Interpreter, className: string, funcName: string, methodScope?: string): FunctionDef | null;
50
50
  export declare function findMethodInClass(this: Interpreter, classInfo: ClassInfo, methodName: string): FunctionDef | null;
51
51
  export declare function findExternalMethod(this: Interpreter, classInfo: ClassInfo, methodName: string): FunctionDef | null;
52
+ /** Evaluate a property's default value expression. MATLAB reports an
53
+ * invalid default as an error rather than leaving the property unset. */
54
+ export declare function evalPropertyDefault(this: Interpreter, className: string, propName: string, defaultExpr: Expr): RuntimeValue;
52
55
  export declare function collectClassProperties(this: Interpreter, classInfo: ClassInfo): {
53
56
  propertyNames: string[];
54
57
  propertyDefaults: Map<string, Expr>;
55
58
  };
56
59
  export declare function isHandleClass(this: Interpreter, classInfo: ClassInfo): boolean;
57
- export declare function evalInLocalScope(this: Interpreter, codeArg: unknown, fileName?: string): unknown;
60
+ /** Run MATLAB text in the current scope (eval, evalin, run, input,
61
+ * str2num). With `nargout` > 0 the text must be one expression, whose
62
+ * value(s) are returned; otherwise its statements run (displaying
63
+ * unsuppressed results) and nothing is returned. `fileName` sets the file
64
+ * context, e.g. for `run(script)`. */
65
+ export declare function evalInLocalScope(this: Interpreter, codeArg: unknown, fileName?: string, nargout?: number): unknown;
58
66
  /**
59
67
  * Apply `arguments`-block defaults and build name-value struct parameters,
60
68
  * binding the results into the *current* function environment.
@@ -9,7 +9,7 @@ export interface InterpreterContext {
9
9
  setEnv: (env: Environment) => void;
10
10
  callerEnv: Environment | undefined;
11
11
  workspaceEnv: Environment | undefined;
12
- evalInLocalScope: (codeArg: unknown, fileName?: string) => unknown;
12
+ evalInLocalScope: (codeArg: unknown, fileName?: string, nargout?: number) => unknown;
13
13
  callFunction: (name: string, args: unknown[], nargout: number) => unknown;
14
14
  rt: Runtime;
15
15
  /** Optimization mode: "0" = no JIT, "1" = JS-JIT, "2" = C-JIT. */
@@ -18,8 +18,8 @@ export interface InterpreterContext {
18
18
  * or undefined if no workspace file provides that name.
19
19
  * `kind` distinguishes a regular .m function from a .numbl.js
20
20
  * user function (treated as a MEX-equivalent) or a class file.
21
- * `source` is the raw .m source for "function"/"class" kinds, or empty
22
- * for "jsfunction" (where the implementation is JS, not .m text). */
21
+ * `source` is the raw .m source for "function"/"class" kinds, or the
22
+ * help text registered by a "jsfunction" (empty if none). */
23
23
  lookupWorkspaceFile: (name: string) => {
24
24
  path: string;
25
25
  kind: "function" | "jsfunction" | "class";
@@ -29,6 +29,9 @@ export interface InterpreterContext {
29
29
  * ones, in declaration order. Returns undefined if `className` is not a
30
30
  * known class. Backs `properties(obj)`. */
31
31
  classPublicProperties: (className: string) => string[] | undefined;
32
+ /** Public method names of a class (including inherited, static and the
33
+ * constructor), or undefined if not a known class. Backs `ismethod`. */
34
+ classPublicMethods: (className: string) => Set<string> | undefined;
32
35
  }
33
36
  export declare const FALL_THROUGH: unique symbol;
34
37
  export type InterpreterSpecialBuiltinHandler = (ctx: InterpreterContext, args: unknown[], nargout: number) => unknown | typeof FALL_THROUGH;
@@ -2,7 +2,7 @@
2
2
  * Helpers shared across multiple builtin files.
3
3
  */
4
4
  import type { Span } from "../../parser/index.js";
5
- import { type Type, type NumericType } from "../../lowering/types.js";
5
+ import { type Type } from "../../lowering/types.js";
6
6
  export declare function requireScalarRealDouble(t: Type, what: string, span?: Span): void;
7
7
  /** Like `requireScalarRealDouble` but accepts non-scalar real doubles
8
8
  * (the elemwise path). Logical also accepted (stored as double in C). */
@@ -37,7 +37,3 @@ export declare function exactScalarAsComplex(t: Type): {
37
37
  re: number;
38
38
  im: number;
39
39
  } | undefined;
40
- /** True when this numeric is statically known to be complex (the static
41
- * flag, not the runtime value). Centralizes the predicate so callers
42
- * don't sprinkle `(t as NumericType).isComplex` checks. */
43
- export declare function isStaticComplex(t: Type): t is NumericType;
@@ -59,8 +59,7 @@ export declare function broadcastFoldExact(a: NumericType, b: NumericType, outSh
59
59
  * `complexFold` / `complexScalarExpr` / `complexRuntimeDeps` are
60
60
  * optional; when set, a scalar+scalar op with at least one complex
61
61
  * operand routes through them (and `transfer` returns a complex
62
- * result). Phase 1 wires complex scalars; tensor+complex paths are
63
- * rejected until Phase 3 lands the runtime helpers.
62
+ * result).
64
63
  */
65
64
  export declare function defineElemwiseRealBinary(opts: {
66
65
  name: string;
@@ -5,9 +5,9 @@ interface ComplexPredSpec {
5
5
  * to `1.0` / `0.0`. */
6
6
  cScalarComplex: (re: string, im: string) => string;
7
7
  /** JS scalar expression: same shape as `cScalarComplex` but for
8
- * the js-aot path; operates on real-and-imag JS expressions. */
8
+ * the JS path; operates on real-and-imag JS expressions. */
9
9
  jsScalarComplex: (re: string, im: string) => string;
10
- /** JS fold / interpreter rule on a `{re, im}` value. */
10
+ /** JS fold rule on a `{re, im}` value. */
11
11
  jsFnComplex: (re: number, im: number) => boolean;
12
12
  /** Runtime tensor helper name (in `tensor_predicate_complex.h`). */
13
13
  tensorHelperComplex: string;
@@ -18,7 +18,7 @@ export interface UnaryPredOpts {
18
18
  cScalar: (arg: string) => string;
19
19
  /** JS scalar expression given the arg's JS text. */
20
20
  jsScalar: (arg: string) => string;
21
- /** JS fold / interpreter rule. */
21
+ /** JS fold rule. */
22
22
  jsFn: (x: number) => boolean;
23
23
  /** Runtime tensor helper name (in `tensor_predicate.h`). */
24
24
  tensorHelper: string;
@@ -5,7 +5,7 @@
5
5
  * cell-element type being `char` (matches MATLAB and the
6
6
  * interpreter, which also emits chars).
7
7
  *
8
- * Interpreter-only for now; the AOT path would need to materialize
8
+ * Interpreter-only for now; the JIT would need to materialize
9
9
  * a heterogeneous-len cell of chars which is a different feature
10
10
  * class. The `emitC` / `emitJs` hooks exist so the registry-shape
11
11
  * invariant holds but they raise `UnsupportedConstruct` rather than
@@ -7,7 +7,7 @@
7
7
  * error; the inputs simply compare unequal.
8
8
  * - Either arg non-text → `false`. Numbl gates the comparison
9
9
  * behind `isText(a) && isText(b)`; non-text just yields `0`
10
- * silently. We mirror that to keep cross-runner output identical.
10
+ * silently. We mirror that.
11
11
  * - Cell-of-text vectorization (`strcmp({'a','b'}, 'a')`) is in
12
12
  * numbl but cells aren't yet a feature class in mtoc2 — that
13
13
  * overload will fall out naturally when cells land.
@@ -5,8 +5,7 @@ export interface UnaryRealMathOpts {
5
5
  name: string;
6
6
  /** C `<math.h>` function name for the scalar path (e.g. `"cos"`). */
7
7
  cFnReal: string;
8
- /** JS-side scalar fn for compile-time fold (and for the interpreter's
9
- * `call` hook). */
8
+ /** JS-side scalar fn for compile-time fold. */
10
9
  jsFn: (x: number) => number;
11
10
  /** Optional JS expression form (textual) for `emitJs`'s scalar real
12
11
  * path. Defaults to `Math.${name}(arg)` which works for most names
@@ -14,6 +13,10 @@ export interface UnaryRealMathOpts {
14
13
  * Override for `fix` (`Math.trunc`) and `round`
15
14
  * (custom half-away-from-zero form). */
16
15
  jsExpr?: (arg: string) => string;
16
+ /** Optional `mtoc2_`-prefixed helper from `tensor_unary_real_math.js`
17
+ * for `emitJs`'s scalar real path. Activates that snippet and takes
18
+ * precedence over `jsExpr`. */
19
+ jsFnReal?: string;
17
20
  /** Sign refinement on the result type. Called with the (validated)
18
21
  * real-numeric input type. */
19
22
  signRule: (t: NumericType) => Sign;
@@ -0,0 +1,6 @@
1
+ /** `realsqrt(x)`: square root that stays real. Unlike `sqrt`, an input
2
+ * of unknown sign stays on the real path; a negative element raises
3
+ * MATLAB's error at run time instead of lifting to complex. An input
4
+ * known to be negative (sign or exact value) declines, so the
5
+ * interpreter raises the error. */
6
+ export declare const realsqrt: import("../../registry.js").Builtin;
@@ -103,11 +103,6 @@ export declare function reductionEmitJs(spec: {
103
103
  dimArgIndex: 1 | 2;
104
104
  outputElem: "double" | "logical";
105
105
  }): Builtin["emitJs"];
106
- export declare function reductionCall(spec: {
107
- name: string;
108
- dimArgIndex: 1 | 2;
109
- outputElem: "double" | "logical";
110
- }): Builtin["call"];
111
106
  export declare function reductionEmit(spec: {
112
107
  name: string;
113
108
  dimArgIndex: 1 | 2;
@@ -25,10 +25,6 @@
25
25
  * time gives a proper span.
26
26
  */
27
27
  import type { Builtin, InlineSnippet } from "../../registry.js";
28
- /** Runtime dim validation for the interpreter-shim `call` path —
29
- * mirrors the emitted `mtoc2_check_dim` and the interpreter's
30
- * `validateDim`: reject non-finite / non-integer, clamp negative to 0. */
31
- export declare function checkDimRuntime(x: number): number;
32
28
  /** Runtime dim validator shared by both backends. Mirrors the
33
29
  * interpreter's `validateDim` (interpreter/builtins/array-construction.ts):
34
30
  * a non-finite or non-integer size is an error, a negative size clamps
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * - argument validation (1..2 args, real-double tensor, k literal int)
7
7
  * - `transfer` (exact-fold when input data fits)
8
- * - hooks builders (emitC / emitJs / call) parameterized by the
8
+ * - hooks builders (emitC / emitJs) parameterized by the
9
9
  * family-specific predicate + runtime helper.
10
10
  *
11
11
  * Mirrors `triPart` in numbl's
@@ -13,8 +13,6 @@
13
13
  * both supported; sparse inputs and rank > 2 are deferred / rejected.
14
14
  */
15
15
  import type { Builtin } from "../../registry.js";
16
- import type { RuntimeTensor } from "../../../runtime/value.js";
17
- import { mtoc2_tensor_triu as jsTriu, mtoc2_tensor_tril as jsTril, mtoc2_tensor_triu_complex as jsTriuComplex, mtoc2_tensor_tril_complex as jsTrilComplex } from "../../runtime/snippets.gen.js";
18
16
  interface TriangularSpec {
19
17
  /** Source-level name (registry key). */
20
18
  name: string;
@@ -25,10 +23,6 @@ interface TriangularSpec {
25
23
  cHelperComplex: string;
26
24
  /** Keep predicate matching numbl's `triPart` (column-major i,j). */
27
25
  keep(i: number, j: number, k: number): boolean;
28
- /** JS-side helper for real input. */
29
- jsHelper: (a: RuntimeTensor, k: number) => unknown;
30
- /** JS-side helper for complex input. */
31
- jsHelperComplex: (a: RuntimeTensor, k: number) => unknown;
32
26
  }
33
27
  export declare function defineTriangular(spec: TriangularSpec): Builtin;
34
- export { jsTriu, jsTril, jsTriuComplex, jsTrilComplex };
28
+ export {};
@@ -10,11 +10,10 @@
10
10
  * it's a runtime error. mtoc2 lifts the equality check into
11
11
  * `transfer` so the mismatch is a type-time error.
12
12
  *
13
- * The result types are the input types as-is. The c-aot backend
14
- * still has to emit `_copy(...)` for owned types to satisfy the
15
- * "freshly-owned at every consume site" invariant; the js-aot
16
- * backend uses `mtoc2_deep_clone` for the same reason; the
17
- * interpreter follows numbl and deep-clones owned values too.
13
+ * The result types are the input types as-is. The C backend still
14
+ * has to emit `_copy(...)` for owned types to satisfy the
15
+ * "freshly-owned at every consume site" invariant; the JS backend
16
+ * uses `mtoc2_deep_clone` for the same reason.
18
17
  */
19
18
  import type { Builtin } from "../../registry.js";
20
19
  export declare const deal: Builtin;
@@ -2,35 +2,13 @@
2
2
  * feval(handle_or_name, args...) — invoke a function handle (or a
3
3
  * function named by a char) with the given args.
4
4
  *
5
- * Implementation strategy:
6
- *
7
- * The c-aot / js-aot backends cannot route through a builtin
8
- * emitC / emitJs hook because invoking a user function requires
9
- * specialization (the target's mangled C name is created at
10
- * lowering time, with the actual arg types) — information a
11
- * builtin emit hook doesn't have access to. So the lowerer
12
- * intercepts `feval(...)` in `lowerFuncCall` and
13
- * `lowerMultiAssign` and rewrites it to a direct call on the
14
- * underlying handle / function name (see `tryLowerFevalCall` in
15
- * `src/lowering/lowerFuncCall.ts`). Once the rewrite fires, the
16
- * builtin's emit hooks are never reached.
17
- *
18
- * The interpreter parallels this with a special-case in
19
- * `callByName` (next to the existing `struct` / `cell`
20
- * special-cases) — it consumes args[0] as a handle or char,
21
- * dispatches via `callHandle` or recursively via `callByName`,
22
- * and threads `nargout` through. Once that fires, this builtin's
23
- * `call` hook is unreachable.
24
- *
25
- * This file therefore exists primarily to:
26
- * - keep `feval` in `allBuiltinNames()` for syntax highlighting
27
- * and the `@feval` rejection path,
28
- * - validate arity / argument shape via `transfer` as a safety
29
- * net if a future codepath bypasses the lowerer / interpreter
30
- * interception.
31
- *
32
- * All four hooks raise `UnsupportedConstruct` with a message
33
- * pointing the reader at where the real implementation lives.
5
+ * The lowerer intercepts `feval(...)` in `lowerFuncCall` and
6
+ * `lowerMultiAssign` and rewrites it to a direct call on the
7
+ * underlying handle / function name (see `tryLowerFevalCall`), since
8
+ * invoking a user function needs specialization that a builtin emit
9
+ * hook can't do. This def exists to keep `feval` in
10
+ * `allBuiltinNames()` and as a safety net: every hook raises
11
+ * `UnsupportedConstruct`.
34
12
  */
35
13
  import type { Builtin } from "../../registry.js";
36
14
  export declare const feval: Builtin;
@@ -1,8 +1,7 @@
1
1
  /**
2
- * Builtin registry — the contract every mtoc2 builtin (and future
3
- * user `.mtoc2.js` function) implements.
2
+ * Builtin registry — the contract every JIT builtin implements.
4
3
  *
5
- * Each builtin can supply up to three mirrored hooks plus the
4
+ * Each builtin can supply two mirrored codegen hooks plus the
6
5
  * always-required `transfer`:
7
6
  *
8
7
  * transfer(argTypes, nargout) — required. Given input types and
@@ -32,15 +31,9 @@
32
31
  * outputs land in these locals via the framework's destructuring
33
32
  * wrapper. Activates JS-side runtime snippets via `useRuntime`.
34
33
  *
35
- * call({args, argTypes, nargout, ctx}) — optional. Direct JS
36
- * function used by the interpreter and as a JIT bailout target.
37
- * Returns one runtime value per output slot. The args shape
38
- * mirrors the emit hooks' shape so dispatch on `argTypes` /
39
- * `nargout` stays parallel across all three.
40
- *
41
- * elementwise? — when true, every defined emit hook (and `call`)
42
- * must also produce a correct scalar output when called with
43
- * scalar argTypes and scalar argsC/argsJs/args. The framework
34
+ * elementwise? — when true, every defined emit hook must also
35
+ * produce a correct scalar output when called with
36
+ * scalar argTypes and scalar argsC/argsJs. The framework
44
37
  * uses this for same-shape tensor fusion (and, later, broadcast
45
38
  * / reduction-inner / mask / stencil fusion). Absence = "do not
46
39
  * fuse me; use the regular emit on the full tensor types."
@@ -50,8 +43,6 @@
50
43
  * computes the maximum compatible backend per call site.
51
44
  */
52
45
  import type { Type } from "../lowering/types.js";
53
- import type { RuntimeValue } from "../runtime/value.js";
54
- import type { RuntimeContext } from "../runtime/context.js";
55
46
  /** Common across every hook — the type-level call descriptor. */
56
47
  interface CommonArgs {
57
48
  /** Per-arg type (after lowering / inference). */
@@ -71,7 +62,7 @@ export interface EmitCArgs extends CommonArgs {
71
62
  outArgsC?: string[];
72
63
  /** Activate a runtime C snippet on the current translation unit.
73
64
  * See `runtime.ts` for the registry and `InlineSnippet` for the
74
- * user-supplied form. */
65
+ * inline form. */
75
66
  useRuntime(spec: string | InlineSnippet): void;
76
67
  }
77
68
  export interface EmitJsArgs extends CommonArgs {
@@ -90,14 +81,6 @@ export interface EmitJsArgs extends CommonArgs {
90
81
  * (with a `jsCode` body) defines a one-off helper from a builtin. */
91
82
  useRuntime(spec: string | InlineSnippet): void;
92
83
  }
93
- export interface CallArgs extends CommonArgs {
94
- /** Per-arg runtime values, evaluated by the interpreter at the
95
- * call site. */
96
- args: RuntimeValue[];
97
- /** Host bag — `helpers.write` for stdout, future hooks for plot /
98
- * error / time. */
99
- ctx: RuntimeContext;
100
- }
101
84
  export interface Builtin {
102
85
  /** Source-level name (registry key). */
103
86
  name: string;
@@ -109,13 +92,18 @@ export interface Builtin {
109
92
  emitC?(args: EmitCArgs): string;
110
93
  /** Optional: JS codegen. */
111
94
  emitJs?(args: EmitJsArgs): string;
112
- /** Optional: direct JS function — interpreter / JIT bailout. */
113
- call?(args: CallArgs): RuntimeValue[];
114
95
  /** Elementwise = result is computed pointwise. */
115
96
  elementwise?: boolean;
97
+ /** Optional: elementwise for these argument types only, for a builtin
98
+ * whose forms differ by arity (two-argument `max(a, b)` is pointwise,
99
+ * one-argument `max(a)` is a reduction). Consulted when `elementwise`
100
+ * is not set. */
101
+ isElementwiseCall?(argTypes: Type[]): boolean;
116
102
  }
117
- /** Inline-defined runtime snippet supplied by a user `.mtoc2.js`
118
- * builtin's `emitC` / `emitJs`. Re-exported from `runtime.ts` — kept
103
+ /** Whether a call of `b` with these argument types is computed pointwise. */
104
+ export declare function isElementwiseCall(b: Builtin, argTypes: Type[]): boolean;
105
+ /** Inline-defined runtime snippet supplied by an emitter via
106
+ * `useRuntime({...})`. Re-exported from `runtime.ts` — kept
119
107
  * here for doc-locality with the `Builtin` contract. */
120
108
  export interface InlineSnippet {
121
109
  name: string;
@@ -130,9 +118,6 @@ export declare function registerBuiltin(b: Builtin): void;
130
118
  export declare function getBuiltin(name: string): Builtin | undefined;
131
119
  /** Names of every registered builtin. Drives Monaco syntax highlighting. */
132
120
  export declare function allBuiltinNames(): readonly string[];
133
- export type Backend = "c" | "js" | "interpreter";
134
- export declare function builtinSupports(b: Builtin, backend: Backend): boolean;
135
121
  export declare function requireEmitC(b: Builtin): (args: EmitCArgs) => string;
136
122
  export declare function requireEmitJs(b: Builtin): (args: EmitJsArgs) => string;
137
- export declare function requireCall(b: Builtin): (args: CallArgs) => RuntimeValue[];
138
123
  export {};
@@ -2,3 +2,7 @@ export function mtoc2_cdiv(a: any, b: any): {
2
2
  re: number;
3
3
  im: number;
4
4
  };
5
+ export function mtoc2_cdiv_mixed(a: any, b: any): {
6
+ re: number;
7
+ im: number;
8
+ };
@@ -16,6 +16,10 @@ export function mtoc2_cmul(a: any, b: any): {
16
16
  re: number;
17
17
  im: number;
18
18
  };
19
+ export function mtoc2_cmul_mixed(a: any, b: any): {
20
+ re: number;
21
+ im: number;
22
+ };
19
23
  export function mtoc2_cneg(z: any): {
20
24
  re: number;
21
25
  im: number;