numbl 0.3.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +6 -5
- package/dist-cli/cli.js +63077 -42047
- package/dist-lib/graphics/types.d.ts +40 -1
- package/dist-lib/lib.d.ts +0 -1
- package/dist-lib/lib.js +78446 -57671
- package/dist-lib/numbl-core/executeCode.d.ts +10 -12
- package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
- package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
- package/dist-lib/numbl-core/executors/index.d.ts +0 -3
- package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +35 -0
- package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +31 -0
- package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +29 -0
- package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +45 -0
- package/dist-lib/numbl-core/executors/jit/compileC.d.ts +51 -0
- package/dist-lib/numbl-core/executors/jit/compileC.node.d.ts +25 -0
- package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +27 -0
- package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +41 -0
- package/dist-lib/numbl-core/executors/jit/session.d.ts +17 -0
- package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +36 -0
- package/dist-lib/numbl-core/executors/jit/typeAdapter.d.ts +28 -0
- package/dist-lib/numbl-core/executors/jit/typeAdapterC.d.ts +73 -0
- package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +48 -0
- package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +108 -0
- package/dist-lib/numbl-core/executors/lowering.d.ts +31 -77
- package/dist-lib/numbl-core/executors/plugins.d.ts +14 -21
- package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
- package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +0 -18
- package/dist-lib/numbl-core/interpreter/interpreter.d.ts +37 -21
- package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
- package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +13 -1
- package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +1 -1
- package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +43 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +123 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/minus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mpower.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mrdivide.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mtimes.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/plus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/power.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/rdivide.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/times.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/uminus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/_compare.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/eq.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/ge.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/gt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/le.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/lt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/ne.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/diag/assert.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/_format_args.d.ts +17 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/disp.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/error.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/fprintf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/sprintf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/warning.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/_shortcircuit.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/and.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/andand.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/boolconst.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/classBuiltin.d.ts +21 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isa.d.ts +13 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/iscell.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isempty.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isequal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isfield.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isinf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isnan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isnumeric.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isreal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isscalar.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isstruct.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/logical.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/not.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/or.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/oror.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +21 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/typequery.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/xor.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/_complex_fold.d.ts +34 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +51 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/abs.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/angle.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/asinh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/atan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/atan2.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/besselh.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/ceil.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/conj.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/constants.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/cos.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/cosh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/dot.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/double.d.ts +28 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/exp.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/fix.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/floor.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/hypot.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/imag.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/linspace.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log10.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log2.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/logspace.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/mod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/norm.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/real.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/rem.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/round.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sign.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sin.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sinh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sqrt.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/tan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/tanh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/uniquetol.d.ts +22 -0
- package/dist-lib/numbl-core/jit/builtins/defs/plot/dispatch.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_cumulative.d.ts +49 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +126 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_variance.d.ts +17 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/all.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/any.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummax.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummin.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumprod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumsum.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/diff.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/length.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/max.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/mean.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/min.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/numel.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/prod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/std.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/sum.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/var.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +67 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +34 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/cat.d.ts +33 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/diag.d.ts +29 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/eye.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/flip.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/meshgrid.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/ones.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/repmat.d.ts +37 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/reshape.d.ts +39 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/size.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/sort.d.ts +19 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/transpose.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/tril.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/triu.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/zeros.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +36 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/pathBuiltins.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/tic.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/toc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/index.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/registry.d.ts +138 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/cell/cell.d.ts +24 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/loop_count.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/range_value.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/scalar_index.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/tensor_make_range.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/assert_fmt.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_double.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_struct.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/error_fmt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_double.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_engine.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/fprintf.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/sprintf.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/warning_fmt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/plot/plot_dispatch.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +86 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +103 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/deep_clone.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/isequal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/tictoc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_copy_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cat.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cumulative.d.ts +32 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diag.d.ts +33 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diff.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_dot.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_complex.d.ts +90 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real.d.ts +75 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +95 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_eye.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_nd.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_flip.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_linspace.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logical_real.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logspace.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_meshgrid.d.ts +29 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_complex.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_real.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_norm.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_predicate.d.ts +42 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_complex.d.ts +53 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +42 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_repmat.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_size.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_sort_real.d.ts +36 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_triangular.d.ts +22 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_complex_math.d.ts +128 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +95 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_uniquetol.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_var.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/text/strcmp.d.ts +2 -0
- package/dist-lib/numbl-core/jit/codegen/cFormat.d.ts +36 -0
- package/dist-lib/numbl-core/jit/codegen/cHelpers.d.ts +48 -0
- package/dist-lib/numbl-core/jit/codegen/emit.d.ts +55 -0
- package/dist-lib/numbl-core/jit/codegen/emitCellTypedef.d.ts +23 -0
- package/dist-lib/numbl-core/jit/codegen/emitExpr.d.ts +33 -0
- package/dist-lib/numbl-core/jit/codegen/emitIndex.d.ts +56 -0
- package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +64 -0
- package/dist-lib/numbl-core/jit/codegen/emitNamedTypedef.d.ts +58 -0
- package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +76 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorConcat.d.ts +23 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorConcatJs.d.ts +16 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +77 -0
- package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +66 -0
- package/dist-lib/numbl-core/jit/codegen/liveness.d.ts +58 -0
- package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +24 -0
- package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +150 -0
- package/dist-lib/numbl-core/jit/compileSpec.d.ts +84 -0
- package/dist-lib/numbl-core/jit/compileSpecC.d.ts +93 -0
- package/dist-lib/numbl-core/jit/index.d.ts +15 -0
- package/dist-lib/numbl-core/jit/lowering/classDefs.d.ts +109 -0
- package/dist-lib/numbl-core/jit/lowering/errors.d.ts +35 -0
- package/dist-lib/numbl-core/jit/lowering/indexFold.d.ts +31 -0
- package/dist-lib/numbl-core/jit/lowering/indexResolve.d.ts +100 -0
- package/dist-lib/numbl-core/jit/lowering/ir.d.ts +584 -0
- package/dist-lib/numbl-core/jit/lowering/lower.d.ts +271 -0
- package/dist-lib/numbl-core/jit/lowering/lowerCellIndex.d.ts +41 -0
- package/dist-lib/numbl-core/jit/lowering/lowerCellLit.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/lowerClassConstructor.d.ts +55 -0
- package/dist-lib/numbl-core/jit/lowering/lowerFuncCall.d.ts +34 -0
- package/dist-lib/numbl-core/jit/lowering/lowerHandle.d.ts +57 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexLoad.d.ts +16 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexSlice.d.ts +29 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexSliceStore.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexStore.d.ts +14 -0
- package/dist-lib/numbl-core/jit/lowering/lowerMethodCall.d.ts +45 -0
- package/dist-lib/numbl-core/jit/lowering/lowerMultiAssign.d.ts +36 -0
- package/dist-lib/numbl-core/jit/lowering/lowerTensorLit.d.ts +25 -0
- package/dist-lib/numbl-core/jit/lowering/rangeCount.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/specialize.d.ts +93 -0
- package/dist-lib/numbl-core/jit/lowering/types.d.ts +503 -0
- package/dist-lib/numbl-core/jit/lowering/walk.d.ts +17 -0
- package/dist-lib/numbl-core/jit/numbl/index.d.ts +30 -0
- package/dist-lib/numbl-core/jit/parser/astUtils.d.ts +43 -0
- package/dist-lib/numbl-core/jit/parser/index.d.ts +12 -0
- package/dist-lib/numbl-core/jit/parser/sourceLoc.d.ts +12 -0
- package/dist-lib/numbl-core/jit/runtime/context.d.ts +23 -0
- package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +10 -0
- package/dist-lib/numbl-core/jit/runtime/value.d.ts +101 -0
- package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +59 -0
- package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +62 -0
- package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +243 -0
- package/dist-lib/numbl-core/jitTypes.d.ts +7 -321
- package/dist-lib/numbl-core/jsUserFunctions.d.ts +2 -2
- package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
- package/dist-lib/numbl-core/runtime/index.d.ts +1 -1
- package/dist-lib/numbl-core/runtime/indexing.d.ts +11 -1
- package/dist-lib/numbl-core/runtime/plotUtils.d.ts +28 -2
- package/dist-lib/numbl-core/runtime/runtime.d.ts +16 -1
- package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +5 -0
- package/dist-lib/numbl-core/runtime/types.d.ts +19 -3
- package/dist-lib/numbl-core/version.d.ts +1 -1
- package/dist-lib/numbl-core/workspace/types.d.ts +8 -0
- package/dist-plot-viewer/assets/index-DfxsWeyf.js +4426 -0
- package/dist-plot-viewer/index.html +1 -1
- package/dist-site-viewer/404.html +33 -0
- package/dist-site-viewer/assets/index-C5c2lKAx.js +4748 -0
- package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
- package/dist-site-viewer/assets/numbl-worker-CkoM4MUa.js +11836 -0
- package/dist-site-viewer/coi-serviceworker.js +70 -0
- package/dist-site-viewer/favicon.svg +23 -0
- package/dist-site-viewer/index.html +16 -0
- package/dist-site-viewer/logo.svg +26 -0
- package/dist-site-viewer/numbl-embed.js +111 -0
- package/dist-site-viewer/vite.svg +1 -0
- package/native/ops/real_unary_elemwise.c +3 -1
- package/package.json +15 -9
- package/dist-lib/numbl-core/executors/cJit/builtins.d.ts +0 -30
- package/dist-lib/numbl-core/executors/cJit/chainCodegen.d.ts +0 -59
- package/dist-lib/numbl-core/executors/cJit/chainExecutor.d.ts +0 -27
- package/dist-lib/numbl-core/executors/cJit/chainPass.d.ts +0 -42
- package/dist-lib/numbl-core/executors/cJit/codegen.d.ts +0 -44
- package/dist-lib/numbl-core/executors/cJit/compile.d.ts +0 -45
- package/dist-lib/numbl-core/executors/cJit/elemwiseCodegen.d.ts +0 -23
- package/dist-lib/numbl-core/executors/cJit/elemwiseStructural.d.ts +0 -33
- package/dist-lib/numbl-core/executors/cJit/fuseAnalyze.d.ts +0 -39
- package/dist-lib/numbl-core/executors/cJit/fuseCodegen.d.ts +0 -16
- package/dist-lib/numbl-core/executors/cJit/fuseExecutor.d.ts +0 -28
- package/dist-lib/numbl-core/executors/cJit/loopExecutor.d.ts +0 -32
- package/dist-lib/numbl-core/executors/cJit/register.d.ts +0 -10
- package/dist-lib/numbl-core/executors/cJit/whitelist.d.ts +0 -15
- package/dist-lib/numbl-core/executors/jsJit/callExecutor.d.ts +0 -25
- package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegen.d.ts +0 -7
- package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegenHoist.d.ts +0 -70
- package/dist-lib/numbl-core/executors/jsJit/codegen/jsMultiReduction.d.ts +0 -67
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpers.d.ts +0 -34
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersComplex.d.ts +0 -21
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersIndex.d.ts +0 -33
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersTensor.d.ts +0 -34
- package/dist-lib/numbl-core/executors/jsJit/jitCall.d.ts +0 -59
- package/dist-lib/numbl-core/executors/jsJit/jitLoop.d.ts +0 -53
- package/dist-lib/numbl-core/executors/jsJit/jitTopLevel.d.ts +0 -44
- package/dist-lib/numbl-core/executors/jsJit/loopExecutor.d.ts +0 -15
- package/dist-lib/numbl-core/executors/jsJit/lower/blockAnalysis.d.ts +0 -37
- package/dist-lib/numbl-core/executors/jsJit/lower/jitBailSafety.d.ts +0 -41
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLower.d.ts +0 -136
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerExpr.d.ts +0 -36
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerStmt.d.ts +0 -9
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerTypes.d.ts +0 -29
- package/dist-lib/numbl-core/executors/jsJit/lower/scalarEmit.d.ts +0 -58
- package/dist-lib/numbl-core/executors/jsJit/shared.d.ts +0 -120
- package/dist-lib/numbl-core/executors/jsJit/topLevelExecutor.d.ts +0 -17
- package/dist-plot-viewer/assets/index-COAM8o1E.js +0 -4426
- /package/dist-lib/numbl-core/{executors/jsJit/helpers → runtime}/alloc.d.ts +0 -0
|
@@ -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-C5c2lKAx.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(/</g, "<").replace(/>/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>
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
#include <math.h>
|
|
9
9
|
|
|
10
10
|
static inline double rsign(double x) {
|
|
11
|
-
|
|
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
|
+
"version": "0.4.1",
|
|
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:
|
|
44
|
-
"dev:
|
|
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:
|
|
48
|
-
"build:
|
|
49
|
-
"build:
|
|
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 .",
|
|
@@ -58,12 +63,13 @@
|
|
|
58
63
|
"test:coverage": "vitest run --coverage",
|
|
59
64
|
"test:coverage:all": "bash scripts/coverage-all.sh",
|
|
60
65
|
"test:scripts": "bash numbl_test_scripts/run_all.sh",
|
|
66
|
+
"jit-parity": "node jit_parity/run.mjs",
|
|
61
67
|
"test:browser": "playwright test",
|
|
62
68
|
"build:wasm": "bash numbl_test_scripts/build_wasm.sh",
|
|
63
69
|
"update-readme": "tsx scripts/update-readme-usage.ts",
|
|
64
70
|
"check-readme": "tsx scripts/update-readme-usage.ts --check",
|
|
65
71
|
"bump": "tsx scripts/bump-version.ts",
|
|
66
|
-
"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",
|
|
67
73
|
"prepare": "husky"
|
|
68
74
|
},
|
|
69
75
|
"dependencies": {
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* C-JIT builtin registry — the single source of truth for which
|
|
3
|
-
* builtins each C-JIT context can emit.
|
|
4
|
-
*
|
|
5
|
-
* Two contexts:
|
|
6
|
-
*
|
|
7
|
-
* - **Elementwise** (`c-jit-fuse`, `c-jit-chain`): unary real-math
|
|
8
|
-
* builtins that compile to a single C function call inside an
|
|
9
|
-
* element-wise loop. Real-only — no complex args.
|
|
10
|
-
*
|
|
11
|
-
* - **Scalar loop** (`c-jit-loop`): a superset that adds `atan2`
|
|
12
|
-
* (binary) and the complex projection builtins (`real`, `imag`,
|
|
13
|
-
* `conj`, which accept either real or complex args).
|
|
14
|
-
*
|
|
15
|
-
* Adding a new builtin: extend the relevant set here, make sure the
|
|
16
|
-
* C name is right (override `cBuiltinName` if it differs), and add a
|
|
17
|
-
* test or benchmark that exercises it. See
|
|
18
|
-
* `docs/developer_reference/jit/cjit-substrate.md` for the broader
|
|
19
|
-
* substrate contract.
|
|
20
|
-
*/
|
|
21
|
-
/** Real-only unary math builtins emittable in an element-wise loop. */
|
|
22
|
-
export declare const ELEMWISE_REAL_BUILTINS: ReadonlySet<string>;
|
|
23
|
-
/** Real-only math builtins emittable in a scalar loop body.
|
|
24
|
-
* Superset of the elementwise set; adds `atan2` (binary). */
|
|
25
|
-
export declare const LOOP_REAL_MATH_BUILTINS: ReadonlySet<string>;
|
|
26
|
-
/** Projection builtins that accept real OR complex args. */
|
|
27
|
-
export declare const LOOP_COMPLEX_PROJECTION_BUILTINS: ReadonlySet<string>;
|
|
28
|
-
/** Map a numbl/MATLAB builtin name to its math.h C name. Identity for
|
|
29
|
-
* most; `abs` maps to `fabs` because C's `abs` is integer-typed. */
|
|
30
|
-
export declare function cBuiltinName(name: string): string;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* c-jit-chain codegen — combine N adjacent fusable Assigns into one
|
|
3
|
-
* C kernel with a single i-loop.
|
|
4
|
-
*
|
|
5
|
-
* Each per-name role is decided by walking the chain in source order:
|
|
6
|
-
* - input-tensor : first occurrence is RHS, env says it's a tensor
|
|
7
|
-
* - input-scalar : first occurrence is RHS, env says it's a scalar
|
|
8
|
-
* - local-tensor : first occurrence is LHS (writes the value
|
|
9
|
-
* without reading any prior value); becomes a
|
|
10
|
-
* per-iter `double` local
|
|
11
|
-
* - input+local : first occurrence is RHS but the chain also
|
|
12
|
-
* writes it — read from input pointer, then
|
|
13
|
-
* writes update the local
|
|
14
|
-
*
|
|
15
|
-
* Live-outs (any LHS of any Assign in the chain) get their own `double *`
|
|
16
|
-
* out parameter and a writeback at the end of the loop body.
|
|
17
|
-
*
|
|
18
|
-
* Today: every RHS expression must be element-wise on tensors of the
|
|
19
|
-
* chain's numel (scalars broadcast). The executor's propose() rejects
|
|
20
|
-
* chains where this can't be guaranteed.
|
|
21
|
-
*
|
|
22
|
-
* ABI:
|
|
23
|
-
* void <fnName>(
|
|
24
|
-
* long n,
|
|
25
|
-
* double *out_<name1>, double *out_<name2>, ..., // live-outs
|
|
26
|
-
* const double *in_<nameA>, const double *in_<nameB>, ...,
|
|
27
|
-
* double <nameC>, double <nameD>, ...);
|
|
28
|
-
*/
|
|
29
|
-
import type { ChainAnalysis } from "./chainPass.js";
|
|
30
|
-
/** Per-name role (decided at compile time using env types). */
|
|
31
|
-
export type NameRole = {
|
|
32
|
-
kind: "input-tensor";
|
|
33
|
-
} | {
|
|
34
|
-
kind: "input-scalar";
|
|
35
|
-
} | {
|
|
36
|
-
kind: "local-tensor";
|
|
37
|
-
readsFromInput: boolean;
|
|
38
|
-
};
|
|
39
|
-
/** Resolved per-name info carried from compile() into codegen. */
|
|
40
|
-
export interface ChainResolution {
|
|
41
|
-
/** Role for every name referenced in the chain. */
|
|
42
|
-
readonly roles: ReadonlyMap<string, NameRole>;
|
|
43
|
-
/** Names whose final value is live-out (written somewhere in the
|
|
44
|
-
* chain). For Phase A: every Assign LHS is conservatively
|
|
45
|
-
* live-out. */
|
|
46
|
-
readonly liveOuts: readonly string[];
|
|
47
|
-
/** Tensor input names in stable order (for koffi declaration). */
|
|
48
|
-
readonly tensorInputs: readonly string[];
|
|
49
|
-
/** Scalar input names in stable order. */
|
|
50
|
-
readonly scalarInputs: readonly string[];
|
|
51
|
-
}
|
|
52
|
-
/** Decide each name's role from the AST + a "is this var a tensor?"
|
|
53
|
-
* classifier. Returns null if any per-stmt structure is incompatible
|
|
54
|
-
* with the codegen — caller should bail. */
|
|
55
|
-
export declare function resolveChain(cls: ChainAnalysis, isTensor: (name: string) => boolean | null): ChainResolution | null;
|
|
56
|
-
/** Build the koffi function declaration string. */
|
|
57
|
-
export declare function buildChainDeclaration(fnName: string, res: ChainResolution): string;
|
|
58
|
-
/** Emit the C source. */
|
|
59
|
-
export declare function generateChainCSource(fnName: string, cls: ChainAnalysis, res: ChainResolution): string;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* c-jit-chain — element-wise chain executor.
|
|
3
|
-
*
|
|
4
|
-
* - `propose()` filters on Synth stmts with `tag === "c-jit-chain"`.
|
|
5
|
-
* Reads each tensor input's `numel` from env and verifies they
|
|
6
|
-
* all match. Declines below `CHAIN_MIN_NUMEL`.
|
|
7
|
-
*
|
|
8
|
-
* - `compile()` resolves per-name roles using runtime env types,
|
|
9
|
-
* emits the combined C kernel, builds the koffi declaration,
|
|
10
|
-
* calls compileAndLoad. Surfaces source via `interp.onCJitCompile`.
|
|
11
|
-
*
|
|
12
|
-
* - `run()` gathers tensor data + scalars, allocates one
|
|
13
|
-
* `Float64Array(numel)` per live-out, invokes the kernel, writes
|
|
14
|
-
* each live-out back to env as a `RuntimeTensor` with the input
|
|
15
|
-
* tensors' shape.
|
|
16
|
-
*/
|
|
17
|
-
import type { Executor } from "../types.js";
|
|
18
|
-
import type { SynthLoweredStmt } from "../lowering.js";
|
|
19
|
-
import { type ChainResolution } from "./chainCodegen.js";
|
|
20
|
-
import { type CompiledC } from "./compile.js";
|
|
21
|
-
interface ChainCompiled {
|
|
22
|
-
readonly compiled: CompiledC;
|
|
23
|
-
readonly resolution: ChainResolution;
|
|
24
|
-
readonly source: string;
|
|
25
|
-
}
|
|
26
|
-
export declare const cJitChainExecutor: Executor<SynthLoweredStmt, ChainCompiled | null>;
|
|
27
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* c-jit-chain AST transformer.
|
|
3
|
-
*
|
|
4
|
-
* Walks a stmt list once and identifies maximal contiguous runs of
|
|
5
|
-
* adjacent stmts that are individually candidates for fusion (today:
|
|
6
|
-
* tensor element-wise Assigns whose RHS is a fusable expression
|
|
7
|
-
* tree). Wraps each non-trivial run (length >= 2) in a `Synth` node
|
|
8
|
-
* with `tag: "c-jit-chain"`; the matching `cJitChainExecutor` will
|
|
9
|
-
* compile the whole chain to one C kernel at dispatch time.
|
|
10
|
-
*
|
|
11
|
-
* Singletons (chains of length 1) are left as the original Assign so
|
|
12
|
-
* the existing `c-jit-fuse` per-stmt path handles them. That keeps
|
|
13
|
-
* the win path narrow: chains exist only where multiple adjacent
|
|
14
|
-
* fusable Assigns can amortize per-call overhead and share memory
|
|
15
|
-
* traversal.
|
|
16
|
-
*
|
|
17
|
-
* Purely structural — no env access. Runtime decisions (size,
|
|
18
|
-
* type-shape match) happen in the executor's `propose()`.
|
|
19
|
-
*
|
|
20
|
-
* Recursive descent: For/While/If bodies are transformed lazily via
|
|
21
|
-
* `Registry.transformStmts` when the interpreter walks them. This
|
|
22
|
-
* pass just operates on the immediate stmt list.
|
|
23
|
-
*/
|
|
24
|
-
import { type Stmt } from "../../parser/types.js";
|
|
25
|
-
/** Per-stmt classification used by the chain executor. The data
|
|
26
|
-
* carried on each Synth node is `ChainAnalysis`. */
|
|
27
|
-
export interface ChainAnalysis {
|
|
28
|
-
/** Original Assigns in source order. */
|
|
29
|
-
readonly assigns: readonly (Stmt & {
|
|
30
|
-
type: "Assign";
|
|
31
|
-
})[];
|
|
32
|
-
/** Stable shape hash — combines per-stmt RHS structures and LHS
|
|
33
|
-
* names, used by the executor's cacheKey. Sizes / runtime types
|
|
34
|
-
* are NOT included; those affect cost, not codegen shape. */
|
|
35
|
-
readonly cacheKey: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Transform a stmt list, wrapping maximal fusable runs (length >= 2)
|
|
39
|
-
* in `Synth` nodes. Returns a new list when any transformation
|
|
40
|
-
* happens; returns the input unchanged otherwise.
|
|
41
|
-
*/
|
|
42
|
-
export declare function chainPass(stmts: readonly Stmt[]): Stmt[];
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* c-jit-loop codegen — JIT IR → C source.
|
|
3
|
-
*
|
|
4
|
-
* Emits one C function per loop. Each scalar variable is encoded
|
|
5
|
-
* either as a single `double` (real) or a pair `<name>_re`, `<name>_im`
|
|
6
|
-
* (complex). Inputs are passed by value (real → 1 arg, complex →
|
|
7
|
-
* 2 args); outputs are written through a `double *out` pointer
|
|
8
|
-
* (real → 1 slot, complex → 2 slots).
|
|
9
|
-
*
|
|
10
|
-
* Codegen is deliberately narrow — see `whitelist.ts` for the set of
|
|
11
|
-
* IR nodes accepted. Anything outside that set is a programming error
|
|
12
|
-
* here (the executor's `propose()` must reject before reaching this
|
|
13
|
-
* module).
|
|
14
|
-
*/
|
|
15
|
-
import type { JitStmt, JitType } from "../../jitTypes.js";
|
|
16
|
-
/** Per-variable C encoding. */
|
|
17
|
-
export type VarEncoding = "real" | "complex";
|
|
18
|
-
/** Resolved (input + local) variable types. Codegen keys lookups on
|
|
19
|
-
* the variable name; both Vars and Assigns consult this map. */
|
|
20
|
-
export type VarTypeMap = ReadonlyMap<string, VarEncoding>;
|
|
21
|
-
/** Emitted scalar value. Real values are a single C expression;
|
|
22
|
-
* complex values are a (re, im) pair. */
|
|
23
|
-
export type Emitted = {
|
|
24
|
-
kind: "real";
|
|
25
|
-
expr: string;
|
|
26
|
-
} | {
|
|
27
|
-
kind: "complex";
|
|
28
|
-
re: string;
|
|
29
|
-
im: string;
|
|
30
|
-
};
|
|
31
|
-
/** Walk the IR + input typings and produce a per-name encoding map.
|
|
32
|
-
* A name is "complex" iff at least one read or write of it has a
|
|
33
|
-
* complex_or_number type. Otherwise "real".
|
|
34
|
-
*
|
|
35
|
-
* This mirrors the JIT's type widening: by the time the IR is
|
|
36
|
-
* produced, every Var / Assign for the same name has been unified
|
|
37
|
-
* to a single type. The walker just records that type. */
|
|
38
|
-
export declare function inferVarEncodings(inputs: readonly string[], inputTypes: readonly JitType[], body: readonly JitStmt[]): Map<string, VarEncoding>;
|
|
39
|
-
/** Per-variable slot count in the marshaling ABI: real → 1, complex → 2. */
|
|
40
|
-
export declare function varSlotCount(enc: VarEncoding): number;
|
|
41
|
-
/** Total number of `double` slots a variable list consumes. */
|
|
42
|
-
export declare function totalSlotCount(names: readonly string[], varTypes: VarTypeMap): number;
|
|
43
|
-
/** Emit a complete C source file. */
|
|
44
|
-
export declare function generateCSource(fnName: string, inputs: readonly string[], outputs: readonly string[], body: readonly JitStmt[], varTypes: VarTypeMap): string;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* c-jit compile + cache + load.
|
|
3
|
-
*
|
|
4
|
-
* Cache layout: `~/.cache/numbl/c-jit/<sha>.so` (one per unique
|
|
5
|
-
* (declaration, source) pair). On hit, dlopen and reuse — no `cc`
|
|
6
|
-
* invocation. On miss, write `<sha>.c`, exec `cc`, dlopen.
|
|
7
|
-
*
|
|
8
|
-
* The koffi function declaration is fully owned by the caller —
|
|
9
|
-
* different executors (c-jit-loop, c-jit-fuse, ...) emit the
|
|
10
|
-
* declaration that matches their ABI. This module only handles
|
|
11
|
-
* source-string-in / koffi-callable-out.
|
|
12
|
-
*/
|
|
13
|
-
import type { NativeBridge } from "../../workspace/types.js";
|
|
14
|
-
/**
|
|
15
|
-
* The koffi function reference returned by `lib.func(decl)`. The
|
|
16
|
-
* actual call signature is controlled by the caller's declaration —
|
|
17
|
-
* type as variadic and let the caller cast as needed.
|
|
18
|
-
*/
|
|
19
|
-
export type CFn = (...args: unknown[]) => unknown;
|
|
20
|
-
export interface CompiledC {
|
|
21
|
-
readonly fn: CFn;
|
|
22
|
-
/** Path to the .so on disk — useful for diagnostics. */
|
|
23
|
-
readonly libPath: string;
|
|
24
|
-
/** Cache hit (true) vs. fresh cc invocation (false). */
|
|
25
|
-
readonly cacheHit: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface CompileOptions {
|
|
28
|
-
/** Enable `-ffast-math`. On by default for ~30% speedup on
|
|
29
|
-
* element-wise tensor benchmarks (libmvec vectorization of
|
|
30
|
-
* transcendentals). Opt out via the CLI's `--no-fast-math` flag
|
|
31
|
-
* to keep FP semantics bitwise-deterministic. */
|
|
32
|
-
readonly fastMath?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Compile (or look up cached) and load. The cache key is the SHA of
|
|
36
|
-
* `(declaration, source)` so the same source compiled with different
|
|
37
|
-
* koffi declarations gets distinct cache entries (defensive — usually
|
|
38
|
-
* the declaration matches the source's signature).
|
|
39
|
-
*/
|
|
40
|
-
export declare function compileAndLoad(source: string, declaration: string, bridge: NativeBridge, options?: CompileOptions): CompiledC;
|
|
41
|
-
/**
|
|
42
|
-
* Read a previously-compiled C source from disk. Diagnostic helper
|
|
43
|
-
* for verifying cache hits.
|
|
44
|
-
*/
|
|
45
|
-
export declare function readCachedSource(hash: string): string | null;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared codegen helpers for the element-wise C-JIT executors
|
|
3
|
-
* (`c-jit-fuse`, `c-jit-chain`).
|
|
4
|
-
*
|
|
5
|
-
* Both executors lower the same AST subset (the one accepted by
|
|
6
|
-
* `elemwiseStructural.isElemwiseStructuralExpr`) to C; they only
|
|
7
|
-
* differ in how an `Ident` leaf maps to a C expression (tensor pointer
|
|
8
|
-
* indexing vs. local-name vs. scalar parameter). This module owns the
|
|
9
|
-
* shared structural emitter and a few utility helpers; the per-executor
|
|
10
|
-
* codegen is reduced to a thin wrapper that supplies the leaf mapping.
|
|
11
|
-
*/
|
|
12
|
-
import { type Expr } from "../../parser/types.js";
|
|
13
|
-
/** Emit a C `double` literal that's unambiguous to the compiler.
|
|
14
|
-
* Handles NaN, ±Inf, integer-valued doubles. */
|
|
15
|
-
export declare function formatDouble(v: number): string;
|
|
16
|
-
/** Walk `e` and add every `Ident` name to `out`. Whitelisted to the
|
|
17
|
-
* element-wise AST subset — anything outside (e.g. `Index`) is a
|
|
18
|
-
* programming error (the structural classifier should have rejected). */
|
|
19
|
-
export declare function collectIdents(e: Expr, out: Set<string>): void;
|
|
20
|
-
/** Lower an element-wise AST expression to a C string. The caller
|
|
21
|
-
* supplies `identToC` to map each `Ident` name to its in-loop C form
|
|
22
|
-
* (e.g. `t0[i]`, `in_x[i]`, `s2`, or a bare local name). */
|
|
23
|
-
export declare function emitElemwiseExpr(e: Expr, identToC: (name: string) => string): string;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared structural classifier for element-wise C-JIT.
|
|
3
|
-
*
|
|
4
|
-
* The "is this AST expression element-wise lowerable?" check, in two
|
|
5
|
-
* pieces:
|
|
6
|
-
*
|
|
7
|
-
* - `isElemwiseStructuralExpr(e)` — fully structural, no env access.
|
|
8
|
-
* Used by `chainPass` (runs at stmt-list-entry time, before env
|
|
9
|
-
* types are known).
|
|
10
|
-
*
|
|
11
|
-
* - `isElemwiseBinaryOp(op)` / `binaryOpNeedsScalarCheck(op)` — the
|
|
12
|
-
* binary-op subset, exposed so env-aware walkers (`fuseAnalyze`)
|
|
13
|
-
* can apply runtime-scalar checks on top of the structural shape.
|
|
14
|
-
*
|
|
15
|
-
* Pairs with `builtins.ts` (which owns the unary builtin set). Anything
|
|
16
|
-
* not accepted here is rejected at propose-time.
|
|
17
|
-
*/
|
|
18
|
-
import { BinaryOperation, type Expr, UnaryOperation } from "../../parser/types.js";
|
|
19
|
-
/** Binary ops the element-wise codegen can emit. `Mul`/`Div` are matrix
|
|
20
|
-
* ops in MATLAB but degenerate to element-wise when at least one
|
|
21
|
-
* operand is a scalar — env-aware callers should additionally apply
|
|
22
|
-
* `binaryOpNeedsScalarCheck`. */
|
|
23
|
-
export declare function isElemwiseBinaryOp(op: BinaryOperation): boolean;
|
|
24
|
-
/** True iff `op` requires a runtime scalar-operand check before being
|
|
25
|
-
* emitted element-wise (i.e. plain `*` and `/`). */
|
|
26
|
-
export declare function binaryOpNeedsScalarCheck(op: BinaryOperation): boolean;
|
|
27
|
-
/** Unary ops the element-wise codegen can emit. */
|
|
28
|
-
export declare function isElemwiseUnaryOp(op: UnaryOperation): boolean;
|
|
29
|
-
/** Structural check: is `e` element-wise lowerable as a tree shape?
|
|
30
|
-
* Does NOT consult env. Leaves (`Ident`, `Number`) are accepted
|
|
31
|
-
* unconditionally; runtime classification of identifiers (tensor vs.
|
|
32
|
-
* scalar) is the caller's responsibility. */
|
|
33
|
-
export declare function isElemwiseStructuralExpr(e: Expr): boolean;
|