numbl 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/binding.gyp +6 -5
  2. package/dist-cli/cli.js +62367 -41985
  3. package/dist-lib/lib.d.ts +0 -1
  4. package/dist-lib/lib.js +79083 -58956
  5. package/dist-lib/numbl-core/executeCode.d.ts +10 -12
  6. package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
  7. package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
  8. package/dist-lib/numbl-core/executors/index.d.ts +0 -3
  9. package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +35 -0
  10. package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +31 -0
  11. package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +29 -0
  12. package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +45 -0
  13. package/dist-lib/numbl-core/executors/jit/compileC.d.ts +51 -0
  14. package/dist-lib/numbl-core/executors/jit/compileC.node.d.ts +25 -0
  15. package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +27 -0
  16. package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +41 -0
  17. package/dist-lib/numbl-core/executors/jit/session.d.ts +17 -0
  18. package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +36 -0
  19. package/dist-lib/numbl-core/executors/jit/typeAdapter.d.ts +28 -0
  20. package/dist-lib/numbl-core/executors/jit/typeAdapterC.d.ts +73 -0
  21. package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +48 -0
  22. package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +108 -0
  23. package/dist-lib/numbl-core/executors/lowering.d.ts +31 -77
  24. package/dist-lib/numbl-core/executors/plugins.d.ts +14 -21
  25. package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
  26. package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
  27. package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +0 -18
  28. package/dist-lib/numbl-core/interpreter/interpreter.d.ts +36 -20
  29. package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
  30. package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +1 -1
  31. package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +43 -0
  32. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +123 -0
  33. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/minus.d.ts +2 -0
  34. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mpower.d.ts +12 -0
  35. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mrdivide.d.ts +5 -0
  36. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mtimes.d.ts +2 -0
  37. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/plus.d.ts +2 -0
  38. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/power.d.ts +30 -0
  39. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/rdivide.d.ts +2 -0
  40. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/times.d.ts +2 -0
  41. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/uminus.d.ts +2 -0
  42. package/dist-lib/numbl-core/jit/builtins/defs/compare/_compare.d.ts +12 -0
  43. package/dist-lib/numbl-core/jit/builtins/defs/compare/eq.d.ts +2 -0
  44. package/dist-lib/numbl-core/jit/builtins/defs/compare/ge.d.ts +2 -0
  45. package/dist-lib/numbl-core/jit/builtins/defs/compare/gt.d.ts +2 -0
  46. package/dist-lib/numbl-core/jit/builtins/defs/compare/le.d.ts +2 -0
  47. package/dist-lib/numbl-core/jit/builtins/defs/compare/lt.d.ts +2 -0
  48. package/dist-lib/numbl-core/jit/builtins/defs/compare/ne.d.ts +2 -0
  49. package/dist-lib/numbl-core/jit/builtins/defs/diag/assert.d.ts +6 -0
  50. package/dist-lib/numbl-core/jit/builtins/defs/io/_format_args.d.ts +17 -0
  51. package/dist-lib/numbl-core/jit/builtins/defs/io/disp.d.ts +2 -0
  52. package/dist-lib/numbl-core/jit/builtins/defs/io/error.d.ts +2 -0
  53. package/dist-lib/numbl-core/jit/builtins/defs/io/fprintf.d.ts +2 -0
  54. package/dist-lib/numbl-core/jit/builtins/defs/io/sprintf.d.ts +2 -0
  55. package/dist-lib/numbl-core/jit/builtins/defs/io/warning.d.ts +15 -0
  56. package/dist-lib/numbl-core/jit/builtins/defs/logical/_shortcircuit.d.ts +30 -0
  57. package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +30 -0
  58. package/dist-lib/numbl-core/jit/builtins/defs/logical/and.d.ts +5 -0
  59. package/dist-lib/numbl-core/jit/builtins/defs/logical/andand.d.ts +1 -0
  60. package/dist-lib/numbl-core/jit/builtins/defs/logical/boolconst.d.ts +3 -0
  61. package/dist-lib/numbl-core/jit/builtins/defs/logical/classBuiltin.d.ts +21 -0
  62. package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +15 -0
  63. package/dist-lib/numbl-core/jit/builtins/defs/logical/isa.d.ts +13 -0
  64. package/dist-lib/numbl-core/jit/builtins/defs/logical/iscell.d.ts +8 -0
  65. package/dist-lib/numbl-core/jit/builtins/defs/logical/isempty.d.ts +2 -0
  66. package/dist-lib/numbl-core/jit/builtins/defs/logical/isequal.d.ts +2 -0
  67. package/dist-lib/numbl-core/jit/builtins/defs/logical/isfield.d.ts +20 -0
  68. package/dist-lib/numbl-core/jit/builtins/defs/logical/isinf.d.ts +2 -0
  69. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnan.d.ts +1 -0
  70. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnumeric.d.ts +7 -0
  71. package/dist-lib/numbl-core/jit/builtins/defs/logical/isreal.d.ts +2 -0
  72. package/dist-lib/numbl-core/jit/builtins/defs/logical/isscalar.d.ts +20 -0
  73. package/dist-lib/numbl-core/jit/builtins/defs/logical/isstruct.d.ts +7 -0
  74. package/dist-lib/numbl-core/jit/builtins/defs/logical/logical.d.ts +1 -0
  75. package/dist-lib/numbl-core/jit/builtins/defs/logical/not.d.ts +15 -0
  76. package/dist-lib/numbl-core/jit/builtins/defs/logical/or.d.ts +11 -0
  77. package/dist-lib/numbl-core/jit/builtins/defs/logical/oror.d.ts +1 -0
  78. package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +21 -0
  79. package/dist-lib/numbl-core/jit/builtins/defs/logical/typequery.d.ts +10 -0
  80. package/dist-lib/numbl-core/jit/builtins/defs/logical/xor.d.ts +12 -0
  81. package/dist-lib/numbl-core/jit/builtins/defs/math/_complex_fold.d.ts +34 -0
  82. package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +51 -0
  83. package/dist-lib/numbl-core/jit/builtins/defs/math/abs.d.ts +7 -0
  84. package/dist-lib/numbl-core/jit/builtins/defs/math/angle.d.ts +7 -0
  85. package/dist-lib/numbl-core/jit/builtins/defs/math/asinh.d.ts +1 -0
  86. package/dist-lib/numbl-core/jit/builtins/defs/math/atan.d.ts +1 -0
  87. package/dist-lib/numbl-core/jit/builtins/defs/math/atan2.d.ts +3 -0
  88. package/dist-lib/numbl-core/jit/builtins/defs/math/besselh.d.ts +2 -0
  89. package/dist-lib/numbl-core/jit/builtins/defs/math/ceil.d.ts +4 -0
  90. package/dist-lib/numbl-core/jit/builtins/defs/math/conj.d.ts +7 -0
  91. package/dist-lib/numbl-core/jit/builtins/defs/math/constants.d.ts +7 -0
  92. package/dist-lib/numbl-core/jit/builtins/defs/math/cos.d.ts +1 -0
  93. package/dist-lib/numbl-core/jit/builtins/defs/math/cosh.d.ts +1 -0
  94. package/dist-lib/numbl-core/jit/builtins/defs/math/dot.d.ts +20 -0
  95. package/dist-lib/numbl-core/jit/builtins/defs/math/double.d.ts +28 -0
  96. package/dist-lib/numbl-core/jit/builtins/defs/math/exp.d.ts +1 -0
  97. package/dist-lib/numbl-core/jit/builtins/defs/math/fix.d.ts +4 -0
  98. package/dist-lib/numbl-core/jit/builtins/defs/math/floor.d.ts +4 -0
  99. package/dist-lib/numbl-core/jit/builtins/defs/math/hypot.d.ts +3 -0
  100. package/dist-lib/numbl-core/jit/builtins/defs/math/imag.d.ts +7 -0
  101. package/dist-lib/numbl-core/jit/builtins/defs/math/linspace.d.ts +6 -0
  102. package/dist-lib/numbl-core/jit/builtins/defs/math/log.d.ts +4 -0
  103. package/dist-lib/numbl-core/jit/builtins/defs/math/log10.d.ts +3 -0
  104. package/dist-lib/numbl-core/jit/builtins/defs/math/log2.d.ts +5 -0
  105. package/dist-lib/numbl-core/jit/builtins/defs/math/logspace.d.ts +8 -0
  106. package/dist-lib/numbl-core/jit/builtins/defs/math/mod.d.ts +1 -0
  107. package/dist-lib/numbl-core/jit/builtins/defs/math/norm.d.ts +2 -0
  108. package/dist-lib/numbl-core/jit/builtins/defs/math/real.d.ts +7 -0
  109. package/dist-lib/numbl-core/jit/builtins/defs/math/rem.d.ts +3 -0
  110. package/dist-lib/numbl-core/jit/builtins/defs/math/round.d.ts +1 -0
  111. package/dist-lib/numbl-core/jit/builtins/defs/math/sign.d.ts +5 -0
  112. package/dist-lib/numbl-core/jit/builtins/defs/math/sin.d.ts +1 -0
  113. package/dist-lib/numbl-core/jit/builtins/defs/math/sinh.d.ts +1 -0
  114. package/dist-lib/numbl-core/jit/builtins/defs/math/sqrt.d.ts +11 -0
  115. package/dist-lib/numbl-core/jit/builtins/defs/math/tan.d.ts +1 -0
  116. package/dist-lib/numbl-core/jit/builtins/defs/math/tanh.d.ts +1 -0
  117. package/dist-lib/numbl-core/jit/builtins/defs/math/uniquetol.d.ts +22 -0
  118. package/dist-lib/numbl-core/jit/builtins/defs/plot/dispatch.d.ts +6 -0
  119. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_cumulative.d.ts +49 -0
  120. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +126 -0
  121. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_variance.d.ts +17 -0
  122. package/dist-lib/numbl-core/jit/builtins/defs/reduction/all.d.ts +1 -0
  123. package/dist-lib/numbl-core/jit/builtins/defs/reduction/any.d.ts +1 -0
  124. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummax.d.ts +1 -0
  125. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummin.d.ts +1 -0
  126. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumprod.d.ts +1 -0
  127. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumsum.d.ts +1 -0
  128. package/dist-lib/numbl-core/jit/builtins/defs/reduction/diff.d.ts +16 -0
  129. package/dist-lib/numbl-core/jit/builtins/defs/reduction/length.d.ts +2 -0
  130. package/dist-lib/numbl-core/jit/builtins/defs/reduction/max.d.ts +1 -0
  131. package/dist-lib/numbl-core/jit/builtins/defs/reduction/mean.d.ts +1 -0
  132. package/dist-lib/numbl-core/jit/builtins/defs/reduction/min.d.ts +1 -0
  133. package/dist-lib/numbl-core/jit/builtins/defs/reduction/numel.d.ts +2 -0
  134. package/dist-lib/numbl-core/jit/builtins/defs/reduction/prod.d.ts +1 -0
  135. package/dist-lib/numbl-core/jit/builtins/defs/reduction/std.d.ts +1 -0
  136. package/dist-lib/numbl-core/jit/builtins/defs/reduction/sum.d.ts +1 -0
  137. package/dist-lib/numbl-core/jit/builtins/defs/reduction/var.d.ts +1 -0
  138. package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +67 -0
  139. package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +34 -0
  140. package/dist-lib/numbl-core/jit/builtins/defs/shape/cat.d.ts +33 -0
  141. package/dist-lib/numbl-core/jit/builtins/defs/shape/diag.d.ts +29 -0
  142. package/dist-lib/numbl-core/jit/builtins/defs/shape/eye.d.ts +5 -0
  143. package/dist-lib/numbl-core/jit/builtins/defs/shape/flip.d.ts +7 -0
  144. package/dist-lib/numbl-core/jit/builtins/defs/shape/meshgrid.d.ts +12 -0
  145. package/dist-lib/numbl-core/jit/builtins/defs/shape/ones.d.ts +1 -0
  146. package/dist-lib/numbl-core/jit/builtins/defs/shape/repmat.d.ts +37 -0
  147. package/dist-lib/numbl-core/jit/builtins/defs/shape/reshape.d.ts +39 -0
  148. package/dist-lib/numbl-core/jit/builtins/defs/shape/size.d.ts +20 -0
  149. package/dist-lib/numbl-core/jit/builtins/defs/shape/sort.d.ts +19 -0
  150. package/dist-lib/numbl-core/jit/builtins/defs/shape/transpose.d.ts +6 -0
  151. package/dist-lib/numbl-core/jit/builtins/defs/shape/tril.d.ts +16 -0
  152. package/dist-lib/numbl-core/jit/builtins/defs/shape/triu.d.ts +16 -0
  153. package/dist-lib/numbl-core/jit/builtins/defs/shape/zeros.d.ts +1 -0
  154. package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +20 -0
  155. package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +36 -0
  156. package/dist-lib/numbl-core/jit/builtins/defs/system/pathBuiltins.d.ts +4 -0
  157. package/dist-lib/numbl-core/jit/builtins/defs/system/tic.d.ts +8 -0
  158. package/dist-lib/numbl-core/jit/builtins/defs/system/toc.d.ts +5 -0
  159. package/dist-lib/numbl-core/jit/builtins/index.d.ts +16 -0
  160. package/dist-lib/numbl-core/jit/builtins/registry.d.ts +138 -0
  161. package/dist-lib/numbl-core/jit/builtins/runtime/cell/cell.d.ts +24 -0
  162. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/loop_count.d.ts +1 -0
  163. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/range_value.d.ts +1 -0
  164. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/scalar_index.d.ts +11 -0
  165. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/tensor_make_range.d.ts +5 -0
  166. package/dist-lib/numbl-core/jit/builtins/runtime/io/assert_fmt.d.ts +1 -0
  167. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_complex.d.ts +1 -0
  168. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_double.d.ts +1 -0
  169. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_struct.d.ts +1 -0
  170. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor.d.ts +1 -0
  171. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor_complex.d.ts +1 -0
  172. package/dist-lib/numbl-core/jit/builtins/runtime/io/error_fmt.d.ts +2 -0
  173. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_complex.d.ts +1 -0
  174. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_double.d.ts +1 -0
  175. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_engine.d.ts +1 -0
  176. package/dist-lib/numbl-core/jit/builtins/runtime/io/fprintf.d.ts +1 -0
  177. package/dist-lib/numbl-core/jit/builtins/runtime/io/sprintf.d.ts +5 -0
  178. package/dist-lib/numbl-core/jit/builtins/runtime/io/warning_fmt.d.ts +2 -0
  179. package/dist-lib/numbl-core/jit/builtins/runtime/plot/plot_dispatch.d.ts +1 -0
  180. package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +86 -0
  181. package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
  182. package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +103 -0
  183. package/dist-lib/numbl-core/jit/builtins/runtime/system/deep_clone.d.ts +1 -0
  184. package/dist-lib/numbl-core/jit/builtins/runtime/system/isequal.d.ts +2 -0
  185. package/dist-lib/numbl-core/jit/builtins/runtime/system/tictoc.d.ts +5 -0
  186. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor.d.ts +6 -0
  187. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc.d.ts +5 -0
  188. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_complex.d.ts +6 -0
  189. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd.d.ts +5 -0
  190. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd_complex.d.ts +6 -0
  191. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_copy_complex.d.ts +6 -0
  192. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix.d.ts +5 -0
  193. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix_complex.d.ts +6 -0
  194. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row.d.ts +5 -0
  195. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row_complex.d.ts +6 -0
  196. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cat.d.ts +11 -0
  197. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cumulative.d.ts +32 -0
  198. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diag.d.ts +33 -0
  199. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diff.d.ts +5 -0
  200. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_dot.d.ts +16 -0
  201. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_complex.d.ts +90 -0
  202. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real.d.ts +75 -0
  203. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +95 -0
  204. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_eye.d.ts +10 -0
  205. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_nd.d.ts +11 -0
  206. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_square.d.ts +5 -0
  207. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_flip.d.ts +11 -0
  208. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_linspace.d.ts +5 -0
  209. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logical_real.d.ts +10 -0
  210. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logspace.d.ts +5 -0
  211. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_meshgrid.d.ts +29 -0
  212. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_complex.d.ts +10 -0
  213. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_real.d.ts +6 -0
  214. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_norm.d.ts +4 -0
  215. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_nd.d.ts +5 -0
  216. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_square.d.ts +5 -0
  217. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_predicate.d.ts +42 -0
  218. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_complex.d.ts +53 -0
  219. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +42 -0
  220. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_repmat.d.ts +11 -0
  221. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd.d.ts +5 -0
  222. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd_complex.d.ts +6 -0
  223. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_size.d.ts +5 -0
  224. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_sort_real.d.ts +36 -0
  225. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose.d.ts +5 -0
  226. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose_complex.d.ts +6 -0
  227. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_triangular.d.ts +22 -0
  228. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_complex_math.d.ts +128 -0
  229. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +95 -0
  230. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_uniquetol.d.ts +5 -0
  231. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_var.d.ts +12 -0
  232. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_nd.d.ts +5 -0
  233. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_square.d.ts +5 -0
  234. package/dist-lib/numbl-core/jit/builtins/runtime/text/strcmp.d.ts +2 -0
  235. package/dist-lib/numbl-core/jit/codegen/cFormat.d.ts +36 -0
  236. package/dist-lib/numbl-core/jit/codegen/cHelpers.d.ts +48 -0
  237. package/dist-lib/numbl-core/jit/codegen/emit.d.ts +55 -0
  238. package/dist-lib/numbl-core/jit/codegen/emitCellTypedef.d.ts +23 -0
  239. package/dist-lib/numbl-core/jit/codegen/emitExpr.d.ts +33 -0
  240. package/dist-lib/numbl-core/jit/codegen/emitIndex.d.ts +56 -0
  241. package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +64 -0
  242. package/dist-lib/numbl-core/jit/codegen/emitNamedTypedef.d.ts +58 -0
  243. package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +76 -0
  244. package/dist-lib/numbl-core/jit/codegen/emitTensorConcat.d.ts +23 -0
  245. package/dist-lib/numbl-core/jit/codegen/emitTensorConcatJs.d.ts +16 -0
  246. package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +77 -0
  247. package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +66 -0
  248. package/dist-lib/numbl-core/jit/codegen/liveness.d.ts +58 -0
  249. package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +24 -0
  250. package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +150 -0
  251. package/dist-lib/numbl-core/jit/compileSpec.d.ts +84 -0
  252. package/dist-lib/numbl-core/jit/compileSpecC.d.ts +93 -0
  253. package/dist-lib/numbl-core/jit/index.d.ts +15 -0
  254. package/dist-lib/numbl-core/jit/lowering/classDefs.d.ts +109 -0
  255. package/dist-lib/numbl-core/jit/lowering/errors.d.ts +35 -0
  256. package/dist-lib/numbl-core/jit/lowering/indexFold.d.ts +31 -0
  257. package/dist-lib/numbl-core/jit/lowering/indexResolve.d.ts +100 -0
  258. package/dist-lib/numbl-core/jit/lowering/ir.d.ts +584 -0
  259. package/dist-lib/numbl-core/jit/lowering/lower.d.ts +271 -0
  260. package/dist-lib/numbl-core/jit/lowering/lowerCellIndex.d.ts +41 -0
  261. package/dist-lib/numbl-core/jit/lowering/lowerCellLit.d.ts +19 -0
  262. package/dist-lib/numbl-core/jit/lowering/lowerClassConstructor.d.ts +55 -0
  263. package/dist-lib/numbl-core/jit/lowering/lowerFuncCall.d.ts +34 -0
  264. package/dist-lib/numbl-core/jit/lowering/lowerHandle.d.ts +57 -0
  265. package/dist-lib/numbl-core/jit/lowering/lowerIndexLoad.d.ts +16 -0
  266. package/dist-lib/numbl-core/jit/lowering/lowerIndexSlice.d.ts +29 -0
  267. package/dist-lib/numbl-core/jit/lowering/lowerIndexSliceStore.d.ts +19 -0
  268. package/dist-lib/numbl-core/jit/lowering/lowerIndexStore.d.ts +14 -0
  269. package/dist-lib/numbl-core/jit/lowering/lowerMethodCall.d.ts +45 -0
  270. package/dist-lib/numbl-core/jit/lowering/lowerMultiAssign.d.ts +36 -0
  271. package/dist-lib/numbl-core/jit/lowering/lowerTensorLit.d.ts +25 -0
  272. package/dist-lib/numbl-core/jit/lowering/rangeCount.d.ts +19 -0
  273. package/dist-lib/numbl-core/jit/lowering/specialize.d.ts +93 -0
  274. package/dist-lib/numbl-core/jit/lowering/types.d.ts +503 -0
  275. package/dist-lib/numbl-core/jit/lowering/walk.d.ts +17 -0
  276. package/dist-lib/numbl-core/jit/numbl/index.d.ts +30 -0
  277. package/dist-lib/numbl-core/jit/parser/astUtils.d.ts +43 -0
  278. package/dist-lib/numbl-core/jit/parser/index.d.ts +12 -0
  279. package/dist-lib/numbl-core/jit/parser/sourceLoc.d.ts +12 -0
  280. package/dist-lib/numbl-core/jit/runtime/context.d.ts +23 -0
  281. package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +10 -0
  282. package/dist-lib/numbl-core/jit/runtime/value.d.ts +101 -0
  283. package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +59 -0
  284. package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +62 -0
  285. package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +243 -0
  286. package/dist-lib/numbl-core/jitTypes.d.ts +7 -321
  287. package/dist-lib/numbl-core/jsUserFunctions.d.ts +2 -2
  288. package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
  289. package/dist-lib/numbl-core/runtime/index.d.ts +1 -1
  290. package/dist-lib/numbl-core/runtime/indexing.d.ts +11 -1
  291. package/dist-lib/numbl-core/runtime/runtime.d.ts +16 -1
  292. package/dist-lib/numbl-core/runtime/types.d.ts +13 -0
  293. package/dist-lib/numbl-core/version.d.ts +1 -1
  294. package/dist-lib/numbl-core/workspace/types.d.ts +8 -0
  295. package/dist-site-viewer/404.html +33 -0
  296. package/dist-site-viewer/assets/index-CgBUy7v7.js +4748 -0
  297. package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
  298. package/dist-site-viewer/assets/numbl-worker-VkVtodCX.js +11836 -0
  299. package/dist-site-viewer/coi-serviceworker.js +70 -0
  300. package/dist-site-viewer/favicon.svg +23 -0
  301. package/dist-site-viewer/index.html +16 -0
  302. package/dist-site-viewer/logo.svg +26 -0
  303. package/dist-site-viewer/numbl-embed.js +111 -0
  304. package/dist-site-viewer/vite.svg +1 -0
  305. package/native/ops/real_unary_elemwise.c +3 -1
  306. package/package.json +15 -9
  307. package/dist-lib/numbl-core/executors/cJit/builtins.d.ts +0 -30
  308. package/dist-lib/numbl-core/executors/cJit/chainCodegen.d.ts +0 -59
  309. package/dist-lib/numbl-core/executors/cJit/chainExecutor.d.ts +0 -27
  310. package/dist-lib/numbl-core/executors/cJit/chainPass.d.ts +0 -42
  311. package/dist-lib/numbl-core/executors/cJit/codegen.d.ts +0 -44
  312. package/dist-lib/numbl-core/executors/cJit/compile.d.ts +0 -45
  313. package/dist-lib/numbl-core/executors/cJit/elemwiseCodegen.d.ts +0 -23
  314. package/dist-lib/numbl-core/executors/cJit/elemwiseStructural.d.ts +0 -33
  315. package/dist-lib/numbl-core/executors/cJit/fuseAnalyze.d.ts +0 -39
  316. package/dist-lib/numbl-core/executors/cJit/fuseCodegen.d.ts +0 -16
  317. package/dist-lib/numbl-core/executors/cJit/fuseExecutor.d.ts +0 -28
  318. package/dist-lib/numbl-core/executors/cJit/loopExecutor.d.ts +0 -32
  319. package/dist-lib/numbl-core/executors/cJit/register.d.ts +0 -10
  320. package/dist-lib/numbl-core/executors/cJit/whitelist.d.ts +0 -15
  321. package/dist-lib/numbl-core/executors/jsJit/callExecutor.d.ts +0 -25
  322. package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegen.d.ts +0 -7
  323. package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegenHoist.d.ts +0 -70
  324. package/dist-lib/numbl-core/executors/jsJit/codegen/jsMultiReduction.d.ts +0 -67
  325. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpers.d.ts +0 -34
  326. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersComplex.d.ts +0 -21
  327. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersIndex.d.ts +0 -33
  328. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersTensor.d.ts +0 -34
  329. package/dist-lib/numbl-core/executors/jsJit/jitCall.d.ts +0 -59
  330. package/dist-lib/numbl-core/executors/jsJit/jitLoop.d.ts +0 -53
  331. package/dist-lib/numbl-core/executors/jsJit/jitTopLevel.d.ts +0 -44
  332. package/dist-lib/numbl-core/executors/jsJit/loopExecutor.d.ts +0 -15
  333. package/dist-lib/numbl-core/executors/jsJit/lower/blockAnalysis.d.ts +0 -37
  334. package/dist-lib/numbl-core/executors/jsJit/lower/jitBailSafety.d.ts +0 -41
  335. package/dist-lib/numbl-core/executors/jsJit/lower/jitLower.d.ts +0 -136
  336. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerExpr.d.ts +0 -36
  337. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerStmt.d.ts +0 -9
  338. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerTypes.d.ts +0 -29
  339. package/dist-lib/numbl-core/executors/jsJit/lower/scalarEmit.d.ts +0 -58
  340. package/dist-lib/numbl-core/executors/jsJit/shared.d.ts +0 -120
  341. package/dist-lib/numbl-core/executors/jsJit/topLevelExecutor.d.ts +0 -17
  342. /package/dist-lib/numbl-core/{executors/jsJit/helpers → runtime}/alloc.d.ts +0 -0
@@ -1,39 +0,0 @@
1
- /**
2
- * c-jit-fuse — structural feasibility analysis on a single AST `Assign`.
3
- *
4
- * Walks the AST directly (not the JS-JIT IR — that pipeline is sized
5
- * for whole-function lowering). Determines whether the RHS expression
6
- * tree can be compiled to a single-pass element-wise C kernel, and
7
- * extracts the tensor / scalar input identifiers in a stable order.
8
- *
9
- * Returns `null` when the stmt isn't a fusable shape — caller (the
10
- * lowering pipeline) then leaves the stmt for the interpreter.
11
- *
12
- * Today's scope: real-only, plain-Ident LHS, same-shape tensor
13
- * leaves. Broadcasting, complex tensors, and in-place mutation are
14
- * not handled yet.
15
- */
16
- import { type Expr, type Stmt } from "../../parser/types.js";
17
- import type { Environment } from "../../interpreter/types.js";
18
- /** Per-leaf classification: tensor, scalar (number), or literal. */
19
- export type LeafKind = "tensor" | "scalar";
20
- export interface FuseClassification {
21
- /** Output variable name (LHS of the Assign). */
22
- readonly outputName: string;
23
- /** Tensor inputs in the order they should appear as C parameters. */
24
- readonly tensorInputs: readonly string[];
25
- /** Scalar inputs in the order they should appear as C parameters. */
26
- readonly scalarInputs: readonly string[];
27
- /** The RHS expression, kept as AST for codegen to walk. */
28
- readonly rhs: Expr;
29
- /** Stable cache key projected from the AST shape and per-leaf
30
- * classification. Drops sizes — those are runtime-only and live
31
- * in `propose()`. */
32
- readonly cacheKey: string;
33
- /** Per-name kind, used by codegen to map identifiers to either
34
- * `tN[i]` (tensor) or `sN` (scalar). */
35
- readonly kindOf: ReadonlyMap<string, LeafKind>;
36
- }
37
- /** Determine whether `stmt` is a fusable Assign and, if so, return
38
- * its classification. Returns null on any structural mismatch. */
39
- export declare function analyzeFuse(stmt: Stmt, env: Environment): FuseClassification | null;
@@ -1,16 +0,0 @@
1
- /**
2
- * c-jit-fuse codegen — single-pass element-wise C kernel.
3
- *
4
- * Emits one C function whose body is a single `for (long i = 0; i < n; i++)`
5
- * loop with `out[i] = <fused expression>;`. The fused expression is
6
- * the AST RHS, with each `Ident` mapped to either `tN[i]` (tensor)
7
- * or `sN` (scalar) via `emitElemwiseExpr`'s leaf callback.
8
- *
9
- * ABI:
10
- * void <fnName>(double *out, long n,
11
- * const double *t0, const double *t1, ...,
12
- * double s0, double s1, ...);
13
- */
14
- import type { FuseClassification } from "./fuseAnalyze.js";
15
- /** Emit a complete C source file for a fuse classification. */
16
- export declare function generateFuseCSource(fnName: string, cls: FuseClassification): string;
@@ -1,28 +0,0 @@
1
- /**
2
- * c-jit-fuse — element-wise tensor op fusion.
3
- *
4
- * - `propose()` filters on `lowered.kind === "fuse"`. Reads each
5
- * tensor input's `numel` from env and verifies they all match;
6
- * declines below a per-call threshold so small tensors stay on
7
- * the interpreter path.
8
- *
9
- * - `compile()` emits a single-pass C kernel, builds the koffi
10
- * declaration, calls `compileAndLoad`. Surfaces the source via
11
- * `interp.onCJitCompile` for `--dump-c`.
12
- *
13
- * - `run()` gathers tensor data + scalar values, allocates an
14
- * output `Float64Array(numel)`, invokes the kernel, wraps the
15
- * output as a real `RuntimeTensor` whose shape mirrors the first
16
- * tensor input's, and writes back.
17
- */
18
- import type { Executor } from "../types.js";
19
- import type { FuseLoweredStmt } from "../lowering.js";
20
- import { type CompiledC } from "./compile.js";
21
- interface CFuseCompiled {
22
- readonly compiled: CompiledC;
23
- readonly tensorInputs: readonly string[];
24
- readonly scalarInputs: readonly string[];
25
- readonly source: string;
26
- }
27
- export declare const cJitFuseExecutor: Executor<FuseLoweredStmt, CFuseCompiled | null>;
28
- export {};
@@ -1,32 +0,0 @@
1
- /**
2
- * c-jit-loop — C codegen executor for scalar for/while loops.
3
- *
4
- * - `propose()` filters on `lowered.kind === "loop"`, requires a
5
- * wired `nativeBridge`, applies the C feasibility whitelist, and
6
- * rejects loops containing IO + bail-risk.
7
- *
8
- * - `compile()` generates C source from the lowered IR, caches the
9
- * compiled `.so` under `~/.cache/numbl/c-jit/<sha>.so`, and loads
10
- * via koffi.
11
- *
12
- * - `run()` reads loop inputs from the interpreter env, marshals
13
- * complex values to (re, im) pairs, invokes the compiled C
14
- * function with an output Float64Array, and writes the outputs
15
- * back to env.
16
- */
17
- import type { Executor } from "../types.js";
18
- import type { LoopLowered } from "../jsJit/jitLoop.js";
19
- import { type VarEncoding } from "./codegen.js";
20
- import { type CompiledC } from "./compile.js";
21
- interface CLoopCompiled {
22
- readonly compiled: CompiledC;
23
- readonly inputs: readonly string[];
24
- readonly outputs: readonly string[];
25
- readonly inputEncodings: readonly VarEncoding[];
26
- readonly outputEncodings: readonly VarEncoding[];
27
- /** Total `double` slots in `out` — sum of per-output slot counts. */
28
- readonly outputSlots: number;
29
- readonly source: string;
30
- }
31
- export declare const cJitLoopExecutor: Executor<LoopLowered, CLoopCompiled | null>;
32
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Node-only entry that wires the C-JIT executors into the shared
3
- * `plugins.ts` registrar slot. Importing this module for its side
4
- * effect (from `cli.ts`) is what makes `--opt e3` work in the CLI.
5
- *
6
- * The browser worker bundle deliberately does not import this file,
7
- * keeping `compile.ts` (and its `node:fs`/`node:os`/`node:child_process`
8
- * imports) out of the web build's module graph.
9
- */
10
- export {};
@@ -1,15 +0,0 @@
1
- /**
2
- * c-jit-loop feasibility whitelist.
3
- *
4
- * Walks a `LoopLowered` IR body and returns true iff every node is
5
- * something the C codegen can emit. Nodes outside the whitelist
6
- * (tensor ops, struct field access, etc.) cause `propose()` to
7
- * decline so the dispatcher falls through to the interpreter.
8
- *
9
- * Today's scope: scalar-only loops, real or complex (pair-of-doubles
10
- * encoding). Math builtins on complex args are NOT supported except
11
- * `real`, `imag`, and `conj`.
12
- */
13
- import type { JitStmt, JitType } from "../../jitTypes.js";
14
- export declare function isCScalarType(t: JitType): boolean;
15
- export declare function isCJitFeasible(body: readonly JitStmt[]): boolean;
@@ -1,25 +0,0 @@
1
- /**
2
- * js-jit-call — JS codegen executor for the call shape.
3
- *
4
- * Lowering is the dispatcher's job. The call executor receives the
5
- * lowered IR (with pre-computed feasibility flags) as the first arg
6
- * to propose, decides whether to commit, and produces a compiled JS
7
- * artifact on commit.
8
- *
9
- * - `propose()` filters on `lowered.kind === "call"`, applies
10
- * IO+bail-risk feasibility check. Returns null to decline.
11
- *
12
- * - `compile()` calls `generateCallJS` against the lowered IR.
13
- * Cached by the registry under the classification's cacheKey.
14
- *
15
- * - `run()` calls `runCallCompiled`. JitBailToInterpreter →
16
- * transient bail.
17
- */
18
- import type { Executor } from "../types.js";
19
- import { type CallLowered, type CallCompiled } from "./jitCall.js";
20
- interface JsJitCallData {
21
- readonly lowered: CallLowered;
22
- readonly args: readonly unknown[];
23
- }
24
- export declare const jsJitCallExecutor: Executor<JsJitCallData, CallCompiled | null>;
25
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * JIT IR -> JavaScript code generation.
3
- *
4
- * IR walkers for hoist-pass data collection are in jitCodegenHoist.ts.
5
- */
6
- import { type JitStmt } from "../../../jitTypes.js";
7
- export declare function generateJS(body: JitStmt[], params: string[], outputs: string[], nargout: number, localVars: Set<string>, fileName?: string): string;
@@ -1,70 +0,0 @@
1
- /**
2
- * IR walkers for the JIT codegen hoist pass.
3
- *
4
- * These pure functions walk the JIT IR to collect information needed
5
- * for hoisting tensor aliases, struct field reads, and struct array
6
- * element reads to the top of the generated function.
7
- */
8
- import type { JitStmt } from "../../../jitTypes.js";
9
- /**
10
- * Hoisted aliases for a tensor variable read/written in the loop body.
11
- * Maps the original variable name to local JS identifiers for its
12
- * .data, .data.length, .shape[0], and .shape[1].
13
- */
14
- export interface HoistedAlias {
15
- data: string;
16
- len: string;
17
- d0: string;
18
- d1: string;
19
- maxDim: number;
20
- isWriteTarget: boolean;
21
- isParam: boolean;
22
- }
23
- export declare function structFieldKey(baseName: string, fieldName: string): string;
24
- export declare function structArrayElementsKey(structVarName: string, structArrayFieldName: string): string;
25
- export interface TensorUsage {
26
- maxReadDim: number;
27
- maxWriteDim: number;
28
- isReal: boolean;
29
- }
30
- /**
31
- * Walk the JIT IR collecting, for every variable that appears as the base
32
- * of an Index read, AssignIndex write, or AssignIndexRange write, the
33
- * maximum indexing arity and whether all uses are on a real tensor.
34
- */
35
- export declare function collectTensorUsage(body: JitStmt[]): Map<string, TensorUsage>;
36
- /**
37
- * Walk the JIT IR collecting every base name that is the target of an
38
- * `AssignMember` stmt (stage 22 struct field write). Used by the
39
- * codegen to emit a one-time `$h.structUnshare_h(s)` at function entry
40
- * for any such name that is also a function parameter — this preserves
41
- * MATLAB value semantics when structs are passed by value and the
42
- * callee mutates a field.
43
- */
44
- export declare function collectStructMemberWrites(body: JitStmt[]): Set<string>;
45
- /**
46
- * Walk the JIT IR collecting every name that is the target of any
47
- * plain `Assign` stmt. Used by the stage-12 struct-field-read hoist to
48
- * decide whether a struct-typed param is safe to hoist: if the body
49
- * ever reassigns the name (e.g. `s = [];` promoted to struct, or `s =
50
- * struct()` inside the loop), the pre-loop hoisted field aliases would
51
- * be stale and must be disabled.
52
- */
53
- export declare function collectPlainAssignTargets(body: JitStmt[]): Set<string>;
54
- /**
55
- * Walk the JIT IR collecting all unique (baseName, fieldName) pairs
56
- * referenced by MemberRead nodes. The codegen hoists each pair as a
57
- * local alias at function entry.
58
- */
59
- export declare function collectStructFieldReads(body: JitStmt[]): Map<string, {
60
- baseName: string;
61
- fieldName: string;
62
- }>;
63
- /**
64
- * Walk the JIT IR collecting all unique (structVarName, structArrayFieldName)
65
- * pairs referenced by StructArrayMemberRead nodes.
66
- */
67
- export declare function collectStructArrayElementReads(body: JitStmt[]): Map<string, {
68
- structVarName: string;
69
- structArrayFieldName: string;
70
- }>;
@@ -1,67 +0,0 @@
1
- /**
2
- * JS-side multi-reduction block emission.
3
- *
4
- * Detection + dispatch for scalar Assigns of the form
5
- *
6
- * acc = <expr tree with >=2 reductions over a single tensor Var>
7
- *
8
- * On match, the JS codegen emits a block that runs a single-pass
9
- * inline JS reduction loop, stashes each reduction result in a local,
10
- * and then emits the Assign's RHS with each reduction Call substituted
11
- * by the local that holds its value. The RHS-substitution contract
12
- * lives in `jitCodegen._multiReductionSubst`, which this module
13
- * installs and clears around the `emitExpr` call the caller provides.
14
- *
15
- * Limited to:
16
- * - sum / prod / max / min / mean (short-circuit any/all excluded)
17
- * - a single tensor Var argument to every reduction
18
- * - all reductions read the same tensor name
19
- * - the tensor is real-typed
20
- * - at least two reductions in the RHS
21
- *
22
- * NaN semantics for max/min are matched to MATLAB omit-NaN behaviour:
23
- * IEEE unordered compare already skips NaN, and an `any_non_nan` flag
24
- * drives the all-NaN → NaN fallback.
25
- */
26
- import type { JitExpr, JitStmt } from "../../../jitTypes.js";
27
- type MultiReduceOp = "sum" | "prod" | "max" | "min" | "mean";
28
- export interface MultiReductionMatch {
29
- /** The scalar Assign being emitted (target + original RHS). */
30
- stmt: JitStmt & {
31
- tag: "Assign";
32
- };
33
- /** The tensor variable name all reductions read. */
34
- tensorName: string;
35
- /** Distinct ops that actually appear, in first-occurrence order. Used
36
- * to size the kernel's output buffer and decide which accumulators
37
- * to declare on the JS fallback path. */
38
- ops: MultiReduceOp[];
39
- /** Every reduction Call node found in the RHS, paired with its op.
40
- * The JS emitter builds a substitution map from each Call to the
41
- * local that holds its result. */
42
- sites: {
43
- call: JitExpr & {
44
- tag: "Call";
45
- };
46
- op: MultiReduceOp;
47
- }[];
48
- }
49
- /** Try to match the multi-reduction pattern on a single statement. */
50
- export declare function tryMatchMultiReduction(stmt: JitStmt): MultiReductionMatch | null;
51
- /**
52
- * Emit the multi-reduction block. Writes into `lines`.
53
- *
54
- * The block:
55
- * 1. Aliases `<tensorName>.data` to a local and reads its length.
56
- * 2. Emits a single-pass JS loop that updates each accumulator.
57
- * 3. Post-loop: `mean = sum / n`, and a NaN fixup for max/min when
58
- * every input element was NaN.
59
- * 4. Installs `_multiReductionSubst` pointing each reduction Call at
60
- * its local, emits the Assign's RHS via the caller-provided
61
- * `emitExpr`, and writes the final `<target> = <rhs>;`.
62
- */
63
- export declare function emitMultiReductionBlock(lines: string[], indent: string, match: MultiReductionMatch, mangleName: (n: string) => string, emitExprWithSubst: (expr: JitExpr, subst: Map<JitExpr, string>) => string): void;
64
- /** Reset per-function counter so generated names stay stable between
65
- * compiles of the same IR. Called from `generateJS`. */
66
- export declare function resetMultiReductionState(): void;
67
- export {};
@@ -1,34 +0,0 @@
1
- /**
2
- * JIT runtime helpers assembly point.
3
- *
4
- * This module assembles the $h helpers object from focused sub-modules:
5
- * - jitHelpersComplex.ts — complex number arithmetic
6
- * - jitHelpersIndex.ts — tensor indexing (generic, fast-path, hoisted)
7
- * - jitHelpersTensor.ts — tensor binary/unary ops, concat, COW
8
- *
9
- * The $h object is passed to every JIT-compiled function. V8 inline
10
- * caches require a stable hidden class, so buildPerRuntimeJitHelpers()
11
- * creates a fresh snapshot via a single spread expression.
12
- */
13
- export { re, im, mkc, cAdd, cSub, cMul, cDiv, cNeg, cConj, cAngle, cTruthy, } from "./jitHelpersComplex.js";
14
- export { bce, idx1, idx2, idxN, idx1r, idx2r, idx3r, idx1r_h, idx2r_h, idx3r_h, set1r_h, set2r_h, set3r_h, setRange1r_h, setCol2r_h, subarrayCopy1r, subarrayCopy1rRow, } from "./jitHelpersIndex.js";
15
- export { makeTensor, tensorBinaryOp, tensorCompareOp, tensorUnary, tensorNeg, vconcatGrow1r, unshare, asTensor, tDouble, tSum, tAdd, tSub, tMul, tDiv, tPow, tEq, tNeq, tLt, tLe, tGt, tGe, } from "./jitHelpersTensor.js";
16
- export { JitBailToInterpreter } from "./jitHelpersIndex.js";
17
- /**
18
- * Thrown when a function handle called from JIT code returns a type
19
- * different from what the JIT expected (determined by probing at compile
20
- * time). The loop runner catches this and falls back to interpretation.
21
- */
22
- export declare class JitFuncHandleBailError extends Error {
23
- readonly fnName: string;
24
- readonly expectedType: string;
25
- readonly actualType: string;
26
- constructor(fnName: string, expectedType: string, actualType: string);
27
- }
28
- export declare const jitHelpers: Record<string, unknown>;
29
- import type { IBuiltin } from "../../../interpreter/builtins/index.js";
30
- /**
31
- * Build a per-runtime jitHelpers snapshot. Uses a single spread expression
32
- * for a fresh V8 hidden class (critical for inline-cache performance).
33
- */
34
- export declare function buildPerRuntimeJitHelpers(jsUserFunctions: ReadonlyMap<string, IBuiltin>): Record<string, any>;
@@ -1,21 +0,0 @@
1
- /**
2
- * Complex number arithmetic helpers for JIT-compiled code.
3
- * These are pure functions used by the $h helpers object.
4
- */
5
- import { RuntimeComplexNumber } from "../../../runtime/types.js";
6
- export declare function re(v: unknown): number;
7
- export declare function im(v: unknown): number;
8
- export declare function mkc(r: number, i: number): number | RuntimeComplexNumber;
9
- export declare function cAdd(a: unknown, b: unknown): number | RuntimeComplexNumber;
10
- export declare function cSub(a: unknown, b: unknown): number | RuntimeComplexNumber;
11
- export declare function cMul(a: unknown, b: unknown): number | RuntimeComplexNumber;
12
- /**
13
- * Complex division using Smith's method to avoid overflow/underflow.
14
- * Handles division by zero consistently with MATLAB (produces Inf, not NaN).
15
- */
16
- export declare function cDiv(a: unknown, b: unknown): number | RuntimeComplexNumber;
17
- export declare function cNeg(a: unknown): number | RuntimeComplexNumber;
18
- export declare function cConj(a: unknown): number | RuntimeComplexNumber;
19
- export declare function cAngle(a: unknown): number;
20
- /** Complex truthiness: nonzero if either real or imag part is nonzero. */
21
- export declare function cTruthy(v: unknown): boolean;
@@ -1,33 +0,0 @@
1
- /**
2
- * Tensor indexing helpers for JIT-compiled code.
3
- *
4
- * Three tiers of helpers, from most general to most specialized:
5
- * 1. Generic (idx1, idx2, idxN) — handle any base type, real or complex
6
- * 2. Real-tensor fast path (idx1r, idx2r, idx3r) — skip type/imag checks
7
- * 3. Hoisted-base (idx*r_h, set*r_h) — take pre-extracted data/len/shape
8
- *
9
- * All helpers use 1-based MATLAB indexing and include per-dimension bounds
10
- * checks to ensure consistency with the interpreter.
11
- */
12
- import { type RuntimeTensor } from "../../../runtime/types.js";
13
- export declare class JitBailToInterpreter extends Error {
14
- readonly reason: string;
15
- constructor(reason: string);
16
- }
17
- export declare function bce(): never;
18
- export declare function idx1(base: unknown, i: number): unknown;
19
- export declare function idx2(base: unknown, ri: number, ci: number): unknown;
20
- export declare function idxN(base: unknown, indices: number[]): unknown;
21
- export declare function idx1r(base: RuntimeTensor, i: number): number;
22
- export declare function idx2r(base: RuntimeTensor, ri: number, ci: number): number;
23
- export declare function idx3r(base: RuntimeTensor, i1: number, i2: number, i3: number): number;
24
- export declare function idx1r_h(data: Float64Array, len: number, i: number): number;
25
- export declare function idx2r_h(data: Float64Array, len: number, rows: number, ri: number, ci: number): number;
26
- export declare function idx3r_h(data: Float64Array, len: number, d0: number, d1: number, i1: number, i2: number, i3: number): number;
27
- export declare function set1r_h(data: Float64Array, len: number, i: number, v: number): void;
28
- export declare function set2r_h(data: Float64Array, len: number, rows: number, ri: number, ci: number, v: number): void;
29
- export declare function set3r_h(data: Float64Array, len: number, d0: number, d1: number, i1: number, i2: number, i3: number, v: number): void;
30
- export declare function setRange1r_h(dstData: Float64Array, dstLen: number, dstStart: number, dstEnd: number, srcData: Float64Array, srcLen: number, srcStart: number, srcEnd: number): void;
31
- export declare function subarrayCopy1r(srcData: Float64Array, srcLen: number, start: number, end: number): RuntimeTensor;
32
- export declare function subarrayCopy1rRow(srcData: Float64Array, srcLen: number, start: number, end: number): RuntimeTensor;
33
- export declare function setCol2r_h(dstData: Float64Array, dstRows: number, dstLen: number, col: number, srcData: Float64Array, srcLen: number): void;
@@ -1,34 +0,0 @@
1
- /**
2
- * Tensor operation helpers for JIT-compiled code.
3
- * Handles element-wise binary/unary ops, comparison ops, concat, and
4
- * tensor coercion for struct-array field access.
5
- */
6
- import { RuntimeTensor } from "../../../runtime/types.js";
7
- import type { RuntimeComplexNumber } from "../../../runtime/types.js";
8
- export declare function makeTensor(data: Float64Array, imag: Float64Array | undefined, shape: number[]): RuntimeTensor;
9
- type ScalarVal = number | RuntimeComplexNumber;
10
- export declare function tensorBinaryOp(a: unknown, b: unknown, realOp: (x: number, y: number) => number, complexOp: (a: ScalarVal, b: ScalarVal) => ScalarVal): RuntimeTensor | ScalarVal;
11
- export declare function tensorCompareOp(a: unknown, b: unknown, cmp: (x: number, y: number) => boolean): RuntimeTensor;
12
- export declare function tensorUnary(dest: unknown, a: RuntimeTensor, fn: (x: number) => number): RuntimeTensor;
13
- export declare function tensorNeg(dest: unknown, a: RuntimeTensor): RuntimeTensor;
14
- export declare function tDouble(v: unknown): unknown;
15
- export declare function tSum(v: unknown): unknown;
16
- export declare function vconcatGrow1r(base: unknown, v: number): RuntimeTensor;
17
- /** Unconditionally allocate a fresh wrapper + buffer for `t`. The caller
18
- * can mutate the result without affecting any other alias of the input.
19
- * Used by the JIT path on entry to a write-target hoisted alias; the
20
- * runtime indexed-store path uses the sweep instead. */
21
- export declare function unshare(t: unknown): RuntimeTensor;
22
- export declare function asTensor(v: unknown): RuntimeTensor;
23
- export declare const tAdd: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor | ScalarVal;
24
- export declare const tSub: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor | ScalarVal;
25
- export declare const tMul: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor | ScalarVal;
26
- export declare const tDiv: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor | ScalarVal;
27
- export declare const tPow: (_dest: unknown, a: unknown, b: unknown) => RuntimeTensor | ScalarVal;
28
- export declare const tEq: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor;
29
- export declare const tNeq: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor;
30
- export declare const tLt: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor;
31
- export declare const tLe: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor;
32
- export declare const tGt: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor;
33
- export declare const tGe: (dest: unknown, a: unknown, b: unknown) => RuntimeTensor;
34
- export {};
@@ -1,59 +0,0 @@
1
- /**
2
- * User-function call — phased pipeline.
3
- *
4
- * 1. `classifyCall` — cheap classification + cacheKey synthesis.
5
- * Type-infer args, prune `exact` for numeric scalars, type
6
- * widening using fn._lastJitArgTypes. Returns null on
7
- * type-unknown args or `~` placeholder params.
8
- *
9
- * 2. `lowerCall` — IR lowering.
10
- *
11
- * 3. `generateCallJS` — JS codegen + `new Function`.
12
- *
13
- * 4. `runCallCompiled` — push call frame + cleanup scope, invoke
14
- * compiled fn, pop frame. Translates JitBailToInterpreter into
15
- * a transient bail.
16
- */
17
- import type { Interpreter } from "../../interpreter/interpreter.js";
18
- import type { FunctionDef } from "../../interpreter/types.js";
19
- import { type JitType } from "../../jitTypes.js";
20
- import { type LoweringResult } from "./lower/jitLower.js";
21
- /** Cheap pre-lowering data. */
22
- export interface CallClassification {
23
- readonly fn: FunctionDef;
24
- readonly nargout: number;
25
- readonly argTypes: readonly JitType[];
26
- readonly cacheKey: string;
27
- /**
28
- * Effective JS parameter names for this specialization. Mirrors
29
- * `fn.params` for non-varargin functions. For varargin functions,
30
- * the trailing `varargin` is replaced with one synthetic name per
31
- * variadic arg (`$va_0`, `$va_1`, …) so each variadic arg becomes
32
- * a regular JS function parameter. argTypes is one-to-one with
33
- * effectiveParams.
34
- */
35
- readonly effectiveParams: readonly string[];
36
- /** Number of variadic args (0 when fn has no varargin). */
37
- readonly nVarargin: number;
38
- }
39
- /** Lowered IR plus the classification it came from. */
40
- export interface CallLowered {
41
- readonly classification: CallClassification;
42
- readonly result: LoweringResult;
43
- }
44
- /** A compiled JS artifact ready to run. */
45
- export interface CallCompiled {
46
- readonly fn: (...args: unknown[]) => unknown;
47
- readonly source: string;
48
- }
49
- export declare function classifyCall(fn: FunctionDef, args: unknown[], nargout: number, prevArgTypes: readonly JitType[] | undefined): CallClassification | null;
50
- export declare function lowerCall(interp: Interpreter, classification: CallClassification): CallLowered | null;
51
- export declare function generateCallJS(interp: Interpreter, lowered: CallLowered): CallCompiled | null;
52
- export type CallRunOutcome = {
53
- ok: true;
54
- result: unknown;
55
- } | {
56
- ok: false;
57
- transient: boolean;
58
- };
59
- export declare function runCallCompiled(interp: Interpreter, fn: FunctionDef, compiled: CallCompiled, args: unknown[]): CallRunOutcome;
@@ -1,53 +0,0 @@
1
- /**
2
- * For/while loop body — phased pipeline.
3
- *
4
- * 1. `classifyLoop` — analyze loop, gather typed env inputs,
5
- * live-out filter on outputs (using post-siblings), type
6
- * widening, cacheKey synthesis.
7
- *
8
- * 2. `lowerLoop` — wrap as a synthetic `FunctionDef` and
9
- * lower via `lowerSyntheticFn`.
10
- *
11
- * 3. `generateLoopJS` — `generateSyntheticFnJS` + diagnostics.
12
- *
13
- * 4. `runLoopCompiled` — `runSyntheticFnAgainstEnv`.
14
- *
15
- * Shared with top-level via `shared.ts`. What's loop-specific is
16
- * the analysis (For/While discrimination), the live-out filter
17
- * against post-siblings, the cacheKey location (per loop AST
18
- * span), and the `$loop_for` / `$loop_while` synthetic name.
19
- */
20
- import type { Interpreter } from "../../interpreter/interpreter.js";
21
- import type { Stmt } from "../../parser/types.js";
22
- import type { JitType } from "../../jitTypes.js";
23
- import type { LoweringResult } from "./lower/jitLower.js";
24
- import { type SyntheticFnRunResult } from "./shared.js";
25
- export type LoopKind = "for" | "while";
26
- export interface LoopClassification {
27
- readonly stmt: Stmt & {
28
- type: "For" | "While";
29
- };
30
- readonly kind: LoopKind;
31
- readonly inputs: readonly string[];
32
- readonly inputTypes: readonly JitType[];
33
- readonly outputs: readonly string[];
34
- readonly hasReturn: boolean;
35
- readonly cacheKey: string;
36
- }
37
- export interface LoopLowered {
38
- readonly classification: LoopClassification;
39
- readonly result: LoweringResult;
40
- }
41
- export interface LoopCompiled {
42
- readonly fn: (...args: unknown[]) => unknown;
43
- readonly source: string;
44
- }
45
- export type LoopRunResult = SyntheticFnRunResult;
46
- /** `postSiblings` / `postIdx` describe the stmt list this loop sits
47
- * in; used to compute the live-out filter on outputs. */
48
- export declare function classifyLoop(interp: Interpreter, stmt: Stmt & {
49
- type: "For" | "While";
50
- }, postSiblings: readonly Stmt[], postIdx: number, prevInputTypes: readonly JitType[] | undefined): LoopClassification | null;
51
- export declare function lowerLoop(interp: Interpreter, classification: LoopClassification): LoopLowered | null;
52
- export declare function generateLoopJS(interp: Interpreter, lowered: LoopLowered): LoopCompiled | null;
53
- export declare function runLoopCompiled(interp: Interpreter, compiled: LoopCompiled, classification: LoopClassification): LoopRunResult;
@@ -1,44 +0,0 @@
1
- /**
2
- * Top-level script body — phased pipeline.
3
- *
4
- * 1. `classifyTopLevel` — analyze script body, gather typed env
5
- * inputs, type widening, cacheKey synthesis.
6
- *
7
- * 2. `lowerTopLevel` — wrap as a synthetic `FunctionDef` and
8
- * lower via `lowerSyntheticFn`.
9
- *
10
- * 3. `generateTopLevelJS` — `generateSyntheticFnJS` + diagnostics.
11
- *
12
- * 4. `runTopLevelCompiled` — `runSyntheticFnAgainstEnv`.
13
- *
14
- * The shared mechanics live in `shared.ts`; this module spells out
15
- * what's actually top-level-specific (whole-script body, no
16
- * post-loop liveness filter, `$top` synthetic name).
17
- */
18
- import type { Interpreter } from "../../interpreter/interpreter.js";
19
- import type { Stmt } from "../../parser/types.js";
20
- import type { JitType } from "../../jitTypes.js";
21
- import type { LoweringResult } from "./lower/jitLower.js";
22
- import { type SyntheticFnRunResult } from "./shared.js";
23
- export interface TopLevelClassification {
24
- readonly stmts: readonly Stmt[];
25
- readonly inputs: readonly string[];
26
- readonly inputTypes: readonly JitType[];
27
- readonly outputs: readonly string[];
28
- readonly currentFile: string;
29
- readonly hasReturn: boolean;
30
- readonly cacheKey: string;
31
- }
32
- export interface TopLevelLowered {
33
- readonly classification: TopLevelClassification;
34
- readonly result: LoweringResult;
35
- }
36
- export interface TopLevelCompiled {
37
- readonly fn: (...args: unknown[]) => unknown;
38
- readonly source: string;
39
- }
40
- export type TopLevelRunResult = SyntheticFnRunResult;
41
- export declare function classifyTopLevel(interp: Interpreter, stmts: readonly Stmt[], prevInputTypes: readonly JitType[] | undefined): TopLevelClassification | null;
42
- export declare function lowerTopLevel(interp: Interpreter, classification: TopLevelClassification): TopLevelLowered | null;
43
- export declare function generateTopLevelJS(interp: Interpreter, lowered: TopLevelLowered): TopLevelCompiled | null;
44
- export declare function runTopLevelCompiled(interp: Interpreter, compiled: TopLevelCompiled, classification: TopLevelClassification): TopLevelRunResult;
@@ -1,15 +0,0 @@
1
- /**
2
- * js-jit-loop — JS codegen executor for the loop shape.
3
- *
4
- * - `propose()` filters on `lowered.kind === "loop"`, applies
5
- * JIT-feasibility checks (hasReturn, IO+bail-risk).
6
- *
7
- * - `compile()` calls `generateLoopJS`. Cached by the registry
8
- * under the classification's cacheKey.
9
- *
10
- * - `run()` calls `runLoopCompiled`. JitBailToInterpreter →
11
- * transient bail; JitFuncHandleBailError → permanent bail.
12
- */
13
- import type { Executor } from "../types.js";
14
- import { type LoopLowered, type LoopCompiled } from "./jitLoop.js";
15
- export declare const jsJitLoopExecutor: Executor<LoopLowered, LoopCompiled | null>;