numbl 0.3.0 → 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 (403) hide show
  1. package/binding.gyp +17 -33
  2. package/dist-cli/cli.js +61511 -46223
  3. package/dist-lib/graphics/types.d.ts +22 -0
  4. package/dist-lib/lib.js +37582 -22275
  5. package/dist-lib/numbl-core/executeCode.d.ts +11 -16
  6. package/dist-lib/numbl-core/executors/cache.d.ts +26 -0
  7. package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
  8. package/dist-lib/numbl-core/executors/context.d.ts +76 -0
  9. package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
  10. package/dist-lib/numbl-core/executors/index.d.ts +14 -0
  11. package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +35 -0
  12. package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +31 -0
  13. package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +29 -0
  14. package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +45 -0
  15. package/dist-lib/numbl-core/executors/jit/compileC.d.ts +51 -0
  16. package/dist-lib/numbl-core/executors/jit/compileC.node.d.ts +25 -0
  17. package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +27 -0
  18. package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +41 -0
  19. package/dist-lib/numbl-core/executors/jit/session.d.ts +17 -0
  20. package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +36 -0
  21. package/dist-lib/numbl-core/executors/jit/typeAdapter.d.ts +28 -0
  22. package/dist-lib/numbl-core/executors/jit/typeAdapterC.d.ts +73 -0
  23. package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +48 -0
  24. package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +108 -0
  25. package/dist-lib/numbl-core/executors/lowering.d.ts +120 -0
  26. package/dist-lib/numbl-core/executors/plugins.d.ts +32 -0
  27. package/dist-lib/numbl-core/executors/registry.d.ts +148 -0
  28. package/dist-lib/numbl-core/executors/types.d.ts +103 -0
  29. package/dist-lib/numbl-core/functionResolve.d.ts +7 -0
  30. package/dist-lib/numbl-core/helpers/check-helpers.d.ts +4 -5
  31. package/dist-lib/numbl-core/helpers/linsolve.d.ts +2 -3
  32. package/dist-lib/numbl-core/helpers/prng.d.ts +1 -2
  33. package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
  34. package/dist-lib/numbl-core/interpreter/builtins/datetime.d.ts +2 -1
  35. package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
  36. package/dist-lib/numbl-core/interpreter/builtins/misc.d.ts +4 -1
  37. package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +4 -109
  38. package/dist-lib/numbl-core/interpreter/interpreter.d.ts +51 -49
  39. package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
  40. package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
  41. package/dist-lib/numbl-core/interpreter/types.d.ts +27 -12
  42. package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +43 -0
  43. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +123 -0
  44. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/minus.d.ts +2 -0
  45. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mpower.d.ts +12 -0
  46. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mrdivide.d.ts +5 -0
  47. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mtimes.d.ts +2 -0
  48. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/plus.d.ts +2 -0
  49. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/power.d.ts +30 -0
  50. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/rdivide.d.ts +2 -0
  51. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/times.d.ts +2 -0
  52. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/uminus.d.ts +2 -0
  53. package/dist-lib/numbl-core/jit/builtins/defs/compare/_compare.d.ts +12 -0
  54. package/dist-lib/numbl-core/jit/builtins/defs/compare/eq.d.ts +2 -0
  55. package/dist-lib/numbl-core/jit/builtins/defs/compare/ge.d.ts +2 -0
  56. package/dist-lib/numbl-core/jit/builtins/defs/compare/gt.d.ts +2 -0
  57. package/dist-lib/numbl-core/jit/builtins/defs/compare/le.d.ts +2 -0
  58. package/dist-lib/numbl-core/jit/builtins/defs/compare/lt.d.ts +2 -0
  59. package/dist-lib/numbl-core/jit/builtins/defs/compare/ne.d.ts +2 -0
  60. package/dist-lib/numbl-core/jit/builtins/defs/diag/assert.d.ts +6 -0
  61. package/dist-lib/numbl-core/jit/builtins/defs/io/_format_args.d.ts +17 -0
  62. package/dist-lib/numbl-core/jit/builtins/defs/io/disp.d.ts +2 -0
  63. package/dist-lib/numbl-core/jit/builtins/defs/io/error.d.ts +2 -0
  64. package/dist-lib/numbl-core/jit/builtins/defs/io/fprintf.d.ts +2 -0
  65. package/dist-lib/numbl-core/jit/builtins/defs/io/sprintf.d.ts +2 -0
  66. package/dist-lib/numbl-core/jit/builtins/defs/io/warning.d.ts +15 -0
  67. package/dist-lib/numbl-core/jit/builtins/defs/logical/_shortcircuit.d.ts +30 -0
  68. package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +30 -0
  69. package/dist-lib/numbl-core/jit/builtins/defs/logical/and.d.ts +5 -0
  70. package/dist-lib/numbl-core/jit/builtins/defs/logical/andand.d.ts +1 -0
  71. package/dist-lib/numbl-core/jit/builtins/defs/logical/boolconst.d.ts +3 -0
  72. package/dist-lib/numbl-core/jit/builtins/defs/logical/classBuiltin.d.ts +21 -0
  73. package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +15 -0
  74. package/dist-lib/numbl-core/jit/builtins/defs/logical/isa.d.ts +13 -0
  75. package/dist-lib/numbl-core/jit/builtins/defs/logical/iscell.d.ts +8 -0
  76. package/dist-lib/numbl-core/jit/builtins/defs/logical/isempty.d.ts +2 -0
  77. package/dist-lib/numbl-core/jit/builtins/defs/logical/isequal.d.ts +2 -0
  78. package/dist-lib/numbl-core/jit/builtins/defs/logical/isfield.d.ts +20 -0
  79. package/dist-lib/numbl-core/jit/builtins/defs/logical/isinf.d.ts +2 -0
  80. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnan.d.ts +1 -0
  81. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnumeric.d.ts +7 -0
  82. package/dist-lib/numbl-core/jit/builtins/defs/logical/isreal.d.ts +2 -0
  83. package/dist-lib/numbl-core/jit/builtins/defs/logical/isscalar.d.ts +20 -0
  84. package/dist-lib/numbl-core/jit/builtins/defs/logical/isstruct.d.ts +7 -0
  85. package/dist-lib/numbl-core/jit/builtins/defs/logical/logical.d.ts +1 -0
  86. package/dist-lib/numbl-core/jit/builtins/defs/logical/not.d.ts +15 -0
  87. package/dist-lib/numbl-core/jit/builtins/defs/logical/or.d.ts +11 -0
  88. package/dist-lib/numbl-core/jit/builtins/defs/logical/oror.d.ts +1 -0
  89. package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +21 -0
  90. package/dist-lib/numbl-core/jit/builtins/defs/logical/typequery.d.ts +10 -0
  91. package/dist-lib/numbl-core/jit/builtins/defs/logical/xor.d.ts +12 -0
  92. package/dist-lib/numbl-core/jit/builtins/defs/math/_complex_fold.d.ts +34 -0
  93. package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +51 -0
  94. package/dist-lib/numbl-core/jit/builtins/defs/math/abs.d.ts +7 -0
  95. package/dist-lib/numbl-core/jit/builtins/defs/math/angle.d.ts +7 -0
  96. package/dist-lib/numbl-core/jit/builtins/defs/math/asinh.d.ts +1 -0
  97. package/dist-lib/numbl-core/jit/builtins/defs/math/atan.d.ts +1 -0
  98. package/dist-lib/numbl-core/jit/builtins/defs/math/atan2.d.ts +3 -0
  99. package/dist-lib/numbl-core/jit/builtins/defs/math/besselh.d.ts +2 -0
  100. package/dist-lib/numbl-core/jit/builtins/defs/math/ceil.d.ts +4 -0
  101. package/dist-lib/numbl-core/jit/builtins/defs/math/conj.d.ts +7 -0
  102. package/dist-lib/numbl-core/jit/builtins/defs/math/constants.d.ts +7 -0
  103. package/dist-lib/numbl-core/jit/builtins/defs/math/cos.d.ts +1 -0
  104. package/dist-lib/numbl-core/jit/builtins/defs/math/cosh.d.ts +1 -0
  105. package/dist-lib/numbl-core/jit/builtins/defs/math/dot.d.ts +20 -0
  106. package/dist-lib/numbl-core/jit/builtins/defs/math/double.d.ts +28 -0
  107. package/dist-lib/numbl-core/jit/builtins/defs/math/exp.d.ts +1 -0
  108. package/dist-lib/numbl-core/jit/builtins/defs/math/fix.d.ts +4 -0
  109. package/dist-lib/numbl-core/jit/builtins/defs/math/floor.d.ts +4 -0
  110. package/dist-lib/numbl-core/jit/builtins/defs/math/hypot.d.ts +3 -0
  111. package/dist-lib/numbl-core/jit/builtins/defs/math/imag.d.ts +7 -0
  112. package/dist-lib/numbl-core/jit/builtins/defs/math/linspace.d.ts +6 -0
  113. package/dist-lib/numbl-core/jit/builtins/defs/math/log.d.ts +4 -0
  114. package/dist-lib/numbl-core/jit/builtins/defs/math/log10.d.ts +3 -0
  115. package/dist-lib/numbl-core/jit/builtins/defs/math/log2.d.ts +5 -0
  116. package/dist-lib/numbl-core/jit/builtins/defs/math/logspace.d.ts +8 -0
  117. package/dist-lib/numbl-core/jit/builtins/defs/math/mod.d.ts +1 -0
  118. package/dist-lib/numbl-core/jit/builtins/defs/math/norm.d.ts +2 -0
  119. package/dist-lib/numbl-core/jit/builtins/defs/math/real.d.ts +7 -0
  120. package/dist-lib/numbl-core/jit/builtins/defs/math/rem.d.ts +3 -0
  121. package/dist-lib/numbl-core/jit/builtins/defs/math/round.d.ts +1 -0
  122. package/dist-lib/numbl-core/jit/builtins/defs/math/sign.d.ts +5 -0
  123. package/dist-lib/numbl-core/jit/builtins/defs/math/sin.d.ts +1 -0
  124. package/dist-lib/numbl-core/jit/builtins/defs/math/sinh.d.ts +1 -0
  125. package/dist-lib/numbl-core/jit/builtins/defs/math/sqrt.d.ts +11 -0
  126. package/dist-lib/numbl-core/jit/builtins/defs/math/tan.d.ts +1 -0
  127. package/dist-lib/numbl-core/jit/builtins/defs/math/tanh.d.ts +1 -0
  128. package/dist-lib/numbl-core/jit/builtins/defs/math/uniquetol.d.ts +22 -0
  129. package/dist-lib/numbl-core/jit/builtins/defs/plot/dispatch.d.ts +6 -0
  130. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_cumulative.d.ts +49 -0
  131. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +126 -0
  132. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_variance.d.ts +17 -0
  133. package/dist-lib/numbl-core/jit/builtins/defs/reduction/all.d.ts +1 -0
  134. package/dist-lib/numbl-core/jit/builtins/defs/reduction/any.d.ts +1 -0
  135. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummax.d.ts +1 -0
  136. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummin.d.ts +1 -0
  137. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumprod.d.ts +1 -0
  138. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumsum.d.ts +1 -0
  139. package/dist-lib/numbl-core/jit/builtins/defs/reduction/diff.d.ts +16 -0
  140. package/dist-lib/numbl-core/jit/builtins/defs/reduction/length.d.ts +2 -0
  141. package/dist-lib/numbl-core/jit/builtins/defs/reduction/max.d.ts +1 -0
  142. package/dist-lib/numbl-core/jit/builtins/defs/reduction/mean.d.ts +1 -0
  143. package/dist-lib/numbl-core/jit/builtins/defs/reduction/min.d.ts +1 -0
  144. package/dist-lib/numbl-core/jit/builtins/defs/reduction/numel.d.ts +2 -0
  145. package/dist-lib/numbl-core/jit/builtins/defs/reduction/prod.d.ts +1 -0
  146. package/dist-lib/numbl-core/jit/builtins/defs/reduction/std.d.ts +1 -0
  147. package/dist-lib/numbl-core/jit/builtins/defs/reduction/sum.d.ts +1 -0
  148. package/dist-lib/numbl-core/jit/builtins/defs/reduction/var.d.ts +1 -0
  149. package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +67 -0
  150. package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +34 -0
  151. package/dist-lib/numbl-core/jit/builtins/defs/shape/cat.d.ts +33 -0
  152. package/dist-lib/numbl-core/jit/builtins/defs/shape/diag.d.ts +29 -0
  153. package/dist-lib/numbl-core/jit/builtins/defs/shape/eye.d.ts +5 -0
  154. package/dist-lib/numbl-core/jit/builtins/defs/shape/flip.d.ts +7 -0
  155. package/dist-lib/numbl-core/jit/builtins/defs/shape/meshgrid.d.ts +12 -0
  156. package/dist-lib/numbl-core/jit/builtins/defs/shape/ones.d.ts +1 -0
  157. package/dist-lib/numbl-core/jit/builtins/defs/shape/repmat.d.ts +37 -0
  158. package/dist-lib/numbl-core/jit/builtins/defs/shape/reshape.d.ts +39 -0
  159. package/dist-lib/numbl-core/jit/builtins/defs/shape/size.d.ts +20 -0
  160. package/dist-lib/numbl-core/jit/builtins/defs/shape/sort.d.ts +19 -0
  161. package/dist-lib/numbl-core/jit/builtins/defs/shape/transpose.d.ts +6 -0
  162. package/dist-lib/numbl-core/jit/builtins/defs/shape/tril.d.ts +16 -0
  163. package/dist-lib/numbl-core/jit/builtins/defs/shape/triu.d.ts +16 -0
  164. package/dist-lib/numbl-core/jit/builtins/defs/shape/zeros.d.ts +1 -0
  165. package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +20 -0
  166. package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +36 -0
  167. package/dist-lib/numbl-core/jit/builtins/defs/system/pathBuiltins.d.ts +4 -0
  168. package/dist-lib/numbl-core/jit/builtins/defs/system/tic.d.ts +8 -0
  169. package/dist-lib/numbl-core/jit/builtins/defs/system/toc.d.ts +5 -0
  170. package/dist-lib/numbl-core/jit/builtins/index.d.ts +16 -0
  171. package/dist-lib/numbl-core/jit/builtins/registry.d.ts +138 -0
  172. package/dist-lib/numbl-core/jit/builtins/runtime/cell/cell.d.ts +24 -0
  173. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/loop_count.d.ts +1 -0
  174. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/range_value.d.ts +1 -0
  175. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/scalar_index.d.ts +11 -0
  176. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/tensor_make_range.d.ts +5 -0
  177. package/dist-lib/numbl-core/jit/builtins/runtime/io/assert_fmt.d.ts +1 -0
  178. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_complex.d.ts +1 -0
  179. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_double.d.ts +1 -0
  180. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_struct.d.ts +1 -0
  181. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor.d.ts +1 -0
  182. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor_complex.d.ts +1 -0
  183. package/dist-lib/numbl-core/jit/builtins/runtime/io/error_fmt.d.ts +2 -0
  184. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_complex.d.ts +1 -0
  185. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_double.d.ts +1 -0
  186. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_engine.d.ts +1 -0
  187. package/dist-lib/numbl-core/jit/builtins/runtime/io/fprintf.d.ts +1 -0
  188. package/dist-lib/numbl-core/jit/builtins/runtime/io/sprintf.d.ts +5 -0
  189. package/dist-lib/numbl-core/jit/builtins/runtime/io/warning_fmt.d.ts +2 -0
  190. package/dist-lib/numbl-core/jit/builtins/runtime/plot/plot_dispatch.d.ts +1 -0
  191. package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +86 -0
  192. package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
  193. package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +103 -0
  194. package/dist-lib/numbl-core/jit/builtins/runtime/system/deep_clone.d.ts +1 -0
  195. package/dist-lib/numbl-core/jit/builtins/runtime/system/isequal.d.ts +2 -0
  196. package/dist-lib/numbl-core/jit/builtins/runtime/system/tictoc.d.ts +5 -0
  197. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor.d.ts +6 -0
  198. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc.d.ts +5 -0
  199. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_complex.d.ts +6 -0
  200. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd.d.ts +5 -0
  201. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd_complex.d.ts +6 -0
  202. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_copy_complex.d.ts +6 -0
  203. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix.d.ts +5 -0
  204. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix_complex.d.ts +6 -0
  205. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row.d.ts +5 -0
  206. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row_complex.d.ts +6 -0
  207. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cat.d.ts +11 -0
  208. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cumulative.d.ts +32 -0
  209. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diag.d.ts +33 -0
  210. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diff.d.ts +5 -0
  211. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_dot.d.ts +16 -0
  212. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_complex.d.ts +90 -0
  213. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real.d.ts +75 -0
  214. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +95 -0
  215. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_eye.d.ts +10 -0
  216. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_nd.d.ts +11 -0
  217. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_square.d.ts +5 -0
  218. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_flip.d.ts +11 -0
  219. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_linspace.d.ts +5 -0
  220. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logical_real.d.ts +10 -0
  221. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logspace.d.ts +5 -0
  222. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_meshgrid.d.ts +29 -0
  223. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_complex.d.ts +10 -0
  224. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_real.d.ts +6 -0
  225. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_norm.d.ts +4 -0
  226. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_nd.d.ts +5 -0
  227. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_square.d.ts +5 -0
  228. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_predicate.d.ts +42 -0
  229. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_complex.d.ts +53 -0
  230. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +42 -0
  231. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_repmat.d.ts +11 -0
  232. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd.d.ts +5 -0
  233. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd_complex.d.ts +6 -0
  234. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_size.d.ts +5 -0
  235. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_sort_real.d.ts +36 -0
  236. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose.d.ts +5 -0
  237. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose_complex.d.ts +6 -0
  238. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_triangular.d.ts +22 -0
  239. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_complex_math.d.ts +128 -0
  240. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +95 -0
  241. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_uniquetol.d.ts +5 -0
  242. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_var.d.ts +12 -0
  243. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_nd.d.ts +5 -0
  244. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_square.d.ts +5 -0
  245. package/dist-lib/numbl-core/jit/builtins/runtime/text/strcmp.d.ts +2 -0
  246. package/dist-lib/numbl-core/jit/codegen/cFormat.d.ts +36 -0
  247. package/dist-lib/numbl-core/jit/codegen/cHelpers.d.ts +48 -0
  248. package/dist-lib/numbl-core/jit/codegen/emit.d.ts +55 -0
  249. package/dist-lib/numbl-core/jit/codegen/emitCellTypedef.d.ts +23 -0
  250. package/dist-lib/numbl-core/jit/codegen/emitExpr.d.ts +33 -0
  251. package/dist-lib/numbl-core/jit/codegen/emitIndex.d.ts +56 -0
  252. package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +64 -0
  253. package/dist-lib/numbl-core/jit/codegen/emitNamedTypedef.d.ts +58 -0
  254. package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +76 -0
  255. package/dist-lib/numbl-core/jit/codegen/emitTensorConcat.d.ts +23 -0
  256. package/dist-lib/numbl-core/jit/codegen/emitTensorConcatJs.d.ts +16 -0
  257. package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +77 -0
  258. package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +66 -0
  259. package/dist-lib/numbl-core/jit/codegen/liveness.d.ts +58 -0
  260. package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +24 -0
  261. package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +150 -0
  262. package/dist-lib/numbl-core/jit/compileSpec.d.ts +84 -0
  263. package/dist-lib/numbl-core/jit/compileSpecC.d.ts +93 -0
  264. package/dist-lib/numbl-core/jit/index.d.ts +13 -5
  265. package/dist-lib/numbl-core/jit/lowering/classDefs.d.ts +109 -0
  266. package/dist-lib/numbl-core/jit/lowering/errors.d.ts +35 -0
  267. package/dist-lib/numbl-core/jit/lowering/indexFold.d.ts +31 -0
  268. package/dist-lib/numbl-core/jit/lowering/indexResolve.d.ts +100 -0
  269. package/dist-lib/numbl-core/jit/lowering/ir.d.ts +584 -0
  270. package/dist-lib/numbl-core/jit/lowering/lower.d.ts +271 -0
  271. package/dist-lib/numbl-core/jit/lowering/lowerCellIndex.d.ts +41 -0
  272. package/dist-lib/numbl-core/jit/lowering/lowerCellLit.d.ts +19 -0
  273. package/dist-lib/numbl-core/jit/lowering/lowerClassConstructor.d.ts +55 -0
  274. package/dist-lib/numbl-core/jit/lowering/lowerFuncCall.d.ts +34 -0
  275. package/dist-lib/numbl-core/jit/lowering/lowerHandle.d.ts +57 -0
  276. package/dist-lib/numbl-core/jit/lowering/lowerIndexLoad.d.ts +16 -0
  277. package/dist-lib/numbl-core/jit/lowering/lowerIndexSlice.d.ts +29 -0
  278. package/dist-lib/numbl-core/jit/lowering/lowerIndexSliceStore.d.ts +19 -0
  279. package/dist-lib/numbl-core/jit/lowering/lowerIndexStore.d.ts +14 -0
  280. package/dist-lib/numbl-core/jit/lowering/lowerMethodCall.d.ts +45 -0
  281. package/dist-lib/numbl-core/jit/lowering/lowerMultiAssign.d.ts +36 -0
  282. package/dist-lib/numbl-core/jit/lowering/lowerTensorLit.d.ts +25 -0
  283. package/dist-lib/numbl-core/jit/lowering/rangeCount.d.ts +19 -0
  284. package/dist-lib/numbl-core/jit/lowering/specialize.d.ts +93 -0
  285. package/dist-lib/numbl-core/jit/lowering/types.d.ts +503 -0
  286. package/dist-lib/numbl-core/jit/lowering/walk.d.ts +17 -0
  287. package/dist-lib/numbl-core/jit/numbl/index.d.ts +30 -0
  288. package/dist-lib/numbl-core/jit/parser/astUtils.d.ts +43 -0
  289. package/dist-lib/numbl-core/jit/parser/index.d.ts +12 -0
  290. package/dist-lib/numbl-core/jit/parser/sourceLoc.d.ts +12 -0
  291. package/dist-lib/numbl-core/jit/runtime/context.d.ts +23 -0
  292. package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +10 -0
  293. package/dist-lib/numbl-core/jit/runtime/value.d.ts +101 -0
  294. package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +59 -0
  295. package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +62 -0
  296. package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +243 -0
  297. package/dist-lib/numbl-core/jitTypes.d.ts +94 -0
  298. package/dist-lib/numbl-core/jsUserFunctions.d.ts +10 -2
  299. package/dist-lib/numbl-core/lowering/loweringContext.d.ts +24 -0
  300. package/dist-lib/numbl-core/native/lapack-bridge.d.ts +3 -3
  301. package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
  302. package/dist-lib/numbl-core/parser/types.d.ts +20 -0
  303. package/dist-lib/numbl-core/runtime/alloc.d.ts +12 -23
  304. package/dist-lib/numbl-core/runtime/constructors.d.ts +6 -6
  305. package/dist-lib/numbl-core/runtime/cow.d.ts +33 -0
  306. package/dist-lib/numbl-core/runtime/index.d.ts +4 -3
  307. package/dist-lib/numbl-core/runtime/indexing.d.ts +17 -2
  308. package/dist-lib/numbl-core/runtime/plotBuiltinDispatch.d.ts +86 -0
  309. package/dist-lib/numbl-core/runtime/plotUtils.d.ts +17 -2
  310. package/dist-lib/numbl-core/runtime/refcount.d.ts +85 -0
  311. package/dist-lib/numbl-core/runtime/runtime.d.ts +43 -67
  312. package/dist-lib/numbl-core/runtime/runtimeDispatch.d.ts +2 -2
  313. package/dist-lib/numbl-core/runtime/runtimeIndexing.d.ts +2 -2
  314. package/dist-lib/numbl-core/runtime/runtimeMemberAccess.d.ts +1 -1
  315. package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +1 -0
  316. package/dist-lib/numbl-core/runtime/struct-access.d.ts +2 -1
  317. package/dist-lib/numbl-core/runtime/types.d.ts +117 -62
  318. package/dist-lib/numbl-core/runtime/utils.d.ts +2 -8
  319. package/dist-lib/numbl-core/version.d.ts +1 -1
  320. package/dist-lib/numbl-core/workspace/types.d.ts +8 -0
  321. package/dist-plot-viewer/assets/index-COAM8o1E.js +4426 -0
  322. package/dist-plot-viewer/index.html +1 -1
  323. package/dist-site-viewer/404.html +33 -0
  324. package/dist-site-viewer/assets/index-CgBUy7v7.js +4748 -0
  325. package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
  326. package/dist-site-viewer/assets/numbl-worker-VkVtodCX.js +11836 -0
  327. package/dist-site-viewer/coi-serviceworker.js +70 -0
  328. package/dist-site-viewer/favicon.svg +23 -0
  329. package/dist-site-viewer/index.html +16 -0
  330. package/dist-site-viewer/logo.svg +26 -0
  331. package/dist-site-viewer/numbl-embed.js +111 -0
  332. package/dist-site-viewer/vite.svg +1 -0
  333. package/native/lapack_linsolve.cpp +1 -1
  334. package/native/numbl_addon_common.h +2 -2
  335. package/native/ops/comparison.c +1 -1
  336. package/native/ops/real_unary_elemwise.c +3 -1
  337. package/package.json +16 -13
  338. package/dist-lib/numbl-core/jit/c/abi.d.ts +0 -90
  339. package/dist-lib/numbl-core/jit/c/assemble.d.ts +0 -56
  340. package/dist-lib/numbl-core/jit/c/classify.d.ts +0 -70
  341. package/dist-lib/numbl-core/jit/c/compile.d.ts +0 -37
  342. package/dist-lib/numbl-core/jit/c/context.d.ts +0 -152
  343. package/dist-lib/numbl-core/jit/c/emit/assign.d.ts +0 -20
  344. package/dist-lib/numbl-core/jit/c/emit/complexScalar.d.ts +0 -18
  345. package/dist-lib/numbl-core/jit/c/emit/fused.d.ts +0 -42
  346. package/dist-lib/numbl-core/jit/c/emit/helpers.d.ts +0 -40
  347. package/dist-lib/numbl-core/jit/c/emit/index.d.ts +0 -14
  348. package/dist-lib/numbl-core/jit/c/emit/scalar.d.ts +0 -23
  349. package/dist-lib/numbl-core/jit/c/emit/stmt.d.ts +0 -25
  350. package/dist-lib/numbl-core/jit/c/emit/tensor.d.ts +0 -127
  351. package/dist-lib/numbl-core/jit/c/emit/userCall.d.ts +0 -58
  352. package/dist-lib/numbl-core/jit/c/epilogue.d.ts +0 -26
  353. package/dist-lib/numbl-core/jit/c/feasibility.d.ts +0 -44
  354. package/dist-lib/numbl-core/jit/c/prelude.d.ts +0 -37
  355. package/dist-lib/numbl-core/jit/c/visit.d.ts +0 -63
  356. package/dist-lib/numbl-core/jit/e1/complexKernelEmit.d.ts +0 -46
  357. package/dist-lib/numbl-core/jit/e1/hash.d.ts +0 -10
  358. package/dist-lib/numbl-core/jit/e1/install.d.ts +0 -13
  359. package/dist-lib/numbl-core/jit/e1/kernelEmit.d.ts +0 -54
  360. package/dist-lib/numbl-core/jit/e1/multiReductionKernel.d.ts +0 -66
  361. package/dist-lib/numbl-core/jit/e1/openmpFlag.d.ts +0 -13
  362. package/dist-lib/numbl-core/jit/e1/scalarFnKernel.d.ts +0 -44
  363. package/dist-lib/numbl-core/jit/e2/assignKernel.d.ts +0 -34
  364. package/dist-lib/numbl-core/jit/e2/astToJitExpr.d.ts +0 -25
  365. package/dist-lib/numbl-core/jit/e2/cache.d.ts +0 -80
  366. package/dist-lib/numbl-core/jit/e2/chainKernelEmit.d.ts +0 -55
  367. package/dist-lib/numbl-core/jit/e2/classify.d.ts +0 -119
  368. package/dist-lib/numbl-core/jit/e2/compileFn.d.ts +0 -16
  369. package/dist-lib/numbl-core/jit/e2/complexChainKernelEmit.d.ts +0 -79
  370. package/dist-lib/numbl-core/jit/e2/emitShared.d.ts +0 -71
  371. package/dist-lib/numbl-core/jit/e2/install.d.ts +0 -11
  372. package/dist-lib/numbl-core/jit/e2/liveness.d.ts +0 -29
  373. package/dist-lib/numbl-core/jit/e2/loopKernel.d.ts +0 -49
  374. package/dist-lib/numbl-core/jit/e2/loopKernelEmit.d.ts +0 -75
  375. package/dist-lib/numbl-core/jit/e2/multiReductionDriver.d.ts +0 -24
  376. package/dist-lib/numbl-core/jit/e2/reductionKernelEmit.d.ts +0 -72
  377. package/dist-lib/numbl-core/jit/e2/scalarFnDriver.d.ts +0 -29
  378. package/dist-lib/numbl-core/jit/fusedChainHelpers.d.ts +0 -65
  379. package/dist-lib/numbl-core/jit/fusedScalarEmit.d.ts +0 -69
  380. package/dist-lib/numbl-core/jit/fusion.d.ts +0 -71
  381. package/dist-lib/numbl-core/jit/fusionOps.d.ts +0 -25
  382. package/dist-lib/numbl-core/jit/heavyOps.d.ts +0 -15
  383. package/dist-lib/numbl-core/jit/jitBailSafety.d.ts +0 -41
  384. package/dist-lib/numbl-core/jit/jitLoop.d.ts +0 -25
  385. package/dist-lib/numbl-core/jit/jitLoopAnalysis.d.ts +0 -37
  386. package/dist-lib/numbl-core/jit/jitLower.d.ts +0 -122
  387. package/dist-lib/numbl-core/jit/jitLowerExpr.d.ts +0 -27
  388. package/dist-lib/numbl-core/jit/jitLowerStmt.d.ts +0 -9
  389. package/dist-lib/numbl-core/jit/jitLowerTypes.d.ts +0 -29
  390. package/dist-lib/numbl-core/jit/jitTopLevel.d.ts +0 -22
  391. package/dist-lib/numbl-core/jit/jitTypes.d.ts +0 -394
  392. package/dist-lib/numbl-core/jit/js/jitCodegen.d.ts +0 -7
  393. package/dist-lib/numbl-core/jit/js/jitCodegenHoist.d.ts +0 -70
  394. package/dist-lib/numbl-core/jit/js/jitHelpers.d.ts +0 -34
  395. package/dist-lib/numbl-core/jit/js/jitHelpersComplex.d.ts +0 -21
  396. package/dist-lib/numbl-core/jit/js/jitHelpersIndex.d.ts +0 -33
  397. package/dist-lib/numbl-core/jit/js/jitHelpersTensor.d.ts +0 -34
  398. package/dist-lib/numbl-core/jit/js/jsFusedCodegen.d.ts +0 -17
  399. package/dist-lib/numbl-core/jit/js/jsMultiReduction.d.ts +0 -70
  400. package/dist-lib/numbl-core/jit/scalarEmit.d.ts +0 -58
  401. package/dist-plot-viewer/assets/index-GiUNnMQg.js +0 -4426
  402. package/native/jit_runtime/jit_runtime.c +0 -261
  403. package/native/jit_runtime/jit_runtime.h +0 -204
@@ -1,394 +0,0 @@
1
- /**
2
- * JIT type system and IR node definitions.
3
- */
4
- import type { BinaryOperation, UnaryOperation } from "../parser/types.js";
5
- export type SignCategory = "positive" | "nonneg" | "nonpositive" | "negative";
6
- export type JitType = {
7
- kind: "number";
8
- exact?: number;
9
- sign?: SignCategory;
10
- isInteger?: boolean;
11
- } | {
12
- kind: "boolean";
13
- value?: boolean;
14
- } | {
15
- kind: "complex_or_number";
16
- pureImaginary?: boolean;
17
- } | {
18
- kind: "tensor";
19
- isComplex: boolean;
20
- shape?: number[];
21
- ndim?: number;
22
- isLogical?: boolean;
23
- nonneg?: boolean;
24
- } | {
25
- kind: "string";
26
- value?: string;
27
- } | {
28
- kind: "char";
29
- value?: string;
30
- } | {
31
- kind: "struct";
32
- fields?: Record<string, JitType>;
33
- } | {
34
- /**
35
- * A 1-D homogeneous array of structs (matlab struct array form
36
- * `T.nodes(i)`). `elemFields` records the per-element field types
37
- * unified across all elements. `length` is optional and carries
38
- * the statically-known element count when available.
39
- */
40
- kind: "struct_array";
41
- elemFields?: Record<string, JitType>;
42
- length?: number;
43
- } | {
44
- kind: "class_instance";
45
- className: string;
46
- isHandleClass?: boolean;
47
- fields?: Record<string, JitType>;
48
- } | {
49
- kind: "sparse_matrix";
50
- isComplex: boolean;
51
- m?: number;
52
- n?: number;
53
- } | {
54
- kind: "cell";
55
- shape?: number[];
56
- } | {
57
- kind: "dictionary";
58
- } | {
59
- kind: "function_handle";
60
- } | {
61
- kind: "unknown";
62
- };
63
- export declare function signFromNumber(v: number): SignCategory | undefined;
64
- export declare function isNonneg(t: JitType): boolean;
65
- export declare function flipSign(s?: SignCategory): SignCategory | undefined;
66
- export declare function unifySign(a?: SignCategory, b?: SignCategory): SignCategory | undefined;
67
- export declare function jitTypeKey(t: JitType): string;
68
- export declare function computeJitCacheKey(nargout: number, argTypes: JitType[]): string;
69
- /** Compute a unique JS function name for a JIT'd specialization. */
70
- export declare function computeJitFnName(identity: string, funcName: string): string;
71
- /** Widen/unify two types at control-flow join points. */
72
- export declare function unifyJitTypes(a: JitType, b: JitType): JitType;
73
- export declare function isScalarType(t: JitType): boolean;
74
- export declare function isNumericScalarType(t: JitType): boolean;
75
- export declare function isTensorType(t: JitType): boolean;
76
- export declare function isComplexType(t: JitType): boolean;
77
- /** True when the type guarantees an integer value at runtime (safe for |0). */
78
- export declare function isKnownInteger(t: JitType): boolean;
79
- /** Types that support arithmetic binary operations in the JIT. */
80
- export declare function isArithmeticType(t: JitType): boolean;
81
- export declare function shapeAfterReduction(shape: number[], dim?: number): {
82
- scalar: true;
83
- } | {
84
- scalar: false;
85
- shape: number[];
86
- };
87
- export type JitExpr = {
88
- tag: "NumberLiteral";
89
- value: number;
90
- jitType: JitType;
91
- } | {
92
- tag: "ImagLiteral";
93
- jitType: JitType;
94
- } | {
95
- tag: "Var";
96
- name: string;
97
- jitType: JitType;
98
- } | {
99
- tag: "Binary";
100
- op: BinaryOperation;
101
- left: JitExpr;
102
- right: JitExpr;
103
- jitType: JitType;
104
- } | {
105
- tag: "Unary";
106
- op: UnaryOperation;
107
- operand: JitExpr;
108
- jitType: JitType;
109
- } | {
110
- tag: "StringLiteral";
111
- value: string;
112
- isChar: boolean;
113
- jitType: JitType;
114
- } | {
115
- tag: "Call";
116
- name: string;
117
- args: JitExpr[];
118
- jitType: JitType;
119
- } | {
120
- tag: "UserCall";
121
- jitName: string;
122
- name: string;
123
- args: JitExpr[];
124
- jitType: JitType;
125
- } | {
126
- tag: "Index";
127
- base: JitExpr;
128
- indices: JitExpr[];
129
- jitType: JitType;
130
- } | {
131
- /**
132
- * Range slice read on a real tensor: `src(a:b)` producing a fresh
133
- * column-vector tensor of length `b - a + 1`. Stage 21 — unblocks
134
- * chunkie's chunk_nearparam Newton loop which splits a Legendre
135
- * expansion vector via `r0 = all0(1:dim)`.
136
- *
137
- * Codegen emits `$h.subarrayCopy1r(srcData, srcLen, start, end)`
138
- * using the hoisted data/length aliases. Per-iter allocation is
139
- * unavoidable without a range-alias extension to stage 5; small
140
- * slices are cheap in V8 young-gen.
141
- */
142
- tag: "RangeSliceRead";
143
- baseName: string;
144
- start: JitExpr;
145
- /** `null` when the range endpoint is the `end` keyword — codegen
146
- * substitutes the hoisted `.data.length` alias. */
147
- end: JitExpr | null;
148
- /** True when the source is a statically-known row vector
149
- * (shape `[1, n]`); the slice then preserves row orientation.
150
- * Otherwise the slice is a column vector (MATLAB semantics). */
151
- isRow: boolean;
152
- jitType: JitType;
153
- } | {
154
- tag: "TensorLiteral";
155
- rows: JitExpr[][];
156
- nRows: number;
157
- nCols: number;
158
- jitType: JitType;
159
- } | {
160
- /**
161
- * Vertical concat growth: `[base; value]` where `base` is a real
162
- * column-vector (or empty) tensor and `value` is a numeric scalar.
163
- * Lowered from the chunkie grow-a-list pattern `it = [it; i]`.
164
- * Codegens to `$h.vconcatGrow1r(base, value)` which allocates a
165
- * fresh `(k+1, 1)` tensor and copies.
166
- */
167
- tag: "VConcatGrow";
168
- base: JitExpr;
169
- value: JitExpr;
170
- jitType: JitType;
171
- } | {
172
- /**
173
- * Scalar read of a struct field: `s.f` where `s` has a struct type
174
- * with a statically-known scalar field `f`. Lowered from `Member`
175
- * exprs with an `Ident` base. The codegen hoists each unique
176
- * `(baseName, fieldName)` pair to a local alias at function entry
177
- * so per-iter reads are bare local loads (no `Map.get` per use).
178
- * Mirrors the chunkie `opts.rho`, `chnkr.k`, `chnkr.nch` pattern.
179
- */
180
- tag: "MemberRead";
181
- baseName: string;
182
- fieldName: string;
183
- jitType: JitType;
184
- } | {
185
- /**
186
- * Chained struct array member read: `T.nodes(i).leaf` where
187
- * `T.nodes` is a struct array whose elements all share a field
188
- * `leaf`. Lowered from the parser shape
189
- * `Member(MethodCall(Ident(T), "nodes", [i]), "leaf")`.
190
- *
191
- * Codegen hoists `var $T_nodes_elements = T.fields.get("nodes").elements`
192
- * at function entry (one alias per unique (structVarName,
193
- * structArrayFieldName) pair) and emits
194
- * `$T_nodes_elements[Math.round(i) - 1].fields.get("leaf")` per use.
195
- *
196
- * `leafFieldJitType` records the result type: either a scalar
197
- * numeric type (number/boolean/complex_or_number) or a real tensor.
198
- * Tensor-valued leaves work because the existing per-Assign hoist
199
- * refresh picks up the newly-read tensor when the result flows
200
- * into `chld = T.nodes(i).chld` and the callers then use
201
- * `chld(k)` through the hoisted alias path.
202
- */
203
- tag: "StructArrayMemberRead";
204
- structVarName: string;
205
- structArrayFieldName: string;
206
- indexExpr: JitExpr;
207
- leafFieldName: string;
208
- jitType: JitType;
209
- } | {
210
- /**
211
- * Indirect call through a function handle variable: `f(a, b)` where
212
- * `f` has JitType `function_handle`. The codegen emits
213
- * `$h.callFuncHandle($rt, f, arg1, arg2, ...)` which invokes the
214
- * handle via its `jsFn` closure (or falls back to `rt.dispatch`).
215
- * The `returnType` is determined at lowering time by probing the
216
- * function handle's runtime value.
217
- */
218
- tag: "FuncHandleCall";
219
- name: string;
220
- args: JitExpr[];
221
- jitType: JitType;
222
- } | {
223
- /**
224
- * User function call that bailed recursive lowering (stage 24 —
225
- * soft-bail). Instead of bailing the containing loop, emit a
226
- * runtime dispatch through the interpreter. Return type is
227
- * determined at JIT compile time by probing (actually calling
228
- * the function once with representative args). The helper
229
- * `callUserFunc` verifies the actual return type on every call
230
- * and throws `JitFuncHandleBailError` on mismatch so the loop
231
- * runner can invalidate the cache entry and fall back to
232
- * interpretation.
233
- *
234
- * Use case: `oneintp(...)` / `lege.exev(...)` in chunkie's adap
235
- * inner loop — the callee body has tensor arithmetic the JIT
236
- * can't inline, but the outer loop (scalar stack + col-slice
237
- * writes + scalar compares) is a perfect JIT fit.
238
- */
239
- tag: "UserDispatchCall";
240
- name: string;
241
- args: JitExpr[];
242
- jitType: JitType;
243
- };
244
- export type JitStmt = {
245
- tag: "Assign";
246
- name: string;
247
- expr: JitExpr;
248
- } | {
249
- tag: "AssignIndex";
250
- /** Name of the tensor variable being written to (must be an Ident-based lvalue). */
251
- baseName: string;
252
- /** Scalar index expressions (1..3). */
253
- indices: JitExpr[];
254
- /** RHS scalar value to store. */
255
- value: JitExpr;
256
- /** Type of the base tensor (for codegen to choose the right helper). */
257
- baseType: JitType;
258
- } | {
259
- /**
260
- * Range-slice write of the form `dst(a:b) = src(c:d)` or
261
- * `dst(a:b) = src` (whole-tensor source). Both `dst` and `src` must
262
- * be real tensors, and the LHS must use exactly one (linear) range
263
- * index. Used by the loop JIT for the chunkie grow-and-copy pattern.
264
- *
265
- * When `srcStart` and `srcEnd` are both `null`, the source is used
266
- * in its entirety — codegen substitutes `1` and `srcLen` (the
267
- * source's hoisted length alias). This is stage 9's whole-tensor
268
- * RHS form: `isp(1:nn) = itemp` where `itemp` is a plain Var.
269
- */
270
- tag: "AssignIndexRange";
271
- baseName: string;
272
- baseType: JitType;
273
- dstStart: JitExpr;
274
- dstEnd: JitExpr;
275
- srcBaseName: string;
276
- srcType: JitType;
277
- srcStart: JitExpr | null;
278
- srcEnd: JitExpr | null;
279
- } | {
280
- /**
281
- * Multi-dim column slice write `dst(:, j) = src` where both `dst`
282
- * and `src` are real tensors. LHS must be `Index(Ident(dst),
283
- * [Colon, scalar_j])` with `dst` having statically 2-D shape.
284
- * RHS must be a plain Ident referencing a real-tensor var whose
285
- * total element count matches `dst.shape[0]` at runtime.
286
- *
287
- * Used by the loop JIT for chunkie's adapgausskerneval column
288
- * stack write: `vals(:, jj+1) = v2`. Also covers
289
- * chunkerinterior's `rss(:, jj) = rval(:, k)` after a slice
290
- * alias binds the RHS.
291
- */
292
- tag: "AssignIndexCol";
293
- baseName: string;
294
- baseType: JitType;
295
- colIndex: JitExpr;
296
- srcBaseName: string;
297
- srcType: JitType;
298
- } | {
299
- /**
300
- * Page-slice write `dst(:, :, k) = rhs` where `dst` is a 3-D tensor
301
- * and `rhs` is a 2-D tensor. Real-base + complex-rhs upgrades the
302
- * base to complex in place. Drives chunkie helm2d.green's
303
- * `grad(:,:,k) = ...` / `hess(:,:,k) = ...` assignments.
304
- */
305
- tag: "AssignIndexPage3d";
306
- baseName: string;
307
- /** Base tensor type AFTER the write (may be complex even if the
308
- * initializer was real — the lowerer promotes in ctx.env). */
309
- baseType: JitType;
310
- /** Page index (1-based). */
311
- pageIndex: JitExpr;
312
- /** 2-D tensor RHS. */
313
- value: JitExpr;
314
- } | {
315
- /**
316
- * Struct field assign lvalue `s.f = v`. When `needsPromote` is
317
- * true, the base is (re)initialized as a fresh empty struct
318
- * before the field is set — mirrors MATLAB's
319
- * `s = []; s.f = v` idiom that promotes the empty matrix to a
320
- * struct on first field write. `valueType` is the JIT type of
321
- * `value` so stage 12 can hoist subsequent reads through a
322
- * typed alias.
323
- */
324
- tag: "AssignMember";
325
- baseName: string;
326
- fieldName: string;
327
- value: JitExpr;
328
- needsPromote: boolean;
329
- } | {
330
- tag: "If";
331
- cond: JitExpr;
332
- thenBody: JitStmt[];
333
- elseifBlocks: {
334
- cond: JitExpr;
335
- body: JitStmt[];
336
- }[];
337
- elseBody: JitStmt[] | null;
338
- } | {
339
- tag: "For";
340
- varName: string;
341
- start: JitExpr;
342
- step: JitExpr | null;
343
- end: JitExpr;
344
- body: JitStmt[];
345
- } | {
346
- tag: "While";
347
- cond: JitExpr;
348
- body: JitStmt[];
349
- } | {
350
- tag: "Break";
351
- } | {
352
- tag: "Continue";
353
- } | {
354
- tag: "Return";
355
- } | {
356
- tag: "ExprStmt";
357
- expr: JitExpr;
358
- } | {
359
- tag: "MultiAssign";
360
- names: (string | null)[];
361
- callName: string;
362
- args: JitExpr[];
363
- outputTypes: JitType[];
364
- } | {
365
- /**
366
- * Call a synthetic specialization (installed as a forwarder on $h)
367
- * and write back multiple outputs into outer-scope vars. Only
368
- * produced by the hybrid-loop pass in hybrid.ts, which
369
- * replaces a For/While JitStmt with this call form when the
370
- * extracted loop specialization compiled to native C.
371
- *
372
- * Semantics (0 / 1 / N outputs):
373
- * nargout==0 → emit `$h.callUser(...)` as a stmt (no writeback)
374
- * nargout==1 → emit `out = $h.callUser(...)`
375
- * nargout>=2 → emit `var $r = $h.callUser(...); out0=$r[0]; ...`
376
- */
377
- tag: "UserCallWriteback";
378
- outputs: string[];
379
- jitName: string;
380
- name: string;
381
- args: JitExpr[];
382
- outputTypes: JitType[];
383
- } | {
384
- tag: "SetLoc";
385
- line: number;
386
- } | {
387
- /** C-JIT assertion: if this JitStmt survives to JS codegen at --opt 2,
388
- * emit a runtime throw. The C-JIT codegen elides it. */
389
- tag: "AssertCJit";
390
- };
391
- export interface JitCacheEntry {
392
- fn: (...args: unknown[]) => unknown;
393
- source: string;
394
- }
@@ -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, experimental?: string, par?: boolean): 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,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, shareTensor, 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 type { 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 FloatXArrayType, 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: FloatXArrayType, len: number, i: number): number;
25
- export declare function idx2r_h(data: FloatXArrayType, len: number, rows: number, ri: number, ci: number): number;
26
- export declare function idx3r_h(data: FloatXArrayType, len: number, d0: number, d1: number, i1: number, i2: number, i3: number): number;
27
- export declare function set1r_h(data: FloatXArrayType, len: number, i: number, v: number): void;
28
- export declare function set2r_h(data: FloatXArrayType, len: number, rows: number, ri: number, ci: number, v: number): void;
29
- export declare function set3r_h(data: FloatXArrayType, len: number, d0: number, d1: number, i1: number, i2: number, i3: number, v: number): void;
30
- export declare function setRange1r_h(dstData: FloatXArrayType, dstLen: number, dstStart: number, dstEnd: number, srcData: FloatXArrayType, srcLen: number, srcStart: number, srcEnd: number): void;
31
- export declare function subarrayCopy1r(srcData: FloatXArrayType, srcLen: number, start: number, end: number): RuntimeTensor;
32
- export declare function subarrayCopy1rRow(srcData: FloatXArrayType, srcLen: number, start: number, end: number): RuntimeTensor;
33
- export declare function setCol2r_h(dstData: FloatXArrayType, dstRows: number, dstLen: number, col: number, srcData: FloatXArrayType, 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 { type FloatXArrayType, type RuntimeTensor } from "../../runtime/types.js";
7
- import type { RuntimeComplexNumber } from "../../runtime/types.js";
8
- export declare function makeTensor(data: FloatXArrayType, imag: FloatXArrayType | undefined, shape: number[]): RuntimeTensor;
9
- /** Bump rc on a tensor (no-op for non-tensor values). Used for var-to-var
10
- * JIT assignments so the aliased tensor is no longer eligible for
11
- * in-place buffer reuse. */
12
- export declare function shareTensor(v: unknown): unknown;
13
- type ScalarVal = number | RuntimeComplexNumber;
14
- export declare function tensorBinaryOp(a: unknown, b: unknown, realOp: (x: number, y: number) => number, complexOp: (a: ScalarVal, b: ScalarVal) => ScalarVal): RuntimeTensor | ScalarVal;
15
- export declare function tensorCompareOp(a: unknown, b: unknown, cmp: (x: number, y: number) => boolean): RuntimeTensor;
16
- export declare function tensorUnary(dest: unknown, a: RuntimeTensor, fn: (x: number) => number): RuntimeTensor;
17
- export declare function tensorNeg(dest: unknown, a: RuntimeTensor): RuntimeTensor;
18
- export declare function tDouble(v: unknown): unknown;
19
- export declare function tSum(v: unknown): unknown;
20
- export declare function vconcatGrow1r(base: unknown, v: number): RuntimeTensor;
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,17 +0,0 @@
1
- /**
2
- * Fused per-element loop emission for the JS-JIT.
3
- *
4
- * Given a FusibleChain (from fusion.ts), emits a single block-scoped
5
- * JavaScript `for` loop that evaluates all the chain's tensor assigns
6
- * as inline scalar expressions per element — no $h.tAdd / $h.tMul
7
- * helper calls, no intermediate tensor allocations.
8
- *
9
- * Tensor var references become either:
10
- * - `__<name>_data[__i]` for input params / pre-existing tensors
11
- * - `__f_<name>` for chain-produced intermediates (scalar local)
12
- *
13
- * The optional trailing reduction is absorbed as an inline accumulator
14
- * inside the same loop.
15
- */
16
- import type { FusibleChain } from "../fusion.js";
17
- export declare function emitJsFusedChain(lines: string[], indent: string, chain: FusibleChain, allTensorVars: ReadonlySet<string>, paramTensors: ReadonlySet<string>, outputTensorNames: ReadonlySet<string>, _localTensorNames: ReadonlySet<string>, complexTensorNames: ReadonlySet<string>, complexScalarVars: ReadonlySet<string>, mangle: (n: string) => string, experimental?: string, par?: boolean): void;