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
|
@@ -12,7 +12,7 @@ export interface InterpreterContext {
|
|
|
12
12
|
evalInLocalScope: (codeArg: unknown, fileName?: string) => unknown;
|
|
13
13
|
callFunction: (name: string, args: unknown[], nargout: number) => unknown;
|
|
14
14
|
rt: Runtime;
|
|
15
|
-
/** Optimization mode: "0" = no JIT, "1" = JS-JIT, "
|
|
15
|
+
/** Optimization mode: "0" = no JIT, "1" = JS-JIT, "2" = C-JIT. */
|
|
16
16
|
optimization: import("../executors/plugins.js").OptLevel;
|
|
17
17
|
/** Resolve a workspace function or class name to its source file,
|
|
18
18
|
* or undefined if no workspace file provides that name.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers shared across multiple builtin files.
|
|
3
|
+
*/
|
|
4
|
+
import type { Span } from "../../parser/index.js";
|
|
5
|
+
import { type Type, type NumericType } from "../../lowering/types.js";
|
|
6
|
+
export declare function requireScalarRealDouble(t: Type, what: string, span?: Span): void;
|
|
7
|
+
/** Like `requireScalarRealDouble` but accepts non-scalar real doubles
|
|
8
|
+
* (the elemwise path). Logical also accepted (stored as double in C). */
|
|
9
|
+
export declare function requireRealDouble(t: Type, what: string, span?: Span): void;
|
|
10
|
+
/** Accepts a real or complex numeric (double / logical). Used by the
|
|
11
|
+
* unary math builtins and the scalar/tensor arithmetic paths that
|
|
12
|
+
* contaminate to complex when either operand is complex. */
|
|
13
|
+
export declare function requireRealOrComplex(t: Type, what: string, span?: Span): void;
|
|
14
|
+
/** Require a scalar numeric (real or complex). */
|
|
15
|
+
export declare function requireScalarRealOrComplex(t: Type, what: string, span?: Span): void;
|
|
16
|
+
export declare function exactDouble(t: Type): number | undefined;
|
|
17
|
+
export declare function exactRealArray(t: Type): Float64Array | undefined;
|
|
18
|
+
/** Read a scalar-complex exact value if present. Returns `{re, im}`
|
|
19
|
+
* when the type's `exact` is the scalar-complex carrier, or `undefined`
|
|
20
|
+
* otherwise. */
|
|
21
|
+
export declare function exactComplex(t: Type): {
|
|
22
|
+
re: number;
|
|
23
|
+
im: number;
|
|
24
|
+
} | undefined;
|
|
25
|
+
/** Read a complex-tensor split-buffer exact carrier if present.
|
|
26
|
+
* Returns the `{re, im}` Float64Array pair when the type's `exact` is
|
|
27
|
+
* the complex-tensor carrier (parallel to `exactRealArray` but for
|
|
28
|
+
* complex tensors); returns `undefined` for any other shape (no exact,
|
|
29
|
+
* scalar number, real-array, scalar-complex `{re: number}`). */
|
|
30
|
+
export declare function exactComplexArray(t: Type): {
|
|
31
|
+
re: Float64Array;
|
|
32
|
+
im: Float64Array;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/** Convenience: project a scalar exact value (real or complex) into a
|
|
35
|
+
* `{re, im}` pair, returning `undefined` if neither carrier matches. */
|
|
36
|
+
export declare function exactScalarAsComplex(t: Type): {
|
|
37
|
+
re: number;
|
|
38
|
+
im: number;
|
|
39
|
+
} | undefined;
|
|
40
|
+
/** True when this numeric is statically known to be complex (the static
|
|
41
|
+
* flag, not the runtime value). Centralizes the predicate so callers
|
|
42
|
+
* don't sprinkle `(t as NumericType).isComplex` checks. */
|
|
43
|
+
export declare function isStaticComplex(t: Type): t is NumericType;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared infrastructure for elementwise real binary builtins
|
|
3
|
+
* (`plus`, `minus`, `times`, `rdivide`).
|
|
4
|
+
*/
|
|
5
|
+
import { type DimInfo, type NumericType, type Sign } from "../../../lowering/types.js";
|
|
6
|
+
import type { Builtin } from "../../registry.js";
|
|
7
|
+
/** Result of broadcast shape resolution for the elementwise binary path.
|
|
8
|
+
* `outDims` is the output's per-axis dim info (MATLAB-style implicit
|
|
9
|
+
* expansion: align on axis 1, pad with 1s on the right, axis-wise
|
|
10
|
+
* `da == db || da == 1 || db == 1`). `bcast` is true when the C runtime
|
|
11
|
+
* needs the broadcasting helper rather than the fast `_tt` path —
|
|
12
|
+
* either the ndims differ or at least one statically-singleton axis
|
|
13
|
+
* needs to be replicated against a non-singleton sibling. */
|
|
14
|
+
type ResolvedShape = {
|
|
15
|
+
outDims: DimInfo[];
|
|
16
|
+
/** True when broadcast (any axis where one side is statically 1 but
|
|
17
|
+
* the other is not, OR ndims differ). False when the two arg shapes
|
|
18
|
+
* match dim-for-dim (modulo unknowns the runtime trusts). */
|
|
19
|
+
bcast: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** Shape resolution for elementwise binary. Returns `null` for scalar+
|
|
22
|
+
* scalar; otherwise computes the broadcast output shape and whether
|
|
23
|
+
* broadcasting is required. Throws on statically incompatible axes
|
|
24
|
+
* (no span — the framework's `withSpan` wrapper attaches the call-site
|
|
25
|
+
* span). Exported for `power.ts`, which shares the same broadcast rules. */
|
|
26
|
+
export declare function elemwiseResultShape(a: NumericType, b: NumericType, name: string): ResolvedShape | null;
|
|
27
|
+
/** True iff an elementwise binary op on tensor operands `a` and `b`
|
|
28
|
+
* needs the broadcasting `_bcast_tt` helper rather than the same-shape
|
|
29
|
+
* `_tt` fast path. Mirrors the per-axis compatibility logic inside
|
|
30
|
+
* `elemwiseResultShape` but returns just the bool — codegen call
|
|
31
|
+
* sites don't need to thread the resolved output shape from transfer.
|
|
32
|
+
* Exported for `power.ts`, which shares the same codegen discipline. */
|
|
33
|
+
export declare function needsBroadcast(a: NumericType, b: NumericType): boolean;
|
|
34
|
+
/** Compute the broadcast-aware elementwise fold over `a` and `b` for
|
|
35
|
+
* the given (fully-exact) output shape, applying `step` per slot.
|
|
36
|
+
* Both sides must already carry exact data (a `Float64Array` or a
|
|
37
|
+
* scalar `number`); the caller is responsible for the
|
|
38
|
+
* `EXACT_ARRAY_MAX_ELEMENTS` cap. Singleton axes on either side get
|
|
39
|
+
* stride 0 so they broadcast against non-singleton output axes;
|
|
40
|
+
* output is filled in column-major order to match the runtime layout.
|
|
41
|
+
* Exported for `power.ts`, which shares the same broadcast rules. */
|
|
42
|
+
export declare function broadcastFoldExact(a: NumericType, b: NumericType, outShape: number[], step: (av: number, bv: number) => number): Float64Array;
|
|
43
|
+
/** Build a real elementwise binary builtin: scalar, scalar+tensor,
|
|
44
|
+
* tensor+scalar, tensor+tensor. Folds when every input is exact.
|
|
45
|
+
* `helperBase` names the matching set of C runtime helpers
|
|
46
|
+
* (mtoc2_tensor_<helperBase>_tt / _ts / _st). Commutative ops set
|
|
47
|
+
* `commutative=true` so the scalar-first path reuses `_ts` with
|
|
48
|
+
* swapped operands.
|
|
49
|
+
*
|
|
50
|
+
* The four shape combos and what they emit:
|
|
51
|
+
*
|
|
52
|
+
* | a | b | C output |
|
|
53
|
+
* |---------|---------|--------------------------------------------|
|
|
54
|
+
* | scalar | scalar | `(argsC[0] cOp argsC[1])` |
|
|
55
|
+
* | tensor | scalar | `mtoc2_tensor_<helperBase>_ts(a, b)` |
|
|
56
|
+
* | scalar | tensor | commutative → `_ts(b, a)`; else `_st(a,b)` |
|
|
57
|
+
* | tensor | tensor | `mtoc2_tensor_<helperBase>_tt(a, b)` |
|
|
58
|
+
*
|
|
59
|
+
* `complexFold` / `complexScalarExpr` / `complexRuntimeDeps` are
|
|
60
|
+
* optional; when set, a scalar+scalar op with at least one complex
|
|
61
|
+
* operand routes through them (and `transfer` returns a complex
|
|
62
|
+
* result). Phase 1 wires complex scalars; tensor+complex paths are
|
|
63
|
+
* rejected until Phase 3 lands the runtime helpers.
|
|
64
|
+
*/
|
|
65
|
+
export declare function defineElemwiseRealBinary(opts: {
|
|
66
|
+
name: string;
|
|
67
|
+
cOp: string;
|
|
68
|
+
helperBase: string;
|
|
69
|
+
commutative: boolean;
|
|
70
|
+
fold: (a: number, b: number) => number;
|
|
71
|
+
signRule: (a: NumericType, b: NumericType) => Sign;
|
|
72
|
+
/** Scalar-complex fold. Receives two `{re, im}` operands. */
|
|
73
|
+
complexFold?: (a: {
|
|
74
|
+
re: number;
|
|
75
|
+
im: number;
|
|
76
|
+
}, b: {
|
|
77
|
+
re: number;
|
|
78
|
+
im: number;
|
|
79
|
+
}) => {
|
|
80
|
+
re: number;
|
|
81
|
+
im: number;
|
|
82
|
+
};
|
|
83
|
+
/** Scalar-complex C expression. Defaults to the same `(a cOp b)`
|
|
84
|
+
* infix as the real path — works for `+ - *` because C99 promotes
|
|
85
|
+
* real↔complex automatically. Divide overrides to route through
|
|
86
|
+
* `mtoc2_cdiv(a, b)`. */
|
|
87
|
+
complexScalarExpr?: (aC: string, bC: string) => string;
|
|
88
|
+
/** Extra runtime snippet activations needed by the complex scalar
|
|
89
|
+
* path (e.g. `mtoc2_cdiv` for division). The real-only `_real`
|
|
90
|
+
* helper still activates unconditionally for the tensor path. */
|
|
91
|
+
complexRuntimeDeps?: string[];
|
|
92
|
+
}): Builtin;
|
|
93
|
+
/** Same as `defineElemwiseRealBinary`, but the scalar path emits a C
|
|
94
|
+
* function call (`fmod(a,b)`, `atan2(a,b)`, …) instead of an infix
|
|
95
|
+
* operator. The tensor helpers still follow the `_tt`/`_ts`/`_st`
|
|
96
|
+
* naming convention; supply the appropriate `runtimeDep` for the
|
|
97
|
+
* snippet that defines them (`mtoc2_tensor_elemwise_real_fn`
|
|
98
|
+
* covers `mod`/`rem`/`atan2`/`hypot`). */
|
|
99
|
+
export declare function defineElemwiseRealBinaryFn(opts: {
|
|
100
|
+
name: string;
|
|
101
|
+
cFn: string;
|
|
102
|
+
helperBase: string;
|
|
103
|
+
commutative: boolean;
|
|
104
|
+
fold: (a: number, b: number) => number;
|
|
105
|
+
signRule: (a: NumericType, b: NumericType) => Sign;
|
|
106
|
+
runtimeDep: string;
|
|
107
|
+
/** Optional JS scalar form. Defaults to `${cFn}(${a}, ${b})` (works
|
|
108
|
+
* when `cFn` happens to be a JS function on the surrounding scope
|
|
109
|
+
* — almost never the case). Pass `(a, b) => "Math.atan2(...)"`
|
|
110
|
+
* for `atan2`/`hypot`, an explicit JS-modulo expression for
|
|
111
|
+
* `mod`/`rem`, etc. */
|
|
112
|
+
jsScalarExpr?: (aJs: string, bJs: string) => string;
|
|
113
|
+
}): Builtin;
|
|
114
|
+
export declare function signSum(a: NumericType, b: NumericType): Sign;
|
|
115
|
+
export declare function signDiff(a: NumericType, b: NumericType): Sign;
|
|
116
|
+
export declare function signProd(a: NumericType, b: NumericType): Sign;
|
|
117
|
+
/** Sign of `a / b`. Almost the same shape as `signProd`, but the
|
|
118
|
+
* divisor's sign tells a different story: `x / 0` is ±Inf (or NaN
|
|
119
|
+
* when `x` is also 0), NOT zero, so a zero divisor degrades the
|
|
120
|
+
* result to `unknown`. A zero numerator with a non-zero divisor is
|
|
121
|
+
* zero. */
|
|
122
|
+
export declare function signQuot(a: NumericType, b: NumericType): Sign;
|
|
123
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mpower` builtin — backs the `^` binary operator.
|
|
3
|
+
*
|
|
4
|
+
* v1 supports only the scalar-on-both-sides case (which delegates to
|
|
5
|
+
* `power`, the `.^` builtin). Matrix power on a square base would
|
|
6
|
+
* require eigendecomposition for non-integer exponents and repeated
|
|
7
|
+
* `mtimes` for integer exponents — a real slope of its own. Numbl's
|
|
8
|
+
* `mPow` (helpers/arithmetic.ts:1006) is the reference; we punt on it
|
|
9
|
+
* entirely for now.
|
|
10
|
+
*/
|
|
11
|
+
import { type Builtin } from "../../registry.js";
|
|
12
|
+
export declare const mpower: Builtin;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `power` builtin — backs the `.^` (elementwise power) binary
|
|
3
|
+
* operator.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors `mElemPow` in `../numbl/src/numbl-core/helpers/arithmetic.ts`
|
|
6
|
+
* (line 1075) modulo the complex-result paths. Numbl produces a
|
|
7
|
+
* complex result for `(neg)^(non-integer)`; mtoc2 has no complex
|
|
8
|
+
* type and rejects that combination at lowering time (same precedent
|
|
9
|
+
* as `sqrt` / `log` rejecting out-of-domain real inputs).
|
|
10
|
+
*
|
|
11
|
+
* Shape rules follow the rest of the elementwise binary family:
|
|
12
|
+
* - scalar OP scalar → scalar; tensor OP scalar / scalar OP tensor /
|
|
13
|
+
* same-shape tensor OP tensor.
|
|
14
|
+
* - exact-fold within EXACT_ARRAY_MAX_ELEMENTS when every input
|
|
15
|
+
* element is exact AND every output element is finite.
|
|
16
|
+
*
|
|
17
|
+
* Sign refinement:
|
|
18
|
+
* - exponent exact zero → `positive` (x^0 == 1 for every x, even 0
|
|
19
|
+
* and Inf per IEEE-754 / MATLAB).
|
|
20
|
+
* - base statically `positive` → `positive`.
|
|
21
|
+
* - base statically `nonneg` AND exponent statically `nonneg` → `nonneg`.
|
|
22
|
+
* - otherwise → `unknown`.
|
|
23
|
+
*
|
|
24
|
+
* Domain rejection: when the base could be negative (i.e. its sign
|
|
25
|
+
* isn't statically nonneg) AND the exponent isn't an exact integer
|
|
26
|
+
* (or any exact value at all), reject with a clear span — that's the
|
|
27
|
+
* "complex-result" case numbl handles but mtoc2 v1 doesn't.
|
|
28
|
+
*/
|
|
29
|
+
import type { Builtin } from "../../registry.js";
|
|
30
|
+
export declare const power: Builtin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared infrastructure for scalar comparison builtins
|
|
3
|
+
* (`eq`, `ne`, `lt`, `le`, `gt`, `ge`).
|
|
4
|
+
*
|
|
5
|
+
* Complex scalar handling (MATLAB rule):
|
|
6
|
+
* - `eq` / `ne` compare both real and imaginary parts.
|
|
7
|
+
* - `<` / `<=` / `>` / `>=` compare on the real part only; the
|
|
8
|
+
* imaginary part is dropped. (numbl matches.)
|
|
9
|
+
*/
|
|
10
|
+
import type { Builtin } from "../../registry.js";
|
|
11
|
+
export type CompareKind = "eq" | "ne" | "rel";
|
|
12
|
+
export declare function defineCompare(name: string, cOp: string, fold: (a: number, b: number) => boolean, kind?: CompareKind): Builtin;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Type } from "../../../lowering/types.js";
|
|
2
|
+
/** Validate that args at positions [from..) are legal `mtoc2_fprintf_arg_t`
|
|
3
|
+
* slots — scalar real numeric, text, or real multi-element tensor.
|
|
4
|
+
* Throws TypeError / UnsupportedConstruct (no span — framework attaches
|
|
5
|
+
* via `withSpan`). Shared by `fprintf`, `error`, future `sprintf`. */
|
|
6
|
+
export declare function validateFormatArgs(builtinName: string, argTypes: ReadonlyArray<Type>, from: number): void;
|
|
7
|
+
/** Emit one `mtoc2_fprintf_arg_t` slot for `argsC[i]` typed `argTypes[i]`.
|
|
8
|
+
* Used to build the compound-literal slot array for fprintf / error /
|
|
9
|
+
* sprintf call sites. ANF in the lowerer guarantees multi-element
|
|
10
|
+
* tensor args are bare Var lvalues (so `&c` is well-defined). */
|
|
11
|
+
export declare function emitFormatSlot(builtinName: string, c: string, t: Type, argIndex: number): string;
|
|
12
|
+
/** Build the `(const mtoc2_fprintf_arg_t[]){ ... }` compound literal
|
|
13
|
+
* from a slice of slots (or the `{ {0} }` empty form C99 needs to
|
|
14
|
+
* avoid the zero-length-array GNU extension). */
|
|
15
|
+
export declare function emitFormatSlotArray(slots: ReadonlyArray<string>): string;
|
|
16
|
+
/** Adapter expression for a text-typed format arg → `mtoc2_text_view_t`. */
|
|
17
|
+
export declare function emitTextView(c: string, t: Type): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `warning(fmt, args...)` and `warning('id:topic', fmt, args...)` —
|
|
3
|
+
* print `Warning: <message>\n` to stdout. Matches numbl
|
|
4
|
+
* (`numbl-core/runtime/specialBuiltins.ts:190`).
|
|
5
|
+
*
|
|
6
|
+
* Unlike `error`, `warning` doesn't throw and has no `try/catch`
|
|
7
|
+
* interaction; the identifier-bearing form is accepted for
|
|
8
|
+
* source-level compatibility but the id is dropped (numbl wires it
|
|
9
|
+
* into a `lastwarn` state mtoc2 doesn't expose).
|
|
10
|
+
*
|
|
11
|
+
* The state-query form `warning('on'/'off', id)` and the no-arg
|
|
12
|
+
* call `warning()` are deferred — chunkie doesn't use them.
|
|
13
|
+
*/
|
|
14
|
+
import type { Builtin } from "../../registry.js";
|
|
15
|
+
export declare const warningBuiltin: Builtin;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared scaffold for the two short-circuit logical builtins
|
|
3
|
+
* (`||` → `oror`, `&&` → `andand`).
|
|
4
|
+
*
|
|
5
|
+
* **Scope decision: scalar operands only.**
|
|
6
|
+
*
|
|
7
|
+
* MATLAB requires scalar operands for `||` and `&&`; numbl is more
|
|
8
|
+
* permissive (routes both operands through `toBool` to accept
|
|
9
|
+
* tensors — see `interpreter/interpreterExec.ts` lines 650–661,
|
|
10
|
+
* `runtime/convert.ts:44`). mtoc2 v1 takes the MATLAB-strict path so
|
|
11
|
+
* the result type stays a scalar logical and the codegen stays
|
|
12
|
+
* trivial (`(a) || (b)` / `(a) && (b)` in C, which short-circuits
|
|
13
|
+
* natively).
|
|
14
|
+
*
|
|
15
|
+
* Compile-time fold:
|
|
16
|
+
* - both operands exact → fold to scalar logical with concrete value.
|
|
17
|
+
* - LHS exact + truthy (for `||`) or falsy (for `&&`) → result is
|
|
18
|
+
* the LHS's logical value regardless of RHS. This honors
|
|
19
|
+
* short-circuit semantics at the type level so a runtime-only RHS
|
|
20
|
+
* doesn't pollute the result type. (mtoc2 always evaluates the
|
|
21
|
+
* RHS at the type-system layer, but the fold value still skips
|
|
22
|
+
* it.)
|
|
23
|
+
* - otherwise → scalar logical, no exact.
|
|
24
|
+
*
|
|
25
|
+
* **The runtime side already short-circuits** via C's `||` / `&&`
|
|
26
|
+
* operators, independent of the fold rule.
|
|
27
|
+
*/
|
|
28
|
+
import type { Builtin } from "../../registry.js";
|
|
29
|
+
export type ShortCircuitKind = "or" | "and";
|
|
30
|
+
export declare function defineShortCircuit(name: string, surface: string, kind: ShortCircuitKind): Builtin;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Builtin } from "../../registry.js";
|
|
2
|
+
interface ComplexPredSpec {
|
|
3
|
+
/** C scalar expression: given `(re, im)` text, return the per-element
|
|
4
|
+
* boolean expression. The factory wraps it in a ternary that maps
|
|
5
|
+
* to `1.0` / `0.0`. */
|
|
6
|
+
cScalarComplex: (re: string, im: string) => string;
|
|
7
|
+
/** JS scalar expression: same shape as `cScalarComplex` but for
|
|
8
|
+
* the js-aot path; operates on real-and-imag JS expressions. */
|
|
9
|
+
jsScalarComplex: (re: string, im: string) => string;
|
|
10
|
+
/** JS fold / interpreter rule on a `{re, im}` value. */
|
|
11
|
+
jsFnComplex: (re: number, im: number) => boolean;
|
|
12
|
+
/** Runtime tensor helper name (in `tensor_predicate_complex.h`). */
|
|
13
|
+
tensorHelperComplex: string;
|
|
14
|
+
}
|
|
15
|
+
export interface UnaryPredOpts {
|
|
16
|
+
name: string;
|
|
17
|
+
/** C scalar expression given the arg's C text. */
|
|
18
|
+
cScalar: (arg: string) => string;
|
|
19
|
+
/** JS scalar expression given the arg's JS text. */
|
|
20
|
+
jsScalar: (arg: string) => string;
|
|
21
|
+
/** JS fold / interpreter rule. */
|
|
22
|
+
jsFn: (x: number) => boolean;
|
|
23
|
+
/** Runtime tensor helper name (in `tensor_predicate.h`). */
|
|
24
|
+
tensorHelper: string;
|
|
25
|
+
/** Optional complex-input support. Predicates that MATLAB accepts
|
|
26
|
+
* on complex (`isnan`, `isinf`, `isfinite`, …) declare this. */
|
|
27
|
+
complex?: ComplexPredSpec;
|
|
28
|
+
}
|
|
29
|
+
export declare function defineUnaryPred(opts: UnaryPredOpts): Builtin;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const andand: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `class(x)` — return the static type name as a char (single-quoted)
|
|
3
|
+
* value.
|
|
4
|
+
*
|
|
5
|
+
* Always static in mtoc2: the type lattice knows every value's kind
|
|
6
|
+
* (numeric/double, numeric/logical, char, string, struct, class
|
|
7
|
+
* instance, cell, function-handle). The transfer attaches the
|
|
8
|
+
* resolved name to the `CharType`'s `exact` slot so subsequent
|
|
9
|
+
* `strcmp` / `if class(x) == 'double'` patterns see a folded value.
|
|
10
|
+
*
|
|
11
|
+
* Matches numbl `introspection.ts`:
|
|
12
|
+
* - number / complex-number / sparse / real-numeric tensor → "double"
|
|
13
|
+
* - boolean / logical-flagged tensor → "logical"
|
|
14
|
+
* - char → "char", string → "string"
|
|
15
|
+
* - struct / struct-array → "struct"
|
|
16
|
+
* - cell → "cell"
|
|
17
|
+
* - class instance → its `className`
|
|
18
|
+
* - function handle → "function_handle"
|
|
19
|
+
*/
|
|
20
|
+
import type { Builtin } from "../../registry.js";
|
|
21
|
+
export declare const classBuiltin: Builtin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fieldnames(s)` — returns an N×1 cell of char-array field names
|
|
3
|
+
* for a struct or class instance. Matches numbl's
|
|
4
|
+
* `introspection.ts:fieldnamesApply` semantics, with the result's
|
|
5
|
+
* cell-element type being `char` (matches MATLAB; numbl wraps as
|
|
6
|
+
* string but mtoc2 follows MATLAB by emitting chars).
|
|
7
|
+
*
|
|
8
|
+
* Interpreter-only for now; the AOT path would need to materialize
|
|
9
|
+
* a heterogeneous-len cell of chars which is a different feature
|
|
10
|
+
* class. The `emitC` / `emitJs` hooks exist so the registry-shape
|
|
11
|
+
* invariant holds but they raise `UnsupportedConstruct` rather than
|
|
12
|
+
* letting the framework's generic "no emitC hook" surface.
|
|
13
|
+
*/
|
|
14
|
+
import type { Builtin } from "../../registry.js";
|
|
15
|
+
export declare const fieldnames: Builtin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `isa(value, 'ClassName')` — checks whether `value` is an instance
|
|
3
|
+
* of the named class (or matches one of MATLAB's primitive class
|
|
4
|
+
* names: `double`, `logical`, `char`, `string`, `struct`,
|
|
5
|
+
* `function_handle`, `cell`, `numeric`).
|
|
6
|
+
*
|
|
7
|
+
* Always static: mtoc2 knows every value's type at lowering time and
|
|
8
|
+
* folds to a scalar logical literal. Matches numbl's
|
|
9
|
+
* `runtimeDispatch.ts:isa` minus the inheritance-chain walk (mtoc2
|
|
10
|
+
* has no inheritance in v1).
|
|
11
|
+
*/
|
|
12
|
+
import type { Builtin } from "../../registry.js";
|
|
13
|
+
export declare const isa: Builtin;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `iscell(x)` — folds true if the argument's static type is a Cell,
|
|
3
|
+
* false otherwise. Always static because the kind is part of the type.
|
|
4
|
+
*
|
|
5
|
+
* Matches numbl `introspection.ts:173-180` (returns `1` / `0`).
|
|
6
|
+
*/
|
|
7
|
+
import type { Builtin } from "../../registry.js";
|
|
8
|
+
export declare const iscell: Builtin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `isfield(s, name)` — does the struct/class `s` have a field/property
|
|
3
|
+
* named `name`?
|
|
4
|
+
*
|
|
5
|
+
* Numbl semantics
|
|
6
|
+
* (`numbl-core/interpreter/builtins/type-constructors.ts`):
|
|
7
|
+
* - Struct or class instance → `true` iff `name` is in the field list.
|
|
8
|
+
* - Anything else (numeric tensor, `[]`, char, string, handle, …) →
|
|
9
|
+
* `false`. There is no "empty matrix as struct" coercion; the
|
|
10
|
+
* non-struct branch just returns `false` so `isfield([], 'foo')`
|
|
11
|
+
* naturally yields `false`.
|
|
12
|
+
*
|
|
13
|
+
* mtoc2 restricts the second argument to a Char or String literal
|
|
14
|
+
* (`.exact` set) — sufficient for the common `isfield(s, 'name')` /
|
|
15
|
+
* `isfield(s, "name")` shape. Runtime-only names would need a string
|
|
16
|
+
* comparison against the (compile-time-known) struct field set, which
|
|
17
|
+
* isn't worth wiring until something needs it.
|
|
18
|
+
*/
|
|
19
|
+
import type { Builtin } from "../../registry.js";
|
|
20
|
+
export declare const isfield: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isnan: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `isnumeric(x)` — folds true if the argument's static type is a
|
|
3
|
+
* Numeric (real or complex, scalar or tensor, double or logical?
|
|
4
|
+
* MATLAB excludes logical). Matches numbl's introspection.
|
|
5
|
+
*/
|
|
6
|
+
import type { Builtin } from "../../registry.js";
|
|
7
|
+
export declare const isnumeric: Builtin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `isscalar(x)` — does `x` hold a single element?
|
|
3
|
+
*
|
|
4
|
+
* Numbl semantics
|
|
5
|
+
* (`numbl-core/interpreter/builtins/introspection.ts`, plus the
|
|
6
|
+
* `jitEmit` shortcut for `string`):
|
|
7
|
+
* - Real or logical scalar number → `true`.
|
|
8
|
+
* - Complex scalar → `true`.
|
|
9
|
+
* - Tensor → `true` iff `numel == 1`.
|
|
10
|
+
* - String handle (`"..."`) → `true` (single handle = scalar).
|
|
11
|
+
* - Char array (`'...'`) → `false`, even for `'a'` — char arrays
|
|
12
|
+
* are 1×N and treated as non-scalar.
|
|
13
|
+
* - Struct / class instance / function handle → `false`.
|
|
14
|
+
*
|
|
15
|
+
* The result folds at type-check time whenever the shape is known
|
|
16
|
+
* (which is the common case). When a tensor's shape is opaque the
|
|
17
|
+
* emit paths fall back to a `numel == 1` runtime check.
|
|
18
|
+
*/
|
|
19
|
+
import type { Builtin } from "../../registry.js";
|
|
20
|
+
export declare const isscalar: Builtin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `isstruct(x)` — folds true if the argument's static type is a
|
|
3
|
+
* struct, false otherwise. Class instances are NOT structs (matches
|
|
4
|
+
* MATLAB / numbl `introspection.ts:182`).
|
|
5
|
+
*/
|
|
6
|
+
import type { Builtin } from "../../registry.js";
|
|
7
|
+
export declare const isstruct: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const logical: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `not` builtin — backs the `~` unary operator.
|
|
3
|
+
*
|
|
4
|
+
* Elementwise logical NOT. Numbl's `not(v)` in
|
|
5
|
+
* `runtime/runtimeOperators.ts` line 100:
|
|
6
|
+
* - scalar 0 → logical true
|
|
7
|
+
* - scalar nonzero → logical false
|
|
8
|
+
* - tensor → logical tensor of same shape; element-wise
|
|
9
|
+
* `(x == 0) ? 1 : 0`
|
|
10
|
+
*
|
|
11
|
+
* Type result is always logical (mtoc2's `NumericType.elem = "logical"`).
|
|
12
|
+
* Sign is `nonneg` since outputs are in {0, 1}.
|
|
13
|
+
*/
|
|
14
|
+
import type { Builtin } from "../../registry.js";
|
|
15
|
+
export declare const notBuiltin: Builtin;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `or(a, b)` — the function form of `|`. For scalar arguments,
|
|
3
|
+
* mtoc2 routes this through the same scaffold as `||` (`oror`): the
|
|
4
|
+
* result type is scalar logical, the codegen uses C's `||` operator,
|
|
5
|
+
* and the only semantic difference (short-circuit on `||` vs.
|
|
6
|
+
* eager-evaluate on `|` / `or`) is moot — by the time the function
|
|
7
|
+
* is called, both arguments have already been computed by the
|
|
8
|
+
* call-site machinery, so the C-level short-circuit is harmless.
|
|
9
|
+
* Tensor / elementwise behavior is deferred.
|
|
10
|
+
*/
|
|
11
|
+
export declare const orBuiltin: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const oror: import("../../registry.js").Builtin;
|