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
@@ -4,10 +4,10 @@
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/svg+xml" href="./favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>numbl project</title>
7
+ <title>numbl</title>
8
8
  <!-- numbl:base -->
9
9
  <script src="./coi-serviceworker.js"></script>
10
- <script type="module" crossorigin src="./assets/index-DrtkDG_M.js"></script>
10
+ <script type="module" crossorigin src="./assets/index-BDaviCH6.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="./assets/index-D5YY8PKx.css">
12
12
  </head>
13
13
  <body>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * numbl native addon — LAPACK/BLAS, FFT, element-wise arithmetic, and more.
2
+ * numbl native addon — LAPACK/BLAS, FFT, tensor ops, and more.
3
3
  *
4
4
  * Exported functions (see individual .cpp files for full documentation):
5
5
  *
@@ -33,7 +33,7 @@ extern "C" {
33
33
  // ── Addon version ────────────────────────────────────────────────────────────
34
34
  // Bump this integer whenever the addon's API changes (new functions, signature
35
35
  // changes, etc.) so that the JS side can detect stale builds.
36
- static const int ADDON_VERSION = 9;
36
+ static const int ADDON_VERSION = 10;
37
37
 
38
38
  // ── New tensor-ops layer (native/ops/) ───────────────────────────────────────
39
39
  Napi::Value TensorOpRealBinary(const Napi::CallbackInfo& info);
@@ -124,18 +124,8 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
124
124
  Napi::Function::New(env, Fft1dComplex));
125
125
  exports.Set(Napi::String::New(env, "fftAlongDim"),
126
126
  Napi::Function::New(env, FftAlongDim));
127
- exports.Set(Napi::String::New(env, "elemwise"),
128
- Napi::Function::New(env, Elemwise));
129
- exports.Set(Napi::String::New(env, "elemwiseScalar"),
130
- Napi::Function::New(env, ElemwiseScalar));
131
- exports.Set(Napi::String::New(env, "elemwiseComplex"),
132
- Napi::Function::New(env, ElemwiseComplex));
133
- exports.Set(Napi::String::New(env, "elemwiseComplexScalar"),
134
- Napi::Function::New(env, ElemwiseComplexScalar));
135
127
  exports.Set(Napi::String::New(env, "fillRandn"),
136
128
  Napi::Function::New(env, FillRandn));
137
- exports.Set(Napi::String::New(env, "unaryElemwise"),
138
- Napi::Function::New(env, UnaryElemwise));
139
129
  exports.Set(Napi::String::New(env, "gmres"),
140
130
  Napi::Function::New(env, Gmres));
141
131
  exports.Set(Napi::String::New(env, "gmresComplex"),
@@ -319,11 +319,6 @@ Napi::Value QzComplex(const Napi::CallbackInfo& info);
319
319
  Napi::Value Fft1d(const Napi::CallbackInfo& info);
320
320
  Napi::Value Fft1dComplex(const Napi::CallbackInfo& info);
321
321
  Napi::Value FftAlongDim(const Napi::CallbackInfo& info);
322
- Napi::Value Elemwise(const Napi::CallbackInfo& info);
323
- Napi::Value ElemwiseScalar(const Napi::CallbackInfo& info);
324
- Napi::Value ElemwiseComplex(const Napi::CallbackInfo& info);
325
- Napi::Value ElemwiseComplexScalar(const Napi::CallbackInfo& info);
326
322
  Napi::Value FillRandn(const Napi::CallbackInfo& info);
327
- Napi::Value UnaryElemwise(const Napi::CallbackInfo& info);
328
323
  Napi::Value Gmres(const Napi::CallbackInfo& info);
329
324
  Napi::Value GmresComplex(const Napi::CallbackInfo& info);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numbl",
3
- "version": "0.4.21",
3
+ "version": "0.4.22",
4
4
  "description": "Run .m source files in the browser and on the command line by compiling to JavaScript",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  "numerical-computing"
17
17
  ],
18
18
  "engines": {
19
- "node": ">=18"
19
+ "node": ">=18.7"
20
20
  },
21
21
  "main": "dist-lib/lib.js",
22
22
  "types": "dist-lib/lib.d.ts",
@@ -79,6 +79,7 @@
79
79
  "test:coverage": "vitest run --coverage",
80
80
  "test:coverage:all": "bash scripts/coverage-all.sh",
81
81
  "test:scripts": "bash numbl_test_scripts/run_all.sh",
82
+ "test:scripts:c": "tsx src/cli.ts run-tests numbl_test_scripts --opt 2",
82
83
  "jit-parity": "node jit_parity/run.mjs",
83
84
  "test:browser": "playwright test",
84
85
  "build:wasm": "bash numbl_test_scripts/build_wasm.sh",
@@ -93,7 +94,6 @@
93
94
  "fflate": "^0.8.2",
94
95
  "h5wasm": "^0.10.3",
95
96
  "node-addon-api": "^8.3.0",
96
- "pako": "^2.1.0",
97
97
  "qhull-wasm": "^0.0.1",
98
98
  "react-markdown": "^10.1.0",
99
99
  "react-syntax-highlighter": "^16.1.1",
@@ -121,13 +121,13 @@
121
121
  "@mui/material": "^7.3.7",
122
122
  "@playwright/test": "^1.59.1",
123
123
  "@types/node": "^24.10.1",
124
- "@types/pako": "^2.0.4",
125
124
  "@types/react": "^19.2.5",
126
125
  "@types/react-dom": "^19.2.3",
127
126
  "@types/react-syntax-highlighter": "^15.5.13",
128
127
  "@types/three": "^0.183.1",
129
128
  "@vitejs/plugin-react": "^5.1.1",
130
129
  "@vitest/coverage-v8": "^4.0.18",
130
+ "@webgpu/types": "^0.1.74",
131
131
  "@xterm/addon-fit": "^0.11.0",
132
132
  "@xterm/xterm": "^6.0.0",
133
133
  "dexie": "^4.3.0",
@@ -139,6 +139,7 @@
139
139
  "globals": "^16.5.0",
140
140
  "husky": "^9.1.7",
141
141
  "lint-staged": "^16.2.7",
142
+ "marked": "^14.0.0",
142
143
  "node-gyp": "^11.2.0",
143
144
  "prettier": "^3.8.1",
144
145
  "react": "^19.2.0",
@@ -156,7 +157,7 @@
156
157
  "prettier --write",
157
158
  "eslint"
158
159
  ],
159
- "*.{js,jsx}": "prettier --write",
160
+ "*.{js,jsx,mjs,cjs}": "prettier --write",
160
161
  "*.{json,css,md,yml}": "prettier --write"
161
162
  },
162
163
  "optionalDependencies": {
@@ -1,45 +0,0 @@
1
- /** Metadata-only file reference (no content loaded). */
2
- export interface WorkspaceFile {
3
- id: string;
4
- name: string;
5
- }
6
- /** Decode file data as UTF-8 text. */
7
- export declare function fileText(data: Uint8Array): string;
8
- /** Check if data contains binary (non-text) content. */
9
- export declare function isBinaryData(data: Uint8Array): boolean;
10
- export interface UseProjectFilesResult {
11
- files: WorkspaceFile[];
12
- activeFileId: string;
13
- loading: boolean;
14
- setActiveFileId: (id: string) => void;
15
- updateFileContent: (content: string) => void;
16
- addFile: (folderPath?: string) => Promise<string>;
17
- addFolder: (parentPath?: string) => Promise<string>;
18
- deleteFile: (fileId: string) => void;
19
- deleteFolder: (folderPath: string) => void;
20
- renameFile: (fileId: string, newName: string) => void;
21
- renameFolder: (oldPath: string, newName: string) => void;
22
- moveFile: (fileId: string, targetFolder: string | null) => void;
23
- duplicateFile: (fileId: string) => Promise<string>;
24
- uploadFiles: (entries: {
25
- path: string;
26
- content: string;
27
- }[], targetFolder?: string) => Promise<void>;
28
- reload: () => Promise<void>;
29
- /** Load content for a single file (cached). */
30
- loadFileContent: (fileId: string) => Promise<Uint8Array>;
31
- /** Load all file contents for this project. Returns map of id → data. */
32
- loadAllContents: () => Promise<Map<string, Uint8Array>>;
33
- /** Content cache — updated on edits and loads. */
34
- contentCache: React.RefObject<Map<string, Uint8Array>>;
35
- mergeVfsChanges: (result: {
36
- addedFiles: WorkspaceFile[];
37
- modifiedFiles: {
38
- path: string;
39
- data: Uint8Array;
40
- }[];
41
- deletedPaths: string[];
42
- }) => void;
43
- }
44
- export declare function generateDuplicateName(files: WorkspaceFile[], sourcePath: string): string;
45
- export declare function useProjectFiles(projectName: string): UseProjectFilesResult;
@@ -1,76 +0,0 @@
1
- /**
2
- * Dispatch context — passed to every executor call.
3
- *
4
- * Provides env access, type-info queries, sub-dispatch into the
5
- * registry, and runtime callbacks. Memoizes type-info lookups for the
6
- * lifetime of a single dispatch so repeated `typeOf(name)` calls from
7
- * different executors don't re-infer.
8
- */
9
- import type { Interpreter } from "../interpreter/interpreter.js";
10
- import type { Stmt } from "../parser/types.js";
11
- import type { ControlSignal } from "../interpreter/types.js";
12
- import type { Registry } from "./registry.js";
13
- import { type JitType } from "../jitTypes.js";
14
- export declare class DispatchContext {
15
- readonly interp: Interpreter;
16
- readonly registry: Registry;
17
- /** When true, only no-bail executors are eligible. Set when the
18
- * caller's compiled artifact has emitted observable side effects
19
- * that mustn't repeat. */
20
- readonly requireNoBail: boolean;
21
- /** Per-dispatch memoization of typeOf(name) lookups. */
22
- private readonly typeCache;
23
- /** Re-entrancy guard: which executors are currently running on
24
- * which head stmts. Prevents an executor sub-dispatching back into
25
- * itself on the same stmt. */
26
- private readonly active;
27
- /** Sibling list and head index for the current dispatch. Set by
28
- * Registry.dispatch before calling executors; read by peekSibling.
29
- * Most executors don't read these directly. */
30
- private _siblings;
31
- private _i;
32
- constructor(interp: Interpreter, registry: Registry, requireNoBail: boolean, active?: Set<string>);
33
- /** Look up a name's JitType from the interpreter env, memoized. */
34
- typeOf(name: string): JitType;
35
- /** Read a value from env (no inference). Returns undefined if unbound. */
36
- envValue(name: string): unknown;
37
- /** Peek at a sibling stmt at `offset` from the current head.
38
- * offset=0 is the current stmt; positive values look ahead.
39
- * Returns null if the offset is past the end of the scope. Used by
40
- * chain-style executors that may consume multiple consecutive
41
- * stmts. */
42
- peekSibling(offset: number): Stmt | null;
43
- /** Sibling list of the current scope. The head stmt is at
44
- * `siblings[headIndex]`. Most executors don't need this directly —
45
- * use `peekSibling(offset)` for lookahead. The rare cases that
46
- * forward the raw list to a legacy adapter (the chain executor) or
47
- * claim the whole scope (the top-level executor) read these. */
48
- get siblings(): readonly Stmt[];
49
- get headIndex(): number;
50
- /** @internal Set the position state for an upcoming dispatch. Only
51
- * the registry calls this. */
52
- _setPosition(siblings: readonly Stmt[], i: number): void;
53
- /** Reset per-dispatch state so this context can be reused for the
54
- * next stmt in a sibling loop. The reentrancy guard is expected to
55
- * already be empty (every pushActive is paired with a popActive in
56
- * Registry.runCandidate's finally). */
57
- resetForNextDispatch(): void;
58
- /** Construct a child context for sub-dispatch. `requireNoBail` is
59
- * the OR of the parent flag and the parent executor's
60
- * `requireNoBailInChildren` declaration. */
61
- childContext(requireNoBail: boolean): DispatchContext;
62
- /** @internal Whether the reentrancy guard has any entries. The
63
- * registry uses this to skip the guard check on the hot path —
64
- * when nothing is active there's nothing to detect. */
65
- get hasActive(): boolean;
66
- /** @internal Used by the registry's reentrancy guard. Pre-checked
67
- * with hasActive on the hot path, so the actual `has` only fires
68
- * during sub-dispatch. */
69
- isActive(executorName: string, stmt: Stmt): boolean;
70
- /** @internal */
71
- pushActive(executorName: string, stmt: Stmt): void;
72
- /** @internal */
73
- popActive(executorName: string, stmt: Stmt): void;
74
- }
75
- /** Re-export for the runner's signal type. */
76
- export type { ControlSignal };
@@ -1,14 +0,0 @@
1
- /**
2
- * Executor registry — public surface.
3
- *
4
- * See docs/developer_reference/executors.md for the design.
5
- */
6
- export type { Executor, CostEstimate, BailReason, RunResult, Proposal, } from "./types.js";
7
- export { Registry, makeRootContext } from "./registry.js";
8
- export type { DispatchResult, CallDispatchResult, WholeScopeResult, } from "./registry.js";
9
- export { DispatchContext } from "./context.js";
10
- export { ExecutorCache } from "./cache.js";
11
- export type { JitType, SignCategory } from "../jitTypes.js";
12
- export { jitTypeKey, unifyJitTypes, isScalarType, isTensorType, isComplexType, isKnownInteger, } from "../jitTypes.js";
13
- export { inferJitType } from "../interpreter/builtins/types.js";
14
- export { registerExecutorsForOpt } from "./plugins.js";
@@ -1,35 +0,0 @@
1
- /**
2
- * cjit-call — C-backed JIT executor for user-function calls.
3
- *
4
- * Mirrors `callExecutor.ts` (the JS-emit sibling) but routes the
5
- * specialization's emitted code through `compileSpecC` →
6
- * `cc -shared -fPIC -O3` → `dlopen` via koffi instead of
7
- * `new Function(source)`. The dispatch, gating, and caching
8
- * conventions are otherwise identical, so a sibling executor can
9
- * register alongside the JS path at the same opt level without any
10
- * arbitration in the dispatcher beyond cost-based selection.
11
- *
12
- * Declines when:
13
- * - `nativeBridge` / `koffi` are not available (browser).
14
- * - Any param or output type fails the C-FFI feasibility check
15
- * (`compilerTypeToCDecl` returns null).
16
- * - mtoc2 throws `UnsupportedConstruct` / `JitTypeError` at lowering.
17
- */
18
- import type { Executor } from "../types.js";
19
- import { type JitType } from "../../jitTypes.js";
20
- import type { FunctionDef } from "../../interpreter/types.js";
21
- import { type Type as CompilerType, type SpecCSignature } from "../../jit/index.js";
22
- import { type CompiledC } from "./compileC.js";
23
- interface CJitCallData {
24
- readonly fn: FunctionDef;
25
- readonly nargout: number;
26
- readonly argTypes: readonly JitType[];
27
- readonly compilerArgTypes: readonly CompilerType[];
28
- readonly args: readonly unknown[];
29
- }
30
- interface CompiledArtifact {
31
- readonly compiled: CompiledC;
32
- readonly signature: SpecCSignature;
33
- }
34
- export declare const cJitCallExecutor: Executor<CJitCallData, CompiledArtifact | null>;
35
- export {};
@@ -1,31 +0,0 @@
1
- /**
2
- * cjit-loop — C-backed JIT executor for outermost For/While
3
- * loops. Mirrors `loopExecutor.ts` (JS-emit sibling) but routes
4
- * through `compileSpecC` → `cc -shared` → `koffi`. See
5
- * `cJitCallExecutor.ts` for the marshaling protocol; this file just
6
- * adapts the loop-shape `data` to the same C-side pipeline.
7
- */
8
- import type { Executor } from "../types.js";
9
- import { type JitType } from "../../jitTypes.js";
10
- import type { Stmt } from "../../parser/index.js";
11
- import type { ConstHandle } from "../classification.js";
12
- import { type Type as CompilerType, type SpecCSignature } from "../../jit/index.js";
13
- import { type CompiledC } from "./compileC.js";
14
- interface CJitLoopData {
15
- readonly loopStmt: Stmt & {
16
- type: "For" | "While";
17
- };
18
- readonly inputs: readonly string[];
19
- readonly outputs: readonly string[];
20
- readonly inputTypes: readonly JitType[];
21
- readonly compilerInputTypes: readonly CompilerType[];
22
- readonly constHandles: readonly ConstHandle[];
23
- readonly currentFile: string;
24
- readonly cacheKey: string;
25
- }
26
- interface CompiledArtifact {
27
- readonly compiled: CompiledC;
28
- readonly signature: SpecCSignature;
29
- }
30
- export declare const cJitLoopExecutor: Executor<CJitLoopData, CompiledArtifact | null>;
31
- export {};
@@ -1,29 +0,0 @@
1
- /**
2
- * cjit-top-level — C-backed JIT executor for whole-script bodies.
3
- *
4
- * Mirrors `topLevelExecutor.ts` (JS-emit sibling) but routes through
5
- * `compileSpecC` → `cc -shared` → `koffi`. See `cJitCallExecutor.ts`
6
- * for the marshaling protocol. Same `isAllSuppressed` gate as the JS
7
- * sibling so `displayAssign`/`displayResult` semantics stay on the
8
- * interpreter path.
9
- */
10
- import type { Executor } from "../types.js";
11
- import { type JitType } from "../../jitTypes.js";
12
- import type { Stmt } from "../../parser/index.js";
13
- import { type Type as CompilerType, type SpecCSignature } from "../../jit/index.js";
14
- import { type CompiledC } from "./compileC.js";
15
- interface CJitTopLevelData {
16
- readonly stmts: readonly Stmt[];
17
- readonly inputs: readonly string[];
18
- readonly outputs: readonly string[];
19
- readonly inputTypes: readonly JitType[];
20
- readonly compilerInputTypes: readonly CompilerType[];
21
- readonly currentFile: string;
22
- readonly cacheKey: string;
23
- }
24
- interface CompiledArtifact {
25
- readonly compiled: CompiledC;
26
- readonly signature: SpecCSignature;
27
- }
28
- export declare const cJitTopLevelExecutor: Executor<CJitTopLevelData, CompiledArtifact | null>;
29
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Dummy no-op built-in function names.
3
- * Used as placeholders for unsupported functionality.
4
- */
5
- export declare function getDummyBuiltinNames(): string[];
@@ -1,23 +0,0 @@
1
- /**
2
- * Host bag passed to `Builtin.call` for the interpreter backend.
3
- *
4
- * Mirrors nexl's `RuntimeContext`. Side-effecty builtins (`disp`,
5
- * `fprintf`, `error`, plot dispatch, …) consult `helpers.write` to
6
- * emit text. Pure builtins ignore the bag.
7
- *
8
- * `write` is the JS analogue of C's `printf`. The CLI provides one
9
- * backed by `process.stdout.write`; the browser provides one that
10
- * pushes lines to the console panel; future test runners provide
11
- * one that captures into a buffer for byte-for-byte comparison.
12
- *
13
- * As the interpreter grows, additional hooks (`time`, `plot`,
14
- * `error`, …) will join this bag. Adding a hook here is the
15
- * single source of truth — every host supplies it.
16
- */
17
- export interface RuntimeHelpers {
18
- /** Append text to stdout. No implicit newline. */
19
- write(s: string): void;
20
- }
21
- export interface RuntimeContext {
22
- helpers: RuntimeHelpers;
23
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Map a runtime value back into a Type. Used by the interpreter to
3
- * feed `argTypes` into a builtin's `transfer` (for validation) and
4
- * `call` (for type-dispatched implementations) — so that the three
5
- * hooks (`emitC`, `emitJs`, `call`) all branch on the same `argTypes`
6
- * shape rather than reinventing dispatch per-backend.
7
- */
8
- import { type Type } from "../lowering/types.js";
9
- import { type RuntimeValue } from "./value.js";
10
- export declare function inferTypeFromValue(v: RuntimeValue): Type;
@@ -1,101 +0,0 @@
1
- /**
2
- * Runtime value carrier for the interpreter backend. Mirrors nexl's
3
- * `RuntimeValue` design: a discriminated-via-typeof union for the
4
- * common cases plus tagged-object wrappers for the kinds JS can't
5
- * distinguish natively.
6
- *
7
- * MVP scope (Phase 3): real-double scalars, booleans (logical),
8
- * strings (double-quoted), chars (single-quoted), real-double tensors.
9
- * Complex / structs / classes / handles / void / cells follow as the
10
- * type lattice and interpreter coverage expand.
11
- *
12
- * Builtin `call` implementations narrow via `typeof` / `isTensor` /
13
- * `isChar` and dispatch through the same `argTypes` shape that
14
- * `emitC` / `emitJs` consume — keeping the three backends parallel.
15
- */
16
- export type RuntimeValue = number | boolean | string | RuntimeTensor | RuntimeChar | RuntimeComplex | RuntimeStruct | RuntimeHandle;
17
- /** Function handle. Named handles (`@foo`) keep the source name and
18
- * dispatch via the interpreter's normal call-site resolution at the
19
- * call point. Anonymous handles (`@(p1, ...) body`) capture every
20
- * visible binding by value at the @-site and run `body` in a fresh
21
- * env when invoked. */
22
- export type RuntimeHandle = {
23
- readonly mtoc2Handle: true;
24
- readonly kind: "named";
25
- readonly name: string;
26
- } | {
27
- readonly mtoc2Handle: true;
28
- readonly kind: "anon";
29
- readonly params: ReadonlyArray<string>;
30
- readonly body: unknown;
31
- readonly captures: Readonly<Record<string, RuntimeValue>>;
32
- };
33
- /** Narrow a RuntimeValue to a function handle. */
34
- export declare function isHandleValue(v: RuntimeValue): v is RuntimeHandle;
35
- /** Struct/object — plain JS object whose keys are field names. The
36
- * c-aot path emits a typedef'd C struct; the JS path just uses a
37
- * bare object. Recurses through field values that may themselves be
38
- * any RuntimeValue (including nested structs). */
39
- export type RuntimeStruct = {
40
- readonly [field: string]: RuntimeValue;
41
- };
42
- /** Real or complex double tensor. `data` is the real lane,
43
- * column-major to match numbl's `RuntimeTensor.data`. `imag` is the
44
- * imaginary lane (same length and orientation as `data`); absent for
45
- * real-only tensors. Mirrors the C representation's split-buffer
46
- * layout — codegen / interpreter dispatch on `imag !== undefined`
47
- * the way the C side dispatches on `imag != NULL`. The shape array
48
- * is owned by the value; do not mutate.
49
- *
50
- * `isLogical` flags this tensor as the result of a logical operation
51
- * (`~`, `<`, `==`, `&&`, …) so downstream index-slot resolution can
52
- * treat it as a mask instead of an IndexVec — same role as numbl's
53
- * `_isLogical` on its RuntimeTensor. The flag is one-way (once set,
54
- * stays set across copies via the helper) and absent on numeric
55
- * tensors; helper sites that don't care leave it undefined. */
56
- export interface RuntimeTensor {
57
- readonly mtoc2Tag: "tensor";
58
- readonly shape: number[];
59
- readonly data: Float64Array;
60
- readonly imag?: Float64Array;
61
- readonly isLogical?: boolean;
62
- }
63
- /** Single-quoted char-array (`'foo'`). Distinct from `"foo"` strings
64
- * because numbl treats them differently: `length('foo') === 3` but
65
- * `length("foo") === 1`. */
66
- export interface RuntimeChar {
67
- readonly mtoc2Tag: "char";
68
- readonly value: string;
69
- }
70
- /** Scalar complex value — JS-side analogue of the `mtoc2_complex_t`
71
- * struct in `cscalar.h`. The cscalar runtime helpers
72
- * (`mtoc2_cmake`, `mtoc2_creal`, etc.) consume and produce this
73
- * shape. We DON'T tag it the way tensor / char are tagged because
74
- * emitJs literals (`{re: 0, im: 1}`) and runtime calls produce the
75
- * bare object form — adding a tag would force every helper to
76
- * re-wrap. Use `isComplexValue` for narrowing. */
77
- export interface RuntimeComplex {
78
- readonly re: number;
79
- readonly im: number;
80
- }
81
- /** Narrow a RuntimeValue to a complex scalar. Matches the cscalar
82
- * helpers' `{re, im}` shape. */
83
- export declare function isComplexValue(v: RuntimeValue): v is RuntimeComplex;
84
- export declare function makeTensor(shape: number[], data: Float64Array): RuntimeTensor;
85
- /** Complex tensor with both lanes. `data` is the real lane, `imag`
86
- * the imaginary lane; both must have the same length and match the
87
- * product of `shape`. */
88
- export declare function makeComplexTensor(shape: number[], data: Float64Array, imag: Float64Array): RuntimeTensor;
89
- /** True iff this tensor carries an imaginary lane. */
90
- export declare function isComplexTensor(v: RuntimeTensor): boolean;
91
- export declare function makeChar(value: string): RuntimeChar;
92
- export declare function isTensor(v: RuntimeValue): v is RuntimeTensor;
93
- export declare function isChar(v: RuntimeValue): v is RuntimeChar;
94
- /** Materialize a scalar value as a plain JS number. Used by builtins
95
- * that need to treat scalar tensors and scalar numbers uniformly. */
96
- export declare function toScalarNumber(v: RuntimeValue): number;
97
- /** MATLAB-style truthiness — for `if` / `while` / `&&` / `||`.
98
- * Scalar non-zero, all-elements-non-zero for tensors, nonempty
99
- * text. The interpreter uses this; codegen relies on the matching
100
- * C-side `__nonzero` helpers. */
101
- export declare function isTruthy(v: RuntimeValue): boolean;
@@ -1,59 +0,0 @@
1
- /**
2
- * Driver-script prologue extractor.
3
- *
4
- * mtoc2 accepts `addpath(<literal>, ...)` only as a leading sequence
5
- * of top-level statements in the driver script. Each call is parsed
6
- * into a list of directory arguments (literal strings only) plus an
7
- * optional trailing `-begin` / `-end` flag.
8
- *
9
- * Two call sites:
10
- * - The CLI invokes the extractor before scanning the filesystem so
11
- * it knows which directories to fold into the workspace search
12
- * path.
13
- * - `translateProject` / the interpreter run path invoke it purely
14
- * to drop the prologue statements from the driver AST before
15
- * lowering / execution begins. The dirs are ignored there.
16
- *
17
- * The two calls are idempotent: same input AST → same dirs and
18
- * remaining body, so it doesn't matter that they parse twice.
19
- *
20
- * Any `addpath` left in the AST (anywhere outside the leading prefix)
21
- * still hits the `addpath` builtin's `transfer`, which errors with a
22
- * span-attributed message. `rmpath` / `savepath` are always rejected
23
- * by their own `transfer` hooks; the extractor never accepts them.
24
- *
25
- * Function-file auto-invoke: a driver whose body (after the prologue)
26
- * contains only function/classdef definitions and no top-level
27
- * statements is a "function file" — running it means calling its
28
- * first function with zero arguments. The extractor appends a
29
- * synthesized 0-arg call so every execution path (interpreter,
30
- * js-aot, c-aot) treats it the same way. Mirrors numbl's
31
- * `Interpreter.run` (interpreter.ts).
32
- */
33
- import type { AbstractSyntaxTree, Stmt, Span } from "../parser/index.js";
34
- export interface AddPathDir {
35
- /** Directory string as the user wrote it. Relative paths are NOT
36
- * resolved here; callers resolve against `process.cwd()`. */
37
- dir: string;
38
- /** Whether the directory inserts at the front of the addpath block
39
- * (default / `-begin`) or after the CLI `--path` dirs at the end
40
- * (`-end`). */
41
- position: "begin" | "end";
42
- /** Span of the originating `addpath(...)` call. */
43
- span: Span;
44
- }
45
- export interface DriverPrologueOpts {
46
- /** Set to `true` when a filesystem is available to resolve dirs
47
- * against (CLI). When `false` or omitted (web IDE, in-memory
48
- * translate, vitest), any leading `addpath` call is itself an
49
- * `UnsupportedConstruct`. */
50
- allowAddpath?: boolean;
51
- }
52
- export interface DriverPrologueResult {
53
- addpaths: AddPathDir[];
54
- /** Top-level statements after the prologue. Suitable for direct
55
- * use with `Lowerer.lowerProgram` (via a shallow AST copy with
56
- * this `body`) or `Interpreter.runProgram`. */
57
- remainingBody: Stmt[];
58
- }
59
- export declare function extractDriverPrologue(ast: AbstractSyntaxTree, opts?: DriverPrologueOpts): DriverPrologueResult;
@@ -1,62 +0,0 @@
1
- /**
2
- * Loader for `.mtoc2.js` user functions.
3
- *
4
- * A `.mtoc2.js` file is plain JavaScript with no mtoc2 dependency.
5
- * The loader evaluates it as a CommonJS-style module (`exports` and
6
- * `module.exports` are the only injected names) and reads four
7
- * exports to assemble a workspace-scoped `Builtin`:
8
- *
9
- * exports.name — string, must match the file's basename.
10
- * exports.transfer — (argTypes, nargout) -> Type[]. Raw mtoc2 Type
11
- * objects in, raw Type objects out. Throws
12
- * `Error` on bad input.
13
- * exports.emit — ({argsC, prefix, ...}) -> string. C expression
14
- * for the call. Use `prefix` to name any private
15
- * C helpers (kept collision-free across files).
16
- * exports.cBody — ({prefix}) -> string. C source (helper
17
- * function definitions) injected once per
18
- * translation unit. Use the same `prefix` as
19
- * `emit`.
20
- * exports.cHeaders? — string[] of additional `#include` lines to
21
- * activate (optional).
22
- *
23
- * Prefix shape: `mtoc2_user_<safe_funcname>__<8hex>__` where the hex
24
- * is the FNV-1a hash of the workspace-relative file path. Including
25
- * the path in the hash makes the prefix unique across all `.mtoc2.js`
26
- * files in the workspace, even if two files happen to define
27
- * functions with overlapping internal names.
28
- */
29
- import type { Builtin } from "../builtins/registry.js";
30
- /** Resolved sibling file: the relative path (used by the build to
31
- * pick a unique on-disk name) plus the file's text. */
32
- export interface ResolvedCSource {
33
- /** Path as written by the user in `exports.cSources` (e.g.
34
- * `"impl.c"` or `"sub/helpers.h"`). */
35
- relPath: string;
36
- /** File text the build will write to disk. */
37
- source: string;
38
- }
39
- /** Loader output: the assembled `Builtin` plus the user-supplied C
40
- * sibling files the framework needs to thread through to the build
41
- * pipeline. */
42
- export interface LoadedUserFunction {
43
- builtin: Builtin;
44
- cSources: ResolvedCSource[];
45
- }
46
- /** Evaluate a `.mtoc2.js` file and return its assembled `Builtin`
47
- * plus the user-supplied sibling C files (`cSources`).
48
- *
49
- * - `fileName` — the .mtoc2.js's full path (used for diagnostics and
50
- * to resolve sibling paths).
51
- * - `expectedName` — what numbl's workspace registered the file
52
- * under (derived from the file's basename / package path); we
53
- * validate the user's `exports.name` matches so a typo / rename
54
- * surfaces here rather than at the first call site.
55
- * - `relPath` — workspace-relative path used for the prefix hash.
56
- * - `readSibling(p)` — given a path-key relative to the .mtoc2.js's
57
- * directory, return the sibling file's source text. Used to pull
58
- * `cSources` entries out of the workspace's file map (which is
59
- * the same regardless of CLI vs web IDE). Returns `undefined` if
60
- * the file is not in the workspace; the loader throws a clear
61
- * error pointing at the missing path. */
62
- export declare function loadMtoc2UserFunction(fileName: string, source: string, expectedName: string, relPath: string, readSibling: (siblingRelPath: string) => string | undefined): LoadedUserFunction;
@@ -1,14 +0,0 @@
1
- /**
2
- * Centralized LAPACK bridge resolution with fallback and one-time logging.
3
- *
4
- * Tries the native bridge first; falls back to ts-lapack (pure TypeScript).
5
- */
6
- import { type LapackBridge } from "./lapack-bridge.js";
7
- /**
8
- * Get the effective LAPACK bridge for a given operation.
9
- *
10
- * @param opName Operation name for logging (e.g. "inv", "qr")
11
- * @param method Optional method to check on native bridge. If native bridge
12
- * lacks this method, falls back to ts-lapack.
13
- */
14
- export declare function getEffectiveBridge(opName: string, method?: keyof LapackBridge): LapackBridge;