numbl 0.3.3 → 0.4.1

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 (349) hide show
  1. package/binding.gyp +6 -5
  2. package/dist-cli/cli.js +63077 -42047
  3. package/dist-lib/graphics/types.d.ts +40 -1
  4. package/dist-lib/lib.d.ts +0 -1
  5. package/dist-lib/lib.js +78446 -57671
  6. package/dist-lib/numbl-core/executeCode.d.ts +10 -12
  7. package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
  8. package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
  9. package/dist-lib/numbl-core/executors/index.d.ts +0 -3
  10. package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +35 -0
  11. package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +31 -0
  12. package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +29 -0
  13. package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +45 -0
  14. package/dist-lib/numbl-core/executors/jit/compileC.d.ts +51 -0
  15. package/dist-lib/numbl-core/executors/jit/compileC.node.d.ts +25 -0
  16. package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +27 -0
  17. package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +41 -0
  18. package/dist-lib/numbl-core/executors/jit/session.d.ts +17 -0
  19. package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +36 -0
  20. package/dist-lib/numbl-core/executors/jit/typeAdapter.d.ts +28 -0
  21. package/dist-lib/numbl-core/executors/jit/typeAdapterC.d.ts +73 -0
  22. package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +48 -0
  23. package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +108 -0
  24. package/dist-lib/numbl-core/executors/lowering.d.ts +31 -77
  25. package/dist-lib/numbl-core/executors/plugins.d.ts +14 -21
  26. package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
  27. package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
  28. package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +0 -18
  29. package/dist-lib/numbl-core/interpreter/interpreter.d.ts +37 -21
  30. package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
  31. package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +13 -1
  32. package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +1 -1
  33. package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +43 -0
  34. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +123 -0
  35. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/minus.d.ts +2 -0
  36. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mpower.d.ts +12 -0
  37. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mrdivide.d.ts +5 -0
  38. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mtimes.d.ts +2 -0
  39. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/plus.d.ts +2 -0
  40. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/power.d.ts +30 -0
  41. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/rdivide.d.ts +2 -0
  42. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/times.d.ts +2 -0
  43. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/uminus.d.ts +2 -0
  44. package/dist-lib/numbl-core/jit/builtins/defs/compare/_compare.d.ts +12 -0
  45. package/dist-lib/numbl-core/jit/builtins/defs/compare/eq.d.ts +2 -0
  46. package/dist-lib/numbl-core/jit/builtins/defs/compare/ge.d.ts +2 -0
  47. package/dist-lib/numbl-core/jit/builtins/defs/compare/gt.d.ts +2 -0
  48. package/dist-lib/numbl-core/jit/builtins/defs/compare/le.d.ts +2 -0
  49. package/dist-lib/numbl-core/jit/builtins/defs/compare/lt.d.ts +2 -0
  50. package/dist-lib/numbl-core/jit/builtins/defs/compare/ne.d.ts +2 -0
  51. package/dist-lib/numbl-core/jit/builtins/defs/diag/assert.d.ts +6 -0
  52. package/dist-lib/numbl-core/jit/builtins/defs/io/_format_args.d.ts +17 -0
  53. package/dist-lib/numbl-core/jit/builtins/defs/io/disp.d.ts +2 -0
  54. package/dist-lib/numbl-core/jit/builtins/defs/io/error.d.ts +2 -0
  55. package/dist-lib/numbl-core/jit/builtins/defs/io/fprintf.d.ts +2 -0
  56. package/dist-lib/numbl-core/jit/builtins/defs/io/sprintf.d.ts +2 -0
  57. package/dist-lib/numbl-core/jit/builtins/defs/io/warning.d.ts +15 -0
  58. package/dist-lib/numbl-core/jit/builtins/defs/logical/_shortcircuit.d.ts +30 -0
  59. package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +30 -0
  60. package/dist-lib/numbl-core/jit/builtins/defs/logical/and.d.ts +5 -0
  61. package/dist-lib/numbl-core/jit/builtins/defs/logical/andand.d.ts +1 -0
  62. package/dist-lib/numbl-core/jit/builtins/defs/logical/boolconst.d.ts +3 -0
  63. package/dist-lib/numbl-core/jit/builtins/defs/logical/classBuiltin.d.ts +21 -0
  64. package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +15 -0
  65. package/dist-lib/numbl-core/jit/builtins/defs/logical/isa.d.ts +13 -0
  66. package/dist-lib/numbl-core/jit/builtins/defs/logical/iscell.d.ts +8 -0
  67. package/dist-lib/numbl-core/jit/builtins/defs/logical/isempty.d.ts +2 -0
  68. package/dist-lib/numbl-core/jit/builtins/defs/logical/isequal.d.ts +2 -0
  69. package/dist-lib/numbl-core/jit/builtins/defs/logical/isfield.d.ts +20 -0
  70. package/dist-lib/numbl-core/jit/builtins/defs/logical/isinf.d.ts +2 -0
  71. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnan.d.ts +1 -0
  72. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnumeric.d.ts +7 -0
  73. package/dist-lib/numbl-core/jit/builtins/defs/logical/isreal.d.ts +2 -0
  74. package/dist-lib/numbl-core/jit/builtins/defs/logical/isscalar.d.ts +20 -0
  75. package/dist-lib/numbl-core/jit/builtins/defs/logical/isstruct.d.ts +7 -0
  76. package/dist-lib/numbl-core/jit/builtins/defs/logical/logical.d.ts +1 -0
  77. package/dist-lib/numbl-core/jit/builtins/defs/logical/not.d.ts +15 -0
  78. package/dist-lib/numbl-core/jit/builtins/defs/logical/or.d.ts +11 -0
  79. package/dist-lib/numbl-core/jit/builtins/defs/logical/oror.d.ts +1 -0
  80. package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +21 -0
  81. package/dist-lib/numbl-core/jit/builtins/defs/logical/typequery.d.ts +10 -0
  82. package/dist-lib/numbl-core/jit/builtins/defs/logical/xor.d.ts +12 -0
  83. package/dist-lib/numbl-core/jit/builtins/defs/math/_complex_fold.d.ts +34 -0
  84. package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +51 -0
  85. package/dist-lib/numbl-core/jit/builtins/defs/math/abs.d.ts +7 -0
  86. package/dist-lib/numbl-core/jit/builtins/defs/math/angle.d.ts +7 -0
  87. package/dist-lib/numbl-core/jit/builtins/defs/math/asinh.d.ts +1 -0
  88. package/dist-lib/numbl-core/jit/builtins/defs/math/atan.d.ts +1 -0
  89. package/dist-lib/numbl-core/jit/builtins/defs/math/atan2.d.ts +3 -0
  90. package/dist-lib/numbl-core/jit/builtins/defs/math/besselh.d.ts +2 -0
  91. package/dist-lib/numbl-core/jit/builtins/defs/math/ceil.d.ts +4 -0
  92. package/dist-lib/numbl-core/jit/builtins/defs/math/conj.d.ts +7 -0
  93. package/dist-lib/numbl-core/jit/builtins/defs/math/constants.d.ts +7 -0
  94. package/dist-lib/numbl-core/jit/builtins/defs/math/cos.d.ts +1 -0
  95. package/dist-lib/numbl-core/jit/builtins/defs/math/cosh.d.ts +1 -0
  96. package/dist-lib/numbl-core/jit/builtins/defs/math/dot.d.ts +20 -0
  97. package/dist-lib/numbl-core/jit/builtins/defs/math/double.d.ts +28 -0
  98. package/dist-lib/numbl-core/jit/builtins/defs/math/exp.d.ts +1 -0
  99. package/dist-lib/numbl-core/jit/builtins/defs/math/fix.d.ts +4 -0
  100. package/dist-lib/numbl-core/jit/builtins/defs/math/floor.d.ts +4 -0
  101. package/dist-lib/numbl-core/jit/builtins/defs/math/hypot.d.ts +3 -0
  102. package/dist-lib/numbl-core/jit/builtins/defs/math/imag.d.ts +7 -0
  103. package/dist-lib/numbl-core/jit/builtins/defs/math/linspace.d.ts +6 -0
  104. package/dist-lib/numbl-core/jit/builtins/defs/math/log.d.ts +4 -0
  105. package/dist-lib/numbl-core/jit/builtins/defs/math/log10.d.ts +3 -0
  106. package/dist-lib/numbl-core/jit/builtins/defs/math/log2.d.ts +5 -0
  107. package/dist-lib/numbl-core/jit/builtins/defs/math/logspace.d.ts +8 -0
  108. package/dist-lib/numbl-core/jit/builtins/defs/math/mod.d.ts +1 -0
  109. package/dist-lib/numbl-core/jit/builtins/defs/math/norm.d.ts +2 -0
  110. package/dist-lib/numbl-core/jit/builtins/defs/math/real.d.ts +7 -0
  111. package/dist-lib/numbl-core/jit/builtins/defs/math/rem.d.ts +3 -0
  112. package/dist-lib/numbl-core/jit/builtins/defs/math/round.d.ts +1 -0
  113. package/dist-lib/numbl-core/jit/builtins/defs/math/sign.d.ts +5 -0
  114. package/dist-lib/numbl-core/jit/builtins/defs/math/sin.d.ts +1 -0
  115. package/dist-lib/numbl-core/jit/builtins/defs/math/sinh.d.ts +1 -0
  116. package/dist-lib/numbl-core/jit/builtins/defs/math/sqrt.d.ts +11 -0
  117. package/dist-lib/numbl-core/jit/builtins/defs/math/tan.d.ts +1 -0
  118. package/dist-lib/numbl-core/jit/builtins/defs/math/tanh.d.ts +1 -0
  119. package/dist-lib/numbl-core/jit/builtins/defs/math/uniquetol.d.ts +22 -0
  120. package/dist-lib/numbl-core/jit/builtins/defs/plot/dispatch.d.ts +6 -0
  121. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_cumulative.d.ts +49 -0
  122. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +126 -0
  123. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_variance.d.ts +17 -0
  124. package/dist-lib/numbl-core/jit/builtins/defs/reduction/all.d.ts +1 -0
  125. package/dist-lib/numbl-core/jit/builtins/defs/reduction/any.d.ts +1 -0
  126. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummax.d.ts +1 -0
  127. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummin.d.ts +1 -0
  128. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumprod.d.ts +1 -0
  129. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumsum.d.ts +1 -0
  130. package/dist-lib/numbl-core/jit/builtins/defs/reduction/diff.d.ts +16 -0
  131. package/dist-lib/numbl-core/jit/builtins/defs/reduction/length.d.ts +2 -0
  132. package/dist-lib/numbl-core/jit/builtins/defs/reduction/max.d.ts +1 -0
  133. package/dist-lib/numbl-core/jit/builtins/defs/reduction/mean.d.ts +1 -0
  134. package/dist-lib/numbl-core/jit/builtins/defs/reduction/min.d.ts +1 -0
  135. package/dist-lib/numbl-core/jit/builtins/defs/reduction/numel.d.ts +2 -0
  136. package/dist-lib/numbl-core/jit/builtins/defs/reduction/prod.d.ts +1 -0
  137. package/dist-lib/numbl-core/jit/builtins/defs/reduction/std.d.ts +1 -0
  138. package/dist-lib/numbl-core/jit/builtins/defs/reduction/sum.d.ts +1 -0
  139. package/dist-lib/numbl-core/jit/builtins/defs/reduction/var.d.ts +1 -0
  140. package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +67 -0
  141. package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +34 -0
  142. package/dist-lib/numbl-core/jit/builtins/defs/shape/cat.d.ts +33 -0
  143. package/dist-lib/numbl-core/jit/builtins/defs/shape/diag.d.ts +29 -0
  144. package/dist-lib/numbl-core/jit/builtins/defs/shape/eye.d.ts +5 -0
  145. package/dist-lib/numbl-core/jit/builtins/defs/shape/flip.d.ts +7 -0
  146. package/dist-lib/numbl-core/jit/builtins/defs/shape/meshgrid.d.ts +12 -0
  147. package/dist-lib/numbl-core/jit/builtins/defs/shape/ones.d.ts +1 -0
  148. package/dist-lib/numbl-core/jit/builtins/defs/shape/repmat.d.ts +37 -0
  149. package/dist-lib/numbl-core/jit/builtins/defs/shape/reshape.d.ts +39 -0
  150. package/dist-lib/numbl-core/jit/builtins/defs/shape/size.d.ts +20 -0
  151. package/dist-lib/numbl-core/jit/builtins/defs/shape/sort.d.ts +19 -0
  152. package/dist-lib/numbl-core/jit/builtins/defs/shape/transpose.d.ts +6 -0
  153. package/dist-lib/numbl-core/jit/builtins/defs/shape/tril.d.ts +16 -0
  154. package/dist-lib/numbl-core/jit/builtins/defs/shape/triu.d.ts +16 -0
  155. package/dist-lib/numbl-core/jit/builtins/defs/shape/zeros.d.ts +1 -0
  156. package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +20 -0
  157. package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +36 -0
  158. package/dist-lib/numbl-core/jit/builtins/defs/system/pathBuiltins.d.ts +4 -0
  159. package/dist-lib/numbl-core/jit/builtins/defs/system/tic.d.ts +8 -0
  160. package/dist-lib/numbl-core/jit/builtins/defs/system/toc.d.ts +5 -0
  161. package/dist-lib/numbl-core/jit/builtins/index.d.ts +16 -0
  162. package/dist-lib/numbl-core/jit/builtins/registry.d.ts +138 -0
  163. package/dist-lib/numbl-core/jit/builtins/runtime/cell/cell.d.ts +24 -0
  164. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/loop_count.d.ts +1 -0
  165. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/range_value.d.ts +1 -0
  166. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/scalar_index.d.ts +11 -0
  167. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/tensor_make_range.d.ts +5 -0
  168. package/dist-lib/numbl-core/jit/builtins/runtime/io/assert_fmt.d.ts +1 -0
  169. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_complex.d.ts +1 -0
  170. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_double.d.ts +1 -0
  171. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_struct.d.ts +1 -0
  172. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor.d.ts +1 -0
  173. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor_complex.d.ts +1 -0
  174. package/dist-lib/numbl-core/jit/builtins/runtime/io/error_fmt.d.ts +2 -0
  175. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_complex.d.ts +1 -0
  176. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_double.d.ts +1 -0
  177. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_engine.d.ts +1 -0
  178. package/dist-lib/numbl-core/jit/builtins/runtime/io/fprintf.d.ts +1 -0
  179. package/dist-lib/numbl-core/jit/builtins/runtime/io/sprintf.d.ts +5 -0
  180. package/dist-lib/numbl-core/jit/builtins/runtime/io/warning_fmt.d.ts +2 -0
  181. package/dist-lib/numbl-core/jit/builtins/runtime/plot/plot_dispatch.d.ts +1 -0
  182. package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +86 -0
  183. package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
  184. package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +103 -0
  185. package/dist-lib/numbl-core/jit/builtins/runtime/system/deep_clone.d.ts +1 -0
  186. package/dist-lib/numbl-core/jit/builtins/runtime/system/isequal.d.ts +2 -0
  187. package/dist-lib/numbl-core/jit/builtins/runtime/system/tictoc.d.ts +5 -0
  188. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor.d.ts +6 -0
  189. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc.d.ts +5 -0
  190. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_complex.d.ts +6 -0
  191. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd.d.ts +5 -0
  192. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd_complex.d.ts +6 -0
  193. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_copy_complex.d.ts +6 -0
  194. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix.d.ts +5 -0
  195. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix_complex.d.ts +6 -0
  196. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row.d.ts +5 -0
  197. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row_complex.d.ts +6 -0
  198. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cat.d.ts +11 -0
  199. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cumulative.d.ts +32 -0
  200. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diag.d.ts +33 -0
  201. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diff.d.ts +5 -0
  202. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_dot.d.ts +16 -0
  203. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_complex.d.ts +90 -0
  204. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real.d.ts +75 -0
  205. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +95 -0
  206. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_eye.d.ts +10 -0
  207. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_nd.d.ts +11 -0
  208. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_square.d.ts +5 -0
  209. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_flip.d.ts +11 -0
  210. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_linspace.d.ts +5 -0
  211. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logical_real.d.ts +10 -0
  212. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logspace.d.ts +5 -0
  213. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_meshgrid.d.ts +29 -0
  214. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_complex.d.ts +10 -0
  215. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_real.d.ts +6 -0
  216. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_norm.d.ts +4 -0
  217. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_nd.d.ts +5 -0
  218. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_square.d.ts +5 -0
  219. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_predicate.d.ts +42 -0
  220. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_complex.d.ts +53 -0
  221. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +42 -0
  222. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_repmat.d.ts +11 -0
  223. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd.d.ts +5 -0
  224. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd_complex.d.ts +6 -0
  225. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_size.d.ts +5 -0
  226. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_sort_real.d.ts +36 -0
  227. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose.d.ts +5 -0
  228. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose_complex.d.ts +6 -0
  229. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_triangular.d.ts +22 -0
  230. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_complex_math.d.ts +128 -0
  231. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +95 -0
  232. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_uniquetol.d.ts +5 -0
  233. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_var.d.ts +12 -0
  234. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_nd.d.ts +5 -0
  235. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_square.d.ts +5 -0
  236. package/dist-lib/numbl-core/jit/builtins/runtime/text/strcmp.d.ts +2 -0
  237. package/dist-lib/numbl-core/jit/codegen/cFormat.d.ts +36 -0
  238. package/dist-lib/numbl-core/jit/codegen/cHelpers.d.ts +48 -0
  239. package/dist-lib/numbl-core/jit/codegen/emit.d.ts +55 -0
  240. package/dist-lib/numbl-core/jit/codegen/emitCellTypedef.d.ts +23 -0
  241. package/dist-lib/numbl-core/jit/codegen/emitExpr.d.ts +33 -0
  242. package/dist-lib/numbl-core/jit/codegen/emitIndex.d.ts +56 -0
  243. package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +64 -0
  244. package/dist-lib/numbl-core/jit/codegen/emitNamedTypedef.d.ts +58 -0
  245. package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +76 -0
  246. package/dist-lib/numbl-core/jit/codegen/emitTensorConcat.d.ts +23 -0
  247. package/dist-lib/numbl-core/jit/codegen/emitTensorConcatJs.d.ts +16 -0
  248. package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +77 -0
  249. package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +66 -0
  250. package/dist-lib/numbl-core/jit/codegen/liveness.d.ts +58 -0
  251. package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +24 -0
  252. package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +150 -0
  253. package/dist-lib/numbl-core/jit/compileSpec.d.ts +84 -0
  254. package/dist-lib/numbl-core/jit/compileSpecC.d.ts +93 -0
  255. package/dist-lib/numbl-core/jit/index.d.ts +15 -0
  256. package/dist-lib/numbl-core/jit/lowering/classDefs.d.ts +109 -0
  257. package/dist-lib/numbl-core/jit/lowering/errors.d.ts +35 -0
  258. package/dist-lib/numbl-core/jit/lowering/indexFold.d.ts +31 -0
  259. package/dist-lib/numbl-core/jit/lowering/indexResolve.d.ts +100 -0
  260. package/dist-lib/numbl-core/jit/lowering/ir.d.ts +584 -0
  261. package/dist-lib/numbl-core/jit/lowering/lower.d.ts +271 -0
  262. package/dist-lib/numbl-core/jit/lowering/lowerCellIndex.d.ts +41 -0
  263. package/dist-lib/numbl-core/jit/lowering/lowerCellLit.d.ts +19 -0
  264. package/dist-lib/numbl-core/jit/lowering/lowerClassConstructor.d.ts +55 -0
  265. package/dist-lib/numbl-core/jit/lowering/lowerFuncCall.d.ts +34 -0
  266. package/dist-lib/numbl-core/jit/lowering/lowerHandle.d.ts +57 -0
  267. package/dist-lib/numbl-core/jit/lowering/lowerIndexLoad.d.ts +16 -0
  268. package/dist-lib/numbl-core/jit/lowering/lowerIndexSlice.d.ts +29 -0
  269. package/dist-lib/numbl-core/jit/lowering/lowerIndexSliceStore.d.ts +19 -0
  270. package/dist-lib/numbl-core/jit/lowering/lowerIndexStore.d.ts +14 -0
  271. package/dist-lib/numbl-core/jit/lowering/lowerMethodCall.d.ts +45 -0
  272. package/dist-lib/numbl-core/jit/lowering/lowerMultiAssign.d.ts +36 -0
  273. package/dist-lib/numbl-core/jit/lowering/lowerTensorLit.d.ts +25 -0
  274. package/dist-lib/numbl-core/jit/lowering/rangeCount.d.ts +19 -0
  275. package/dist-lib/numbl-core/jit/lowering/specialize.d.ts +93 -0
  276. package/dist-lib/numbl-core/jit/lowering/types.d.ts +503 -0
  277. package/dist-lib/numbl-core/jit/lowering/walk.d.ts +17 -0
  278. package/dist-lib/numbl-core/jit/numbl/index.d.ts +30 -0
  279. package/dist-lib/numbl-core/jit/parser/astUtils.d.ts +43 -0
  280. package/dist-lib/numbl-core/jit/parser/index.d.ts +12 -0
  281. package/dist-lib/numbl-core/jit/parser/sourceLoc.d.ts +12 -0
  282. package/dist-lib/numbl-core/jit/runtime/context.d.ts +23 -0
  283. package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +10 -0
  284. package/dist-lib/numbl-core/jit/runtime/value.d.ts +101 -0
  285. package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +59 -0
  286. package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +62 -0
  287. package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +243 -0
  288. package/dist-lib/numbl-core/jitTypes.d.ts +7 -321
  289. package/dist-lib/numbl-core/jsUserFunctions.d.ts +2 -2
  290. package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
  291. package/dist-lib/numbl-core/runtime/index.d.ts +1 -1
  292. package/dist-lib/numbl-core/runtime/indexing.d.ts +11 -1
  293. package/dist-lib/numbl-core/runtime/plotUtils.d.ts +28 -2
  294. package/dist-lib/numbl-core/runtime/runtime.d.ts +16 -1
  295. package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +5 -0
  296. package/dist-lib/numbl-core/runtime/types.d.ts +19 -3
  297. package/dist-lib/numbl-core/version.d.ts +1 -1
  298. package/dist-lib/numbl-core/workspace/types.d.ts +8 -0
  299. package/dist-plot-viewer/assets/index-DfxsWeyf.js +4426 -0
  300. package/dist-plot-viewer/index.html +1 -1
  301. package/dist-site-viewer/404.html +33 -0
  302. package/dist-site-viewer/assets/index-C5c2lKAx.js +4748 -0
  303. package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
  304. package/dist-site-viewer/assets/numbl-worker-CkoM4MUa.js +11836 -0
  305. package/dist-site-viewer/coi-serviceworker.js +70 -0
  306. package/dist-site-viewer/favicon.svg +23 -0
  307. package/dist-site-viewer/index.html +16 -0
  308. package/dist-site-viewer/logo.svg +26 -0
  309. package/dist-site-viewer/numbl-embed.js +111 -0
  310. package/dist-site-viewer/vite.svg +1 -0
  311. package/native/ops/real_unary_elemwise.c +3 -1
  312. package/package.json +15 -9
  313. package/dist-lib/numbl-core/executors/cJit/builtins.d.ts +0 -30
  314. package/dist-lib/numbl-core/executors/cJit/chainCodegen.d.ts +0 -59
  315. package/dist-lib/numbl-core/executors/cJit/chainExecutor.d.ts +0 -27
  316. package/dist-lib/numbl-core/executors/cJit/chainPass.d.ts +0 -42
  317. package/dist-lib/numbl-core/executors/cJit/codegen.d.ts +0 -44
  318. package/dist-lib/numbl-core/executors/cJit/compile.d.ts +0 -45
  319. package/dist-lib/numbl-core/executors/cJit/elemwiseCodegen.d.ts +0 -23
  320. package/dist-lib/numbl-core/executors/cJit/elemwiseStructural.d.ts +0 -33
  321. package/dist-lib/numbl-core/executors/cJit/fuseAnalyze.d.ts +0 -39
  322. package/dist-lib/numbl-core/executors/cJit/fuseCodegen.d.ts +0 -16
  323. package/dist-lib/numbl-core/executors/cJit/fuseExecutor.d.ts +0 -28
  324. package/dist-lib/numbl-core/executors/cJit/loopExecutor.d.ts +0 -32
  325. package/dist-lib/numbl-core/executors/cJit/register.d.ts +0 -10
  326. package/dist-lib/numbl-core/executors/cJit/whitelist.d.ts +0 -15
  327. package/dist-lib/numbl-core/executors/jsJit/callExecutor.d.ts +0 -25
  328. package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegen.d.ts +0 -7
  329. package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegenHoist.d.ts +0 -70
  330. package/dist-lib/numbl-core/executors/jsJit/codegen/jsMultiReduction.d.ts +0 -67
  331. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpers.d.ts +0 -34
  332. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersComplex.d.ts +0 -21
  333. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersIndex.d.ts +0 -33
  334. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersTensor.d.ts +0 -34
  335. package/dist-lib/numbl-core/executors/jsJit/jitCall.d.ts +0 -59
  336. package/dist-lib/numbl-core/executors/jsJit/jitLoop.d.ts +0 -53
  337. package/dist-lib/numbl-core/executors/jsJit/jitTopLevel.d.ts +0 -44
  338. package/dist-lib/numbl-core/executors/jsJit/loopExecutor.d.ts +0 -15
  339. package/dist-lib/numbl-core/executors/jsJit/lower/blockAnalysis.d.ts +0 -37
  340. package/dist-lib/numbl-core/executors/jsJit/lower/jitBailSafety.d.ts +0 -41
  341. package/dist-lib/numbl-core/executors/jsJit/lower/jitLower.d.ts +0 -136
  342. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerExpr.d.ts +0 -36
  343. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerStmt.d.ts +0 -9
  344. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerTypes.d.ts +0 -29
  345. package/dist-lib/numbl-core/executors/jsJit/lower/scalarEmit.d.ts +0 -58
  346. package/dist-lib/numbl-core/executors/jsJit/shared.d.ts +0 -120
  347. package/dist-lib/numbl-core/executors/jsJit/topLevelExecutor.d.ts +0 -17
  348. package/dist-plot-viewer/assets/index-COAM8o1E.js +0 -4426
  349. /package/dist-lib/numbl-core/{executors/jsJit/helpers → runtime}/alloc.d.ts +0 -0
@@ -1,7 +1,12 @@
1
1
  /**
2
- * JIT type system and IR node definitions.
2
+ * JIT type system.
3
+ *
4
+ * Used by the executor classification phase and by the JIT type
5
+ * adapter to map numbl runtime values onto JIT specializations.
6
+ * The IR node definitions that previously lived alongside this file
7
+ * (`JitExpr` / `JitStmt` / `JitCacheEntry`) belonged to the legacy
8
+ * in-tree JS-JIT / C-JIT pipeline and were deleted with it.
3
9
  */
4
- import type { BinaryOperation, UnaryOperation } from "./parser/types.js";
5
10
  export type SignCategory = "positive" | "nonneg" | "nonpositive" | "negative";
6
11
  export type JitType = {
7
12
  kind: "number";
@@ -71,9 +76,6 @@ export declare function isNonneg(t: JitType): boolean;
71
76
  export declare function flipSign(s?: SignCategory): SignCategory | undefined;
72
77
  export declare function unifySign(a?: SignCategory, b?: SignCategory): SignCategory | undefined;
73
78
  export declare function jitTypeKey(t: JitType): string;
74
- export declare function computeJitCacheKey(nargout: number, argTypes: JitType[]): string;
75
- /** Compute a unique JS function name for a JIT'd specialization. */
76
- export declare function computeJitFnName(identity: string, funcName: string): string;
77
79
  /** Widen/unify two types at control-flow join points. */
78
80
  export declare function unifyJitTypes(a: JitType, b: JitType): JitType;
79
81
  export declare function isScalarType(t: JitType): boolean;
@@ -90,319 +92,3 @@ export declare function shapeAfterReduction(shape: number[], dim?: number): {
90
92
  scalar: false;
91
93
  shape: number[];
92
94
  };
93
- export type JitExpr = {
94
- tag: "NumberLiteral";
95
- value: number;
96
- jitType: JitType;
97
- } | {
98
- tag: "ImagLiteral";
99
- jitType: JitType;
100
- } | {
101
- tag: "Var";
102
- name: string;
103
- jitType: JitType;
104
- } | {
105
- tag: "Binary";
106
- op: BinaryOperation;
107
- left: JitExpr;
108
- right: JitExpr;
109
- jitType: JitType;
110
- } | {
111
- tag: "Unary";
112
- op: UnaryOperation;
113
- operand: JitExpr;
114
- jitType: JitType;
115
- } | {
116
- tag: "StringLiteral";
117
- value: string;
118
- isChar: boolean;
119
- jitType: JitType;
120
- } | {
121
- tag: "Call";
122
- name: string;
123
- args: JitExpr[];
124
- jitType: JitType;
125
- } | {
126
- tag: "UserCall";
127
- jitName: string;
128
- name: string;
129
- args: JitExpr[];
130
- jitType: JitType;
131
- } | {
132
- tag: "Index";
133
- base: JitExpr;
134
- indices: JitExpr[];
135
- jitType: JitType;
136
- } | {
137
- /**
138
- * Range slice read on a real tensor: `src(a:b)` producing a fresh
139
- * column-vector tensor of length `b - a + 1`. Stage 21 — unblocks
140
- * chunkie's chunk_nearparam Newton loop which splits a Legendre
141
- * expansion vector via `r0 = all0(1:dim)`.
142
- *
143
- * Codegen emits `$h.subarrayCopy1r(srcData, srcLen, start, end)`
144
- * using the hoisted data/length aliases. Per-iter allocation is
145
- * unavoidable without a range-alias extension to stage 5; small
146
- * slices are cheap in V8 young-gen.
147
- */
148
- tag: "RangeSliceRead";
149
- baseName: string;
150
- start: JitExpr;
151
- /** `null` when the range endpoint is the `end` keyword — codegen
152
- * substitutes the hoisted `.data.length` alias. */
153
- end: JitExpr | null;
154
- /** True when the source is a statically-known row vector
155
- * (shape `[1, n]`); the slice then preserves row orientation.
156
- * Otherwise the slice is a column vector (MATLAB semantics). */
157
- isRow: boolean;
158
- jitType: JitType;
159
- } | {
160
- tag: "TensorLiteral";
161
- rows: JitExpr[][];
162
- nRows: number;
163
- nCols: number;
164
- jitType: JitType;
165
- } | {
166
- /**
167
- * Vertical concat growth: `[base; value]` where `base` is a real
168
- * column-vector (or empty) tensor and `value` is a numeric scalar.
169
- * Lowered from the chunkie grow-a-list pattern `it = [it; i]`.
170
- * Codegens to `$h.vconcatGrow1r(base, value)` which allocates a
171
- * fresh `(k+1, 1)` tensor and copies.
172
- */
173
- tag: "VConcatGrow";
174
- base: JitExpr;
175
- value: JitExpr;
176
- jitType: JitType;
177
- } | {
178
- /**
179
- * Scalar read of a struct field: `s.f` where `s` has a struct type
180
- * with a statically-known scalar field `f`. Lowered from `Member`
181
- * exprs with an `Ident` base. The codegen hoists each unique
182
- * `(baseName, fieldName)` pair to a local alias at function entry
183
- * so per-iter reads are bare local loads (no `Map.get` per use).
184
- * Mirrors the chunkie `opts.rho`, `chnkr.k`, `chnkr.nch` pattern.
185
- */
186
- tag: "MemberRead";
187
- baseName: string;
188
- fieldName: string;
189
- jitType: JitType;
190
- } | {
191
- /**
192
- * Chained struct array member read: `T.nodes(i).leaf` where
193
- * `T.nodes` is a struct array whose elements all share a field
194
- * `leaf`. Lowered from the parser shape
195
- * `Member(MethodCall(Ident(T), "nodes", [i]), "leaf")`.
196
- *
197
- * Codegen hoists `var $T_nodes_elements = T.fields.get("nodes").elements`
198
- * at function entry (one alias per unique (structVarName,
199
- * structArrayFieldName) pair) and emits
200
- * `$T_nodes_elements[Math.round(i) - 1].fields.get("leaf")` per use.
201
- *
202
- * `leafFieldJitType` records the result type: either a scalar
203
- * numeric type (number/boolean/complex_or_number) or a real tensor.
204
- * Tensor-valued leaves work because the existing per-Assign hoist
205
- * refresh picks up the newly-read tensor when the result flows
206
- * into `chld = T.nodes(i).chld` and the callers then use
207
- * `chld(k)` through the hoisted alias path.
208
- */
209
- tag: "StructArrayMemberRead";
210
- structVarName: string;
211
- structArrayFieldName: string;
212
- indexExpr: JitExpr;
213
- leafFieldName: string;
214
- jitType: JitType;
215
- } | {
216
- /**
217
- * Indirect call through a function handle variable: `f(a, b)` where
218
- * `f` has JitType `function_handle`. The codegen emits
219
- * `$h.callFuncHandle($rt, f, arg1, arg2, ...)` which invokes the
220
- * handle via its `jsFn` closure (or falls back to `rt.dispatch`).
221
- * The `returnType` is determined at lowering time by probing the
222
- * function handle's runtime value.
223
- */
224
- tag: "FuncHandleCall";
225
- name: string;
226
- args: JitExpr[];
227
- jitType: JitType;
228
- } | {
229
- /**
230
- * User function call that bailed recursive lowering (stage 24 —
231
- * soft-bail). Instead of bailing the containing loop, emit a
232
- * runtime dispatch through the interpreter. Return type is
233
- * determined at JIT compile time by probing (actually calling
234
- * the function once with representative args). The helper
235
- * `callUserFunc` verifies the actual return type on every call
236
- * and throws `JitFuncHandleBailError` on mismatch so the loop
237
- * runner can invalidate the cache entry and fall back to
238
- * interpretation.
239
- *
240
- * Use case: `oneintp(...)` / `lege.exev(...)` in chunkie's adap
241
- * inner loop — the callee body has tensor arithmetic the JIT
242
- * can't inline, but the outer loop (scalar stack + col-slice
243
- * writes + scalar compares) is a perfect JIT fit.
244
- */
245
- tag: "UserDispatchCall";
246
- name: string;
247
- args: JitExpr[];
248
- jitType: JitType;
249
- };
250
- export type JitStmt = {
251
- tag: "Assign";
252
- name: string;
253
- expr: JitExpr;
254
- } | {
255
- tag: "AssignIndex";
256
- /** Name of the tensor variable being written to (must be an Ident-based lvalue). */
257
- baseName: string;
258
- /** Scalar index expressions (1..3). */
259
- indices: JitExpr[];
260
- /** RHS scalar value to store. */
261
- value: JitExpr;
262
- /** Type of the base tensor (for codegen to choose the right helper). */
263
- baseType: JitType;
264
- } | {
265
- /**
266
- * Range-slice write of the form `dst(a:b) = src(c:d)` or
267
- * `dst(a:b) = src` (whole-tensor source). Both `dst` and `src` must
268
- * be real tensors, and the LHS must use exactly one (linear) range
269
- * index. Used by the loop JIT for the chunkie grow-and-copy pattern.
270
- *
271
- * When `srcStart` and `srcEnd` are both `null`, the source is used
272
- * in its entirety — codegen substitutes `1` and `srcLen` (the
273
- * source's hoisted length alias). This is stage 9's whole-tensor
274
- * RHS form: `isp(1:nn) = itemp` where `itemp` is a plain Var.
275
- */
276
- tag: "AssignIndexRange";
277
- baseName: string;
278
- baseType: JitType;
279
- dstStart: JitExpr;
280
- dstEnd: JitExpr;
281
- srcBaseName: string;
282
- srcType: JitType;
283
- srcStart: JitExpr | null;
284
- srcEnd: JitExpr | null;
285
- } | {
286
- /**
287
- * Multi-dim column slice write `dst(:, j) = src` where both `dst`
288
- * and `src` are real tensors. LHS must be `Index(Ident(dst),
289
- * [Colon, scalar_j])` with `dst` having statically 2-D shape.
290
- * RHS must be a plain Ident referencing a real-tensor var whose
291
- * total element count matches `dst.shape[0]` at runtime.
292
- *
293
- * Used by the loop JIT for chunkie's adapgausskerneval column
294
- * stack write: `vals(:, jj+1) = v2`. Also covers
295
- * chunkerinterior's `rss(:, jj) = rval(:, k)` after a slice
296
- * alias binds the RHS.
297
- */
298
- tag: "AssignIndexCol";
299
- baseName: string;
300
- baseType: JitType;
301
- colIndex: JitExpr;
302
- srcBaseName: string;
303
- srcType: JitType;
304
- } | {
305
- /**
306
- * Page-slice write `dst(:, :, k) = rhs` where `dst` is a 3-D tensor
307
- * and `rhs` is a 2-D tensor. Real-base + complex-rhs upgrades the
308
- * base to complex in place. Drives chunkie helm2d.green's
309
- * `grad(:,:,k) = ...` / `hess(:,:,k) = ...` assignments.
310
- */
311
- tag: "AssignIndexPage3d";
312
- baseName: string;
313
- /** Base tensor type AFTER the write (may be complex even if the
314
- * initializer was real — the lowerer promotes in ctx.env). */
315
- baseType: JitType;
316
- /** Page index (1-based). */
317
- pageIndex: JitExpr;
318
- /** 2-D tensor RHS. */
319
- value: JitExpr;
320
- } | {
321
- /**
322
- * Struct field assign lvalue `s.f = v`. When `needsPromote` is
323
- * true, the base is (re)initialized as a fresh empty struct
324
- * before the field is set — mirrors MATLAB's
325
- * `s = []; s.f = v` idiom that promotes the empty matrix to a
326
- * struct on first field write. `valueType` is the JIT type of
327
- * `value` so stage 12 can hoist subsequent reads through a
328
- * typed alias.
329
- */
330
- tag: "AssignMember";
331
- baseName: string;
332
- fieldName: string;
333
- value: JitExpr;
334
- needsPromote: boolean;
335
- } | {
336
- tag: "If";
337
- cond: JitExpr;
338
- thenBody: JitStmt[];
339
- elseifBlocks: {
340
- cond: JitExpr;
341
- body: JitStmt[];
342
- }[];
343
- elseBody: JitStmt[] | null;
344
- } | {
345
- tag: "For";
346
- varName: string;
347
- start: JitExpr;
348
- step: JitExpr | null;
349
- end: JitExpr;
350
- body: JitStmt[];
351
- } | {
352
- tag: "While";
353
- cond: JitExpr;
354
- body: JitStmt[];
355
- } | {
356
- tag: "Break";
357
- } | {
358
- tag: "Continue";
359
- } | {
360
- tag: "Return";
361
- } | {
362
- tag: "ExprStmt";
363
- expr: JitExpr;
364
- } | {
365
- tag: "MultiAssign";
366
- names: (string | null)[];
367
- callName: string;
368
- args: JitExpr[];
369
- outputTypes: JitType[];
370
- /** Dispatch shape:
371
- * - "ibuiltin" (default) — IBuiltin called via $h.ibcall.
372
- * - "func_handle" — `callName` is a function-handle var name; the
373
- * JIT loads the handle and calls jsFn with the requested nargout.
374
- * - "user" — `callName` is a user-fn name dispatched through the
375
- * interpreter (no specialized JIT artifact for the callee yet).
376
- */
377
- kind?: "ibuiltin" | "func_handle" | "user";
378
- } | {
379
- /**
380
- * Call a synthetic specialization (installed as a forwarder on $h)
381
- * and write back multiple outputs into outer-scope vars. Only
382
- * produced by the hybrid-loop pass in hybrid.ts, which
383
- * replaces a For/While JitStmt with this call form when the
384
- * extracted loop specialization compiled to native C.
385
- *
386
- * Semantics (0 / 1 / N outputs):
387
- * nargout==0 → emit `$h.callUser(...)` as a stmt (no writeback)
388
- * nargout==1 → emit `out = $h.callUser(...)`
389
- * nargout>=2 → emit `var $r = $h.callUser(...); out0=$r[0]; ...`
390
- */
391
- tag: "UserCallWriteback";
392
- outputs: string[];
393
- jitName: string;
394
- name: string;
395
- args: JitExpr[];
396
- outputTypes: JitType[];
397
- } | {
398
- tag: "SetLoc";
399
- line: number;
400
- } | {
401
- /** C-JIT assertion: if this JitStmt survives to JS codegen at --opt 2,
402
- * emit a runtime throw. The C-JIT codegen elides it. */
403
- tag: "AssertCJit";
404
- };
405
- export interface JitCacheEntry {
406
- fn: (...args: unknown[]) => unknown;
407
- source: string;
408
- }
@@ -2,7 +2,7 @@
2
2
  * Loader for .numbl.js user functions.
3
3
  *
4
4
  * Evaluates .numbl.js files that define IBuiltins via
5
- * register({ resolve, jitEmit? }).
5
+ * register({ resolve }).
6
6
  * Supports optional WASM and native shared library bindings via directives:
7
7
  * // wasm: <name>
8
8
  * // native: <name>
@@ -34,7 +34,7 @@ export declare function funcNameFromMtoc2JsFile(fileName: string): string;
34
34
  * records. Each loaded record carries the function name, source file name,
35
35
  * and the IBuiltin object built from the file's `register()` call.
36
36
  *
37
- * Each .numbl.js file calls register({ resolve, jitEmit? }) to define an
37
+ * Each .numbl.js file calls register({ resolve }) to define an
38
38
  * IBuiltin. resolve(argTypes, nargout) returns { outputTypes, apply } or null.
39
39
  *
40
40
  * A .numbl.js file can specify bindings via directives at the top of the file:
@@ -8,6 +8,9 @@ export declare class ClassParser extends FunctionParser {
8
8
  parseClassDef(): Stmt;
9
9
  private parseNameBlock;
10
10
  private parsePropertiesNamesBlock;
11
+ /** Consume a balanced `open ... close` run (handling nesting). Assumes the
12
+ * next token is `open`; no-op otherwise. */
13
+ private skipBalanced;
11
14
  private parseOptionalAttrList;
12
15
  /**
13
16
  * Parse a single method signature.
@@ -8,6 +8,6 @@ export { valuesAreEqual } from "./compare.js";
8
8
  export { displayValue } from "./display.js";
9
9
  export { RTV } from "./constructors.js";
10
10
  export { mAdd, mSub, mMul, mElemMul, mDiv, mElemDiv, mPow, mElemPow, mNeg, mTranspose, mConjugateTranspose, mEqual, mNotEqual, mLess, mLessEqual, mGreater, mGreaterEqual, } from "../helpers/arithmetic.js";
11
- export { COLON_INDEX, indexIntoRTValue as mIndex, storeIntoRTValueIndex as mIndexStore, } from "./indexing.js";
11
+ export { COLON_INDEX, indexIntoRTValue as mIndex, storeIntoRTValueIndex as mIndexStore, charToNumericTensor, numericTensorToChar, } from "./indexing.js";
12
12
  export { getRTValueField as mGetField, setRTValueField as mSetField, } from "./struct-access.js";
13
13
  export { makeRangeTensor as mRange, horzcat, vertcat, } from "./tensor-construction.js";
@@ -1,13 +1,23 @@
1
1
  /**
2
2
  * Indexing, struct field access, range creation, and tensor concatenation.
3
3
  */
4
- import { type RuntimeValue } from "./types.js";
4
+ import { type RuntimeValue, RuntimeTensor, RuntimeChar } from "./types.js";
5
5
  import { type RefcountRuntime } from "./refcount.js";
6
6
  /** Runtime surface needed by index-store mutations. The full Runtime
7
7
  * class satisfies this structurally. */
8
8
  type StoreRuntime = RefcountRuntime;
9
9
  /** Sentinel marker for colon (:) indexing — means "all indices in this dimension" */
10
10
  export declare const COLON_INDEX: RuntimeValue;
11
+ /** Convert a char value to a numeric (column-major) tensor of its code
12
+ * points. A RuntimeChar stores its `value` row-major (each of `shape[0]`
13
+ * rows is `shape[1]` chars, concatenated), so we transpose into the
14
+ * tensor's column-major layout. Used so indexed assignment into / from a
15
+ * char array runs on the numeric tensor machinery (MATLAB treats char as
16
+ * numeric for indexed assignment). */
17
+ export declare function charToNumericTensor(c: RuntimeChar): RuntimeTensor;
18
+ /** Inverse of charToNumericTensor: read a numeric tensor's column-major
19
+ * data into a row-major char value, rounding codes to integers. */
20
+ export declare function numericTensorToChar(t: RuntimeTensor): RuntimeChar;
11
21
  /** Index into a value: v(i1, i2, ...) */
12
22
  export declare function indexIntoRTValue(base: RuntimeValue, indices: RuntimeValue[]): RuntimeValue;
13
23
  /** Store into indexed position: base(indices) = rhs — uses copy-on-write for shared data */
@@ -5,8 +5,8 @@
5
5
  * plot(X1,Y1,LineSpec1,...), and Name-Value pairs like 'Color','r','LineWidth',2.
6
6
  */
7
7
  import { type RuntimeValue } from "./types.js";
8
- export type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, } from "../../graphics/types.js";
9
- import type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace } from "../../graphics/types.js";
8
+ export type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, Quiver3Trace, } from "../../graphics/types.js";
9
+ import type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, Quiver3Trace } from "../../graphics/types.js";
10
10
  export interface ParsedLineSpec {
11
11
  color?: string;
12
12
  lineStyle?: string;
@@ -75,6 +75,20 @@ export declare function parseImagescArgs(args: RuntimeValue[]): ImagescTrace;
75
75
  * contour(..., Name, Value)
76
76
  */
77
77
  export declare function parseContourArgs(args: RuntimeValue[], filled: boolean): ContourTrace;
78
+ /** Result of computing contour geometry: the MATLAB contour matrix `C`
79
+ * (column-major `2 × n` data) plus the level list actually used. */
80
+ export interface ContourMatrix {
81
+ /** Column-major `2 × n` data for a `RTV.tensor(data, [2, n])`. */
82
+ data: number[];
83
+ n: number;
84
+ levelList: number[];
85
+ }
86
+ /** Compute the MATLAB contour matrix for a parsed contour trace via marching
87
+ * squares. Each marching-squares segment is emitted as its own two-vertex
88
+ * contour line (header `[level; 2]` followed by the two `[x; y]` vertices) —
89
+ * a valid contour matrix whose geometry matches MATLAB's connected polylines
90
+ * segment-for-segment. */
91
+ export declare function computeContourMatrix(trace: ContourTrace): ContourMatrix;
78
92
  /**
79
93
  * Parse mesh() arguments — same as surf but with different default rendering.
80
94
  */
@@ -237,3 +251,15 @@ export declare function parseHeatmapArgs(args: RuntimeValue[]): HeatmapTrace;
237
251
  * vectors, X and Y are expanded to a meshgrid.
238
252
  */
239
253
  export declare function parseQuiverArgs(args: RuntimeValue[]): QuiverTrace[];
254
+ /**
255
+ * Parse quiver3() arguments.
256
+ *
257
+ * Supported forms:
258
+ * quiver3(Z, U, V, W)
259
+ * quiver3(X, Y, Z, U, V, W)
260
+ * quiver3(..., scale) — scale: nonnegative number or 'off'
261
+ * quiver3(..., LineSpec)
262
+ * quiver3(..., LineSpec, 'filled')
263
+ * quiver3(..., Name, Value) — Color, LineStyle, LineWidth, ShowArrowHead, …
264
+ */
265
+ export declare function parseQuiver3Args(args: RuntimeValue[]): Quiver3Trace;
@@ -23,6 +23,12 @@ export declare class Runtime {
23
23
  private options;
24
24
  private initialVariableValues?;
25
25
  outputLines: string[];
26
+ /** Stack of in-progress output-capture buffers. While non-empty,
27
+ * `output()` appends to the top buffer instead of emitting, so a
28
+ * speculative JIT attempt's side effects can be committed on success
29
+ * or discarded on bail (preventing duplicated output when the
30
+ * interpreter re-runs the same code). */
31
+ private outputCaptureStack;
26
32
  plotInstructions: PlotInstruction[];
27
33
  variableValues: Record<string, RuntimeValue>;
28
34
  holdState: boolean;
@@ -104,7 +110,6 @@ export declare class Runtime {
104
110
  system?: SystemAdapter;
105
111
  builtins: Record<string, (nargout: number, args: unknown[]) => unknown>;
106
112
  customBuiltins: Record<string, (nargout: number, args: unknown[]) => unknown>;
107
- jitHelpers: Record<string, any> | null;
108
113
  compileSpecialized: ((name: string, argTypes: ItemType[], callSite: CallSite) => ((...args: any[]) => any) | null) | null;
109
114
  evalLocalCallback: ((code: string, initialVars: Record<string, RuntimeValue>, onOutput: (text: string) => void, fileName?: string) => {
110
115
  returnValue: unknown;
@@ -158,6 +163,16 @@ export declare class Runtime {
158
163
  getJitCompileTimeMs(): number;
159
164
  getDispatchUnknownCounts(): Record<string, number>;
160
165
  output(text: string): void;
166
+ /** Begin buffering output for a speculative execution attempt.
167
+ * Pair with exactly one `commitOutputCapture()` or
168
+ * `discardOutputCapture()`. */
169
+ beginOutputCapture(): void;
170
+ /** Emit the buffered output (to the parent capture frame if nested,
171
+ * else to the real sink) — call when the attempt succeeded. */
172
+ commitOutputCapture(): void;
173
+ /** Drop the buffered output — call when the attempt bailed, so a
174
+ * subsequent re-run is the only thing that emits. */
175
+ discardOutputCapture(): void;
161
176
  error(message: string): RuntimeError;
162
177
  annotateError(e: unknown): void;
163
178
  wrapError(e: unknown): RuntimeStruct;
@@ -33,6 +33,9 @@ export declare function plotInstr(plotInstructions: PlotInstruction[], instr: {
33
33
  type: "close_all";
34
34
  } | {
35
35
  type: "clf";
36
+ } | {
37
+ type: "cla";
38
+ reset: boolean;
36
39
  } | {
37
40
  type: "set_subplot";
38
41
  rows: unknown;
@@ -66,6 +69,7 @@ export declare function viewCall(plotInstructions: PlotInstruction[], args: Runt
66
69
  export declare function plotCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
67
70
  export declare function plot3Call(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
68
71
  export declare function surfCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
72
+ export declare function surfaceCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
69
73
  export declare function imagescCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
70
74
  export declare function pcolorCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
71
75
  export declare function contourCall(plotInstructions: PlotInstruction[], args: RuntimeValue[], filled: boolean): void;
@@ -101,6 +105,7 @@ export declare function piechartCall(plotInstructions: PlotInstruction[], args:
101
105
  export declare function donutchartCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
102
106
  export declare function heatmapCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
103
107
  export declare function quiverCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
108
+ export declare function quiver3Call(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
104
109
  export declare function legendCall(plotInstructions: PlotInstruction[], args: RuntimeValue[]): void;
105
110
  export declare function drawnow(plotInstructions: PlotInstruction[], options: ExecOptions): void;
106
111
  export declare function pause(seconds: unknown): void;
@@ -84,6 +84,19 @@ export declare class RuntimeFunction extends Refcounted {
84
84
  vars: Map<string, RuntimeValue>;
85
85
  parent?: unknown;
86
86
  } | undefined;
87
+ /** The defining AST of this handle — an `AnonFunc` (`@(p) body`) or
88
+ * `FuncHandle` (`@name`) parser Expr. Lets the JIT recover the
89
+ * handle's source so a capture-free handle that crosses a
90
+ * compile boundary (a loop input / call arg) can be inlined as an
91
+ * in-scope handle constant. Typed loosely (parser Expr) to avoid a
92
+ * runtime→parser layering dependency; consumers cast. Undefined for
93
+ * handles created by paths that don't set it (e.g. builtins). */
94
+ handleAst: unknown;
95
+ /** Source file the handle was defined in. The inliner only reuses a
96
+ * handle's AST when this matches the file being compiled, so a
97
+ * named-handle target (`@foo`) resolves to the same `foo` it did at
98
+ * definition (file-local functions can shadow across files). */
99
+ handleDefFile: string | undefined;
87
100
  constructor(name: string, impl: "builtin" | "user", captures: RuntimeValue[], jsFn?: (...args: unknown[]) => unknown, jsFnExpectsNargout?: boolean, nargin?: number);
88
101
  protected _destroy(rt: RefcountRuntime): void;
89
102
  }
@@ -103,13 +116,16 @@ export declare class RuntimeClassInstance extends Refcounted {
103
116
  bindField(rt: RefcountRuntime, name: string, value: RuntimeValue): void;
104
117
  protected _destroy(rt: RefcountRuntime): void;
105
118
  }
106
- /** A 1-D array of class instances that all share the same class.
107
- * Created by default horzcat/vertcat when the class doesn't overload them. */
119
+ /** An array of class instances that all share the same class. Created by
120
+ * default horzcat/vertcat when the class doesn't overload them. `elements`
121
+ * are stored in column-major order; `shape` is the 2-D `[rows, cols]` size
122
+ * (defaults to a `1×N` row vector when omitted). */
108
123
  export declare class RuntimeClassInstanceArray extends Refcounted {
109
124
  readonly kind: "class_instance_array";
110
125
  className: string;
111
126
  elements: RuntimeClassInstance[];
112
- constructor(className: string, elements: RuntimeClassInstance[]);
127
+ shape: [number, number];
128
+ constructor(className: string, elements: RuntimeClassInstance[], shape?: [number, number]);
113
129
  protected _destroy(rt: RefcountRuntime): void;
114
130
  }
115
131
  export declare class RuntimeComplexNumber extends Refcounted {
@@ -1,2 +1,2 @@
1
1
  /** Numbl version, used for JIT disk cache invalidation. */
2
- export declare const NUMBL_VERSION = "0.3.3";
2
+ export declare const NUMBL_VERSION = "0.4.1";
@@ -10,7 +10,15 @@ export interface WorkspaceFile {
10
10
  * Bridge for loading native shared libraries (.so/.dll/.dylib).
11
11
  * Implemented outside numbl-core (e.g. via koffi in the CLI) since
12
12
  * native FFI is not available in browser environments.
13
+ *
14
+ * `koffi`, when present, exposes the root koffi module so the
15
+ * C-JIT executors can call its struct / alloc / encode / decode
16
+ * helpers. Browser deployments leave `koffi` undefined; the
17
+ * C-JIT executors decline (numbl falls back to JS-JIT).
13
18
  */
14
19
  export interface NativeBridge {
15
20
  load(libraryPath: string): unknown;
21
+ /** koffi root module — `require("koffi")`'s exports. Only the
22
+ * C-JIT path consumes it. Optional so non-Node hosts can omit. */
23
+ koffi?: unknown;
16
24
  }