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
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Cross-Origin Isolation Service Worker
3
+ *
4
+ * Adds COOP/COEP headers to responses so that SharedArrayBuffer is available
5
+ * on hosts that don't allow custom response headers (e.g. GitHub Pages).
6
+ *
7
+ * Based on https://github.com/niccokunzmann/coi-serviceworker (MIT).
8
+ */
9
+
10
+ /* global self, caches, fetch, Response, clients */
11
+
12
+ if (typeof window === "undefined") {
13
+ // --- Service Worker scope ---
14
+ self.addEventListener("install", () => self.skipWaiting());
15
+ self.addEventListener("activate", event =>
16
+ event.waitUntil(self.clients.claim())
17
+ );
18
+
19
+ self.addEventListener("fetch", event => {
20
+ const request = event.request;
21
+ if (request.cache === "only-if-cached" && request.mode !== "same-origin") {
22
+ return; // Chrome bug workaround
23
+ }
24
+
25
+ // Only add isolation headers to same-origin responses.
26
+ // Wrapping cross-origin responses in a new Response strips CORS
27
+ // internal flags, which breaks cross-origin fetch requests.
28
+ if (new URL(request.url).origin !== self.location.origin) {
29
+ return; // let the browser handle cross-origin requests normally
30
+ }
31
+
32
+ event.respondWith(
33
+ fetch(request).then(response => {
34
+ if (response.status === 0) return response; // opaque response
35
+
36
+ const headers = new Headers(response.headers);
37
+ headers.set("Cross-Origin-Embedder-Policy", "credentialless");
38
+ headers.set("Cross-Origin-Opener-Policy", "same-origin");
39
+
40
+ return new Response(response.body, {
41
+ status: response.status,
42
+ statusText: response.statusText,
43
+ headers,
44
+ });
45
+ })
46
+ );
47
+ });
48
+ } else {
49
+ // --- Window scope (registration) ---
50
+
51
+ // Capture currentScript synchronously — it becomes null after script runs.
52
+ const scriptUrl = document.currentScript && document.currentScript.src;
53
+
54
+ if (!window.crossOriginIsolated && navigator.serviceWorker) {
55
+ navigator.serviceWorker.register(scriptUrl || "/coi-serviceworker.js").then(
56
+ reg => {
57
+ if (reg.installing || reg.waiting) {
58
+ const sw = reg.installing || reg.waiting;
59
+ sw.addEventListener("statechange", () => {
60
+ if (sw.state === "activated") window.location.reload();
61
+ });
62
+ } else if (reg.active && !navigator.serviceWorker.controller) {
63
+ // Active but not yet controlling — reload to let it intercept.
64
+ window.location.reload();
65
+ }
66
+ },
67
+ err => console.error("COI service worker registration failed:", err)
68
+ );
69
+ }
70
+ }
@@ -0,0 +1,23 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
2
+ <!-- Background -->
3
+ <rect width="32" height="32" fill="#64748b" rx="4"/>
4
+
5
+ <!-- Matrix brackets and dots (white on blue) -->
6
+ <g stroke="white" stroke-width="2" fill="none" stroke-linecap="round">
7
+ <!-- Left bracket -->
8
+ <path d="M 8 9 L 6 9 L 6 23 L 8 23"/>
9
+ <!-- Right bracket -->
10
+ <path d="M 24 9 L 26 9 L 26 23 L 24 23"/>
11
+ </g>
12
+
13
+ <!-- Matrix dots -->
14
+ <g fill="white">
15
+ <circle cx="12" cy="13" r="1.5"/>
16
+ <circle cx="16" cy="13" r="1.5"/>
17
+ <circle cx="20" cy="13" r="1.5"/>
18
+
19
+ <circle cx="12" cy="19" r="1.5"/>
20
+ <circle cx="16" cy="19" r="1.5"/>
21
+ <circle cx="20" cy="19" r="1.5"/>
22
+ </g>
23
+ </svg>
@@ -0,0 +1,16 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="./favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>numbl project</title>
8
+ <!-- numbl:base -->
9
+ <script src="./coi-serviceworker.js"></script>
10
+ <script type="module" crossorigin src="./assets/index-CgBUy7v7.js"></script>
11
+ <link rel="stylesheet" crossorigin href="./assets/index-D5YY8PKx.css">
12
+ </head>
13
+ <body>
14
+ <div id="root"></div>
15
+ </body>
16
+ </html>
@@ -0,0 +1,26 @@
1
+ <svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
2
+ <!-- Background circle -->
3
+ <circle cx="100" cy="100" r="90" fill="#64748b" opacity="0.1"/>
4
+
5
+ <!-- Matrix brackets (left and right) -->
6
+ <g stroke="#64748b" stroke-width="4" fill="none" stroke-linecap="round">
7
+ <!-- Left bracket -->
8
+ <path d="M 50 60 L 40 60 L 40 140 L 50 140"/>
9
+ <!-- Right bracket -->
10
+ <path d="M 150 60 L 160 60 L 160 140 L 150 140"/>
11
+ </g>
12
+
13
+ <!-- Matrix elements (stylized dots) -->
14
+ <g fill="#64748b">
15
+ <circle cx="70" cy="80" r="6"/>
16
+ <circle cx="100" cy="80" r="6"/>
17
+ <circle cx="130" cy="80" r="6"/>
18
+
19
+ <circle cx="70" cy="110" r="6"/>
20
+ <circle cx="100" cy="110" r="6"/>
21
+ <circle cx="130" cy="110" r="6"/>
22
+ </g>
23
+
24
+ <!-- Text: "Numbl" -->
25
+ <text x="100" y="175" font-family="sans-serif" font-size="32" font-weight="700" fill="#475569" text-anchor="middle">Numbl</text>
26
+ </svg>
@@ -0,0 +1,111 @@
1
+ /*
2
+ Define a custom HTML element <numbl-embed> that embeds a numbl iframe.
3
+
4
+ Usage:
5
+ <numbl-embed>
6
+ <iframe width="100%" height="500" frameborder="0"></iframe>
7
+
8
+ <script type="text/plain" class="matlab-script">
9
+ ... MATLAB script ...
10
+ </script>
11
+
12
+ </numbl-embed>
13
+
14
+ You can also specify the MATLAB script URL via attribute:
15
+ <numbl-embed script="relative-or-absolute-url-to-matlab-script">
16
+ <iframe width="100%" height="500" frameborder="0"></iframe>
17
+ </numbl-embed>
18
+ */
19
+ class NumblEmbed extends HTMLElement {
20
+ constructor() {
21
+ super();
22
+ }
23
+
24
+ connectedCallback() {
25
+ if (document.readyState === "loading") {
26
+ document.addEventListener("DOMContentLoaded", () => this.initialize());
27
+ } else {
28
+ this.initialize();
29
+ }
30
+ }
31
+
32
+ initialize() {
33
+ this.iframe = this.querySelector("iframe");
34
+ if (!this.iframe) {
35
+ console.error("Missing iframe element in numbl-embed");
36
+ return;
37
+ }
38
+
39
+ const defaultNumblUrl = "https://numbl.org";
40
+ const numblUrl = this.attributes["numbl-url"]?.value || defaultNumblUrl;
41
+ const cacheBust = `_cb=${Date.now()}`;
42
+ const mode = this.getAttribute("mode");
43
+
44
+ // REPL mode: no script needed, just load the REPL page
45
+ if (mode === "repl") {
46
+ this.iframe.src = `${numblUrl}/embed-repl?${cacheBust}`;
47
+ return;
48
+ }
49
+
50
+ const encodePlain = text => {
51
+ const text2 = text.replace(/&lt;/g, "<").replace(/&gt;/g, ">");
52
+ return btoa(text2);
53
+ };
54
+
55
+ const scriptElement = this.querySelector("script.matlab-script");
56
+
57
+ let scriptBase64;
58
+ if (scriptElement) {
59
+ const matlabScript = scriptElement.textContent.trim();
60
+ scriptBase64 = encodePlain(matlabScript);
61
+ } else if (this.attributes.script) {
62
+ const scriptUrl = this.attributes.script.value;
63
+ this.loadScriptFromUrl(scriptUrl);
64
+ return;
65
+ } else {
66
+ scriptBase64 = null;
67
+ }
68
+
69
+ if (scriptBase64) {
70
+ this.iframe.src = `${numblUrl}/embed?script=${scriptBase64}&${cacheBust}`;
71
+ } else {
72
+ this.iframe.src = `${numblUrl}/embed?${cacheBust}`;
73
+ }
74
+ }
75
+
76
+ async loadScriptFromUrl(url) {
77
+ try {
78
+ let absoluteUrl = url;
79
+ if (url.startsWith("./") || url.startsWith("../")) {
80
+ const baseUrl = window.location.href;
81
+ absoluteUrl = new URL(url, baseUrl).href;
82
+ }
83
+
84
+ const response = await fetch(absoluteUrl);
85
+ if (!response.ok) {
86
+ throw new Error(`Failed to fetch script: ${response.statusText}`);
87
+ }
88
+
89
+ const scriptContent = await response.text();
90
+ const scriptBase64 = btoa(scriptContent);
91
+
92
+ const defaultNumblUrl = "https://numbl.org";
93
+ const numblUrl = this.attributes["numbl-url"]?.value || defaultNumblUrl;
94
+
95
+ const cacheBust = `_cb=${Date.now()}`;
96
+ this.iframe.src = `${numblUrl}/embed?script=${scriptBase64}&${cacheBust}`;
97
+ } catch (error) {
98
+ console.error("Error loading MATLAB script:", error);
99
+ this.iframe.srcdoc = `
100
+ <html>
101
+ <body style="font-family: Arial; padding: 20px;">
102
+ <h3>Error loading MATLAB script</h3>
103
+ <p>${error.message}</p>
104
+ </body>
105
+ </html>
106
+ `;
107
+ }
108
+ }
109
+ }
110
+
111
+ customElements.define("numbl-embed", NumblEmbed);
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -9,7 +9,7 @@
9
9
  * BRe: Float64Array, BIm: Float64Array, nrhs: number): {re, im}
10
10
  *
11
11
  * A is m×n in column-major order; B is m×nrhs.
12
- * Returns X (n×nrhs) in a new Float64Array in column-major order.
12
+ * Returns X (n×nrhs) in a allocFloat64Array in column-major order.
13
13
  *
14
14
  * Square (m == n):
15
15
  * Uses dgesv / zgesv (LU with partial pivoting). Throws if A is singular.
@@ -227,14 +227,14 @@ inline std::vector<lapack_complex_double> splitToInterleaved(
227
227
  return out;
228
228
  }
229
229
 
230
- // Create a new Float64Array from a std::vector<double>.
230
+ // Create a allocFloat64Array from a std::vector<double>.
231
231
  inline Napi::Float64Array vecToF64(Napi::Env env, const std::vector<double>& v) {
232
232
  auto arr = Napi::Float64Array::New(env, v.size());
233
233
  std::memcpy(arr.Data(), v.data(), v.size() * sizeof(double));
234
234
  return arr;
235
235
  }
236
236
 
237
- // Create a new Float64Array from raw pointer + count.
237
+ // Create a allocFloat64Array from raw pointer + count.
238
238
  inline Napi::Float64Array ptrToF64(Napi::Env env, const double* data, size_t n) {
239
239
  auto arr = Napi::Float64Array::New(env, n);
240
240
  std::memcpy(arr.Data(), data, n * sizeof(double));
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Real + complex comparison ops. Output is a logical tensor stored as
3
- * 0.0 / 1.0 in a double buffer (numbl stores logicals as FloatXArray with
3
+ * 0.0 / 1.0 in a double buffer (numbl stores logicals as Float64Array with
4
4
  * an _isLogical flag on the runtime tensor).
5
5
  *
6
6
  * Caller-allocated input/output buffers; never copies.
@@ -8,7 +8,9 @@
8
8
  #include <math.h>
9
9
 
10
10
  static inline double rsign(double x) {
11
- return x > 0.0 ? 1.0 : x < 0.0 ? -1.0 : 0.0;
11
+ // MATLAB: sign(NaN) is NaN; sign(0) is 0. The bare comparison chain
12
+ // would map NaN -> 0 (both x>0 and x<0 are false), so guard NaN first.
13
+ return x > 0.0 ? 1.0 : x < 0.0 ? -1.0 : (x == 0.0 ? 0.0 : NAN);
12
14
  }
13
15
 
14
16
  int numbl_real_unary_elemwise(int op, size_t n,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numbl",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Run .m source files in the browser and on the command line by compiling to JavaScript",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -33,20 +33,25 @@
33
33
  "dist-lib/",
34
34
  "dist-cli/",
35
35
  "dist-plot-viewer/",
36
+ "dist-site-viewer/",
36
37
  "native/",
37
38
  "binding.gyp"
38
39
  ],
39
40
  "scripts": {
40
- "dev": "npm run bundle:stdlib && vite",
41
- "build": "npm run build:web && npm run build:test-runner && npm run copy:test-scripts && npm run build:cli && npm run build:plot-viewer",
41
+ "dev": "npm run build:snippets && npm run bundle:stdlib && vite",
42
+ "build": "npm run build:web && npm run build:test-runner && npm run copy:test-scripts && npm run build:cli && npm run build:plot-viewer && npm run build:site-viewer",
42
43
  "build:plot-viewer": "vite build --config vite.plot-viewer.config.ts",
43
- "build:test-runner": "npm run bundle:stdlib && vite build --config vite.test-runner.config.ts",
44
- "dev:test-runner": "npm run bundle:stdlib && vite --config vite.test-runner.config.ts",
44
+ "build:site-viewer": "npm run build:snippets && npm run bundle:stdlib && vite build --config vite.site-viewer.config.ts",
45
+ "dev:site-viewer": "npm run build:snippets && npm run bundle:stdlib && vite --config vite.site-viewer.config.ts",
46
+ "build:test-runner": "npm run build:snippets && npm run bundle:stdlib && vite build --config vite.test-runner.config.ts",
47
+ "dev:test-runner": "npm run build:snippets && npm run bundle:stdlib && vite --config vite.test-runner.config.ts",
45
48
  "copy:test-scripts": "tsx scripts/copy-test-scripts.ts",
46
49
  "bundle:stdlib": "tsx scripts/bundle-stdlib.ts",
47
- "build:web": "npm run bundle:stdlib && tsc -b && vite build",
48
- "build:lib": "npm run bundle:stdlib && esbuild src/lib.ts --bundle --platform=neutral --format=esm --outfile=dist-lib/lib.js --loader:.wasm=file && tsc -p tsconfig.lib.json",
49
- "build:cli": "npm run bundle:stdlib && esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist-cli/cli.js --packages=external --loader:.wasm=file",
50
+ "build:snippets": "tsx scripts/build_runtime_snippets.ts",
51
+ "build:snippets:check": "tsx scripts/build_runtime_snippets.ts --check",
52
+ "build:web": "npm run build:snippets && npm run bundle:stdlib && tsc -b && vite build",
53
+ "build:lib": "npm run build:snippets && npm run bundle:stdlib && esbuild src/lib.ts --bundle --platform=node --format=esm --outfile=dist-lib/lib.js --packages=external --loader:.wasm=file && tsc -p tsconfig.lib.json",
54
+ "build:cli": "npm run build:snippets && npm run bundle:stdlib && esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist-cli/cli.js --packages=external --loader:.wasm=file",
50
55
  "install": "true",
51
56
  "build:addon": "node-gyp rebuild",
52
57
  "format": "prettier --write .",
@@ -54,19 +59,17 @@
54
59
  "lint": "eslint .",
55
60
  "typecheck": "tsc -b",
56
61
  "preview": "vite preview",
57
- "test": "npm run test:float64",
58
- "test:float32": "NUMBL_USE_FLOAT32=true vitest run",
59
- "test:float64": "NUMBL_USE_FLOAT32=false vitest run",
62
+ "test": "vitest run",
60
63
  "test:coverage": "vitest run --coverage",
61
64
  "test:coverage:all": "bash scripts/coverage-all.sh",
62
65
  "test:scripts": "bash numbl_test_scripts/run_all.sh",
66
+ "jit-parity": "node jit_parity/run.mjs",
63
67
  "test:browser": "playwright test",
64
- "test:scripts:e1": "bash numbl_test_scripts/run_e1.sh",
65
68
  "build:wasm": "bash numbl_test_scripts/build_wasm.sh",
66
69
  "update-readme": "tsx scripts/update-readme-usage.ts",
67
70
  "check-readme": "tsx scripts/update-readme-usage.ts --check",
68
71
  "bump": "tsx scripts/bump-version.ts",
69
- "prepublishOnly": "npm run build:lib && npm run build:cli && npm run build:plot-viewer",
72
+ "prepublishOnly": "npm run build:lib && npm run build:cli && npm run build:plot-viewer && npm run build:site-viewer",
70
73
  "prepare": "husky"
71
74
  },
72
75
  "dependencies": {
@@ -1,90 +0,0 @@
1
- /**
2
- * The native ABI as an explicit slot schema — one source of truth shared
3
- * between the C-signature builder (assemble.ts) and the JS wrapper
4
- * marshaller (install.ts).
5
- *
6
- * Each `AbiSlot` carries everything either side needs: the C type for
7
- * the signature, the koffi type string (with `_Out_` prefix for
8
- * out-pointers), the identifier name in the emitted C, and a backref
9
- * (paramIdx / outputIdx) so the JS wrapper can locate the source value
10
- * or output buffer without reconstructing the param-to-slot mapping
11
- * itself.
12
- *
13
- * Adding a new ABI shape = add a slot kind here, emit it in
14
- * `buildAbiSlots`, and handle it in the JS marshaller.
15
- */
16
- import type { ClassificationResult } from "./classify.js";
17
- export type AbiSlotKind = "scalar" | "complexScalarRe" | "complexScalarIm" | "tensorData"
18
- /** Imaginary data pointer for a complex tensor param. Paired with
19
- * `tensorData`. Marshaller passes the RuntimeTensor's `.imag` (a
20
- * Float64Array) or NULL when `.imag === undefined`; the numbl_ops
21
- * complex kernels treat NULL imag as all-zero. */
22
- | "tensorDataIm" | "tensorLen" | "tensorD0" | "tensorD1" | "scalarOut" | "complexScalarReOut" | "complexScalarImOut" | "fixedOutBuf"
23
- /** Imaginary fixed-output buffer (complex tensor output, non-dynamic). */
24
- | "fixedOutBufIm" | "fixedOutLen" | "dynOutBuf"
25
- /** Imaginary buffer pointer for a dynamic complex tensor output. C
26
- * mallocs, transfers ownership via `double **`; wrapper decodes+copies
27
- * into a fresh Float64Array then frees. */
28
- | "dynOutBufIm" | "dynOutLen" | "dynOutD0" | "dynOutD1" | "ticState" | "errFlag"
29
- /** Callback for `disp(...)` — JS-registered function pointer. The C
30
- * body invokes it directly; the JS wrapper supplies a koffi-registered
31
- * pointer that routes into `rt.output`. Signature:
32
- * void __disp_cb(const char *s, double num, int kind)
33
- * kind=0 => use `s`, kind=1 => use `num`. */
34
- | "dispCb";
35
- export interface AbiSlot {
36
- kind: AbiSlotKind;
37
- /** C type string for the signature, e.g. "double", "const double *",
38
- * "double **". */
39
- cType: string;
40
- /** Identifier as it appears in the C signature. */
41
- cName: string;
42
- /** koffi type string, with `_Out_` prefix where koffi must treat the
43
- * pointer as an out-param. */
44
- koffiType: string;
45
- /** Index into paramDescs, for "scalar" / "tensor*" kinds. */
46
- paramIdx?: number;
47
- /** Index into outputDescs, for output-allocated kinds. */
48
- outputIdx?: number;
49
- }
50
- export interface CParamDesc {
51
- name: string;
52
- kind: "scalar" | "complexScalar" | "tensor";
53
- /** For tensor params: max indexing arity the body uses (1, 2, or 3).
54
- * Drives the extra `_d0` / `_d1` shape args the JS wrapper must
55
- * marshal. `undefined` means the tensor is only used in whole-tensor
56
- * ops (legacy data/len ABI). */
57
- ndim?: number;
58
- /** True for complex tensor params. Adds an imag-data slot right after
59
- * the real-data slot; the marshaller supplies the tensor's `.imag`
60
- * Float64Array or NULL. Ignored for scalar kinds. */
61
- isComplex?: boolean;
62
- /** Ordered slots this param contributes to the ABI. One slot for a
63
- * scalar; two for a complex scalar (re + im); two or more
64
- * (data + [imag for complex] + len + optional d0/d1) for a tensor. */
65
- slots: AbiSlot[];
66
- }
67
- /** Per-output descriptor. Tells the JS wrapper how to marshal outputs. */
68
- export interface COutputDesc {
69
- name: string;
70
- kind: "scalar" | "boolean" | "complexScalar" | "tensor";
71
- /** True for tensor outputs using the dynamic-output ABI: the C code
72
- * malloc's the buffer and transfers ownership via `double **` and
73
- * extra d0/d1 out-slots. The JS wrapper decodes the pointer, copies
74
- * into a fresh Float64Array, and frees the C allocation. */
75
- dynamic?: boolean;
76
- /** True for complex tensor outputs. Fixed outputs add a paired imag
77
- * Float64Array buffer; dynamic outputs add a paired imag `double **`
78
- * out-pointer the caller decodes + frees after the call. */
79
- isComplex?: boolean;
80
- /** Ordered slots this output contributes to the ABI. One for scalars,
81
- * two for complex scalars (reOut + imOut), two for fixed real tensor
82
- * outputs (buf + lenOut), three for fixed complex (buf + bufIm +
83
- * lenOut), four for dynamic real tensor outputs, five for dynamic
84
- * complex (dynBuf + dynBufIm + dynLen + dynD0 + dynD1). */
85
- slots: AbiSlot[];
86
- }
87
- /** Build the ABI schema for one generated function. Mutates paramDescs /
88
- * outputDescs in place by filling in `slots`; returns the complete
89
- * `abiSlots` array in calling order (params, then outputs, then trailers). */
90
- export declare function buildAbiSlots(paramDescs: CParamDesc[], outputDescs: COutputDesc[], cls: ClassificationResult, paramOutputTensors: Set<string>, unshareTensorParams: Set<string>, needsTicState: boolean, needsErrorFlag: boolean, needsDispCb: boolean): AbiSlot[];
@@ -1,56 +0,0 @@
1
- /**
2
- * JIT IR → pure C code generation (koffi path).
3
- *
4
- * Orchestration only: this file wires the classify / ABI / emit pieces
5
- * together and assembles the final C source (headers + per-callee
6
- * static functions + outer function).
7
- *
8
- * classify.ts — TensorMeta / analyzeTensorUsage, the single pass
9
- * feeding every downstream decision.
10
- * abi.ts — AbiSlot / CParamDesc / COutputDesc, buildAbiSlots.
11
- * The one schema walked by both signature and JS.
12
- * emit/ — per-statement / per-expression C emission, split
13
- * by concern (scalar, complexScalar, tensor, assign,
14
- * userCall, stmt, fused). Reads ctx.cls for every
15
- * classification decision.
16
- * context.ts — EmitCtx + shared name/opcode helpers.
17
- *
18
- * UserCall support: when a feasible user-defined function is called
19
- * from the outer body, its lowered IR is already in `generatedIRBodies`
20
- * (populated by `lowerUserFuncCall` in jitLower.ts). We emit each
21
- * reachable callee as a `static void jit_<jitName>(...)` in the same
22
- * .c file, in post-order so callees are defined before callers. The
23
- * shared `__err_flag` pointer flows from outer to every callee.
24
- */
25
- import { type JitStmt, type JitType } from "../jitTypes.js";
26
- import type { GeneratedFn } from "../jitLower.js";
27
- import { type AbiSlot, type CParamDesc, type COutputDesc } from "./abi.js";
28
- export type { AbiSlot, AbiSlotKind } from "./abi.js";
29
- export type { CParamDesc, COutputDesc } from "./abi.js";
30
- export { mangle, mangleIm, tensorData, tensorDataIm, tensorLen, tensorD0, tensorD1, formatNumberLiteral, C_SCALAR_TARGET, } from "./context.js";
31
- export interface GenerateCResult {
32
- cSource: string;
33
- cFnName: string;
34
- paramDescs: CParamDesc[];
35
- outputDescs: COutputDesc[];
36
- /** The full ABI slot list in calling order:
37
- * paramDescs[0].slots ++ paramDescs[1].slots ++ ...
38
- * ++ outputDescs[0].slots ++ ... ++ trailer slots (ticState/errFlag).
39
- * The JS wrapper walks this list to marshal values. */
40
- abiSlots: AbiSlot[];
41
- /** True when any tensor is involved (params, locals, or outputs). */
42
- usesTensors: boolean;
43
- /** koffi function signature string for declaring the C function. */
44
- koffiSignature: string;
45
- /** True when tic/toc are used — the function has an extra `double*` param. */
46
- needsTicState: boolean;
47
- /** True when any Index read was emitted — the function has an extra
48
- * `double *__err_flag` trailing param. */
49
- needsErrorFlag: boolean;
50
- /** True when a `disp(...)` call was emitted — the function has an
51
- * extra `void (*__disp_cb)(const char *, double, int)` trailing
52
- * param. The JS wrapper registers a callback that routes back to
53
- * `rt.output`. */
54
- needsDispCb: boolean;
55
- }
56
- export declare function generateC(body: JitStmt[], params: string[], outputs: string[], nargout: number, localVars: Set<string>, argTypes: JitType[], _outputType: JitType | null, outputTypes: JitType[], fnName: string, fuse?: boolean, openmp?: boolean, generatedIRBodies?: Map<string, GeneratedFn>): GenerateCResult;
@@ -1,70 +0,0 @@
1
- /**
2
- * C-JIT: unified classification pass for tensor names.
3
- *
4
- * Replaces the ten ad-hoc sets/maps (`tensorVars`, `paramTensorNames`,
5
- * `outputTensorNames`, `localTensorNames`, `assignIndexTargets`,
6
- * `unshareTensorParams`, `tensorMaxDim`, `freshAllocTensors`,
7
- * `dynamicOutputs`, `paramOutputTensors`) that the codegen used to
8
- * build from 7+ body walks. Everything downstream — signature builder,
9
- * prelude, epilogue, emit helpers, fusion call — now reads from the
10
- * `TensorMeta` table this pass produces.
11
- */
12
- import type { JitExpr, JitStmt, JitType } from "../jitTypes.js";
13
- export type TensorKind =
14
- /** Tensor param, never appears in the output list. */
15
- "param"
16
- /** Tensor param whose name is also in the output list. */
17
- | "paramOutput"
18
- /** Pure tensor output (not a param). */
19
- | "output"
20
- /** Tensor local (neither param nor output). */
21
- | "local";
22
- export interface TensorMeta {
23
- kind: TensorKind;
24
- /** Max index arity on this name (1/2/3). 0 means the name is never
25
- * used as an Index or AssignIndex base. */
26
- maxIndexDim: number;
27
- /** True when any `Assign(name, RHS)` has RHS ∈ {TensorLiteral,
28
- * VConcatGrow, Call(zeros|ones), Var(src) where src.hasFreshAlloc,
29
- * RangeSliceRead}. Propagated to fixed point. */
30
- hasFreshAlloc: boolean;
31
- /** True when any AssignIndex / AssignIndexRange / AssignIndexCol
32
- * uses this name as the base. */
33
- isAssignIndexTarget: boolean;
34
- /** Derived: `kind === "param"` and (`isAssignIndexTarget` or
35
- * `hasFreshAlloc`). Triggers the unshare-at-entry malloc+memcpy
36
- * prelude so writes don't leak to the caller's buffer. */
37
- needsUnshare: boolean;
38
- /** Derived: `hasFreshAlloc` and (`kind === "output"` or
39
- * `kind === "paramOutput"`). Triggers the `double **` dynamic-output
40
- * ABI. */
41
- isDynamicOutput: boolean;
42
- /** True when this tensor's `JitType.isComplex === true` — either at
43
- * the boundary (param / output type) or propagated from a complex
44
- * RHS for locals. Drives paired imag-buffer plumbing: every complex
45
- * tensor gets a `v_name_data_im` companion pointer, an extra ABI
46
- * slot for boundaries, and imag malloc / free / copy parallel to
47
- * the existing real path. */
48
- isComplex: boolean;
49
- }
50
- export interface ClassificationResult {
51
- /** All names with a tensor role, in insertion order (params first,
52
- * then outputs, then locals in body order). */
53
- tensorNames: string[];
54
- /** Per-name metadata. */
55
- meta: Map<string, TensorMeta>;
56
- /** True iff any name has `hasFreshAlloc`. Lets callers skip the
57
- * dynamic-output marshalling when no name uses it. */
58
- hasAnyDynamic: boolean;
59
- /** Name → is any tensor role. `meta.has(name)`. */
60
- tensorVars: Set<string>;
61
- /** Names with `kind === "param"` or `"paramOutput"`. */
62
- paramTensorNames: Set<string>;
63
- /** Names with `kind === "output"` or `"paramOutput"`. */
64
- outputTensorNames: Set<string>;
65
- /** Names with `kind === "local"`. */
66
- localTensorNames: Set<string>;
67
- }
68
- /** Does this Assign RHS allocate a fresh C-owned buffer? */
69
- export declare function isFreshTensorRhs(expr: JitExpr): boolean;
70
- export declare function analyzeTensorUsage(body: JitStmt[], params: string[], argTypes: JitType[], outputNames: string[], outputTypes: JitType[]): ClassificationResult;
@@ -1,37 +0,0 @@
1
- /**
2
- * C-JIT compilation driver (koffi path).
3
- *
4
- * Takes generated C source, compiles it into a `.so` shared library,
5
- * loads it via koffi, and returns the declared function.
6
- *
7
- * Strategy:
8
- * 1. Content-addressed cache under ~/.cache/numbl/c-jit/ — the hash
9
- * includes the source bytes plus compiler/platform/numbl versions,
10
- * so any input change forces a recompile.
11
- * 2. On cache miss, write `src.c` into a fresh tmpdir and shell out to
12
- * the C compiler (`$NUMBL_CC` or `cc`) with `-shared -fPIC`.
13
- * 3. Load with koffi.load() and declare the function.
14
- *
15
- * No Node API headers are needed — functions are plain C with raw types.
16
- * No NAPI_MODULE_INIT, no module registration, no exit hooks.
17
- */
18
- export interface CompiledCFn {
19
- fn: (...args: unknown[]) => unknown;
20
- cachedPath: string;
21
- /** The loaded koffi library handle, for declaring additional exports. */
22
- lib: any;
23
- }
24
- /**
25
- * Compile + load a C function via koffi. Returns null on any failure.
26
- *
27
- * `koffiSignature` is the koffi type-string for the C function, e.g.:
28
- * "void jit_fn(double, double *, int64_t, double *)"
29
- */
30
- export declare function compileAndLoad(cSource: string, koffiSignature: string, _cFnName: string, log?: (m: string) => void, extraFlags?: string[]): CompiledCFn | null;
31
- export declare function resetCEnvForTesting(): void;
32
- export declare function cJitUnavailableReason(): string | undefined;
33
- export declare function cJitCacheSize(): number;
34
- export declare function readCachedBuild(cachedPath: string): Buffer;
35
- /** True when the C compiler supports `-fopenmp` (thread-level parallelism).
36
- * Triggers env discovery on first call so it can be used before compileAndLoad. */
37
- export declare function cJitOpenmpAvailable(log?: (m: string) => void): boolean;