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,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `diff(A)` / `diff(A, 1)` / `diff(A, 1, dim)` — first-order forward
|
|
3
|
+
* difference along the operating axis, matching numbl's `diffOnce`
|
|
4
|
+
* (helpers/reduction/cumulative.ts).
|
|
5
|
+
*
|
|
6
|
+
* Scope (v1): first-order (n == 1) real diff of a non-scalar tensor with
|
|
7
|
+
* a statically-known shape. Declines to the interpreter for:
|
|
8
|
+
* - n != 1 (the n-fold loop recomputes the default axis each pass and
|
|
9
|
+
* can flip orientation — numbl's own type/value disagree there);
|
|
10
|
+
* - the `diff(A, [], dim)` empty-weight form (numbl returns A
|
|
11
|
+
* unchanged via a NaN loop count — a quirk not worth matching);
|
|
12
|
+
* - complex input, scalar input, non-exact n/dim, out-of-range dim,
|
|
13
|
+
* and lattice-only (non-concrete) shapes.
|
|
14
|
+
*/
|
|
15
|
+
import type { Builtin } from "../../registry.js";
|
|
16
|
+
export declare const diff: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const max: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mean: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const min: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const prod: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stdBuiltin: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sum: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const varBuiltin: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared infrastructure for the rank-N constructor builtins
|
|
3
|
+
* (`zeros`, `ones`). Each call site supplies 1..MTOC2_MAX_NDIM scalar
|
|
4
|
+
* real shape arguments. Each dim arg is either statically-known
|
|
5
|
+
* (`exact` set on its NumericType) or dynamic (a runtime scalar
|
|
6
|
+
* `double`); both are accepted. MATLAB's `zeros(n)` / `ones(n)`
|
|
7
|
+
* one-arg form means an n×n square — codegen routes the dynamic
|
|
8
|
+
* variant through `mtoc2_tensor_<kind>_square` so the dim expression
|
|
9
|
+
* is evaluated exactly once.
|
|
10
|
+
*
|
|
11
|
+
* When every dim is exact the transfer can compute the shape (and
|
|
12
|
+
* sometimes the fill data); when any dim is dynamic the result type
|
|
13
|
+
* is built via `tensorDoubleFromDims` so the unknown axes propagate
|
|
14
|
+
* through the type lattice unchanged.
|
|
15
|
+
*
|
|
16
|
+
* Codegen always emits a runtime call:
|
|
17
|
+
* - all-exact dims: `mtoc2_tensor_<kind>_nd(<N>, (long[]){<lit>,…})`
|
|
18
|
+
* - dynamic single-arg square form:
|
|
19
|
+
* `mtoc2_tensor_<kind>_square((long)(<arg>))`
|
|
20
|
+
* - dynamic multi-arg form:
|
|
21
|
+
* `mtoc2_tensor_<kind>_nd(<N>, (long[]){<lit-or-cast>,…})`
|
|
22
|
+
*
|
|
23
|
+
* The element cap (8 = MTOC2_MAX_NDIM) is enforced at the source side
|
|
24
|
+
* too; the runtime helper aborts beyond that, but raising at lowering
|
|
25
|
+
* time gives a proper span.
|
|
26
|
+
*/
|
|
27
|
+
import type { Builtin, InlineSnippet } from "../../registry.js";
|
|
28
|
+
/** Runtime dim validation for the interpreter-shim `call` path —
|
|
29
|
+
* mirrors the emitted `mtoc2_check_dim` and the interpreter's
|
|
30
|
+
* `validateDim`: reject non-finite / non-integer, clamp negative to 0. */
|
|
31
|
+
export declare function checkDimRuntime(x: number): number;
|
|
32
|
+
/** Runtime dim validator shared by both backends. Mirrors the
|
|
33
|
+
* interpreter's `validateDim` (interpreter/builtins/array-construction.ts):
|
|
34
|
+
* a non-finite or non-integer size is an error, a negative size clamps
|
|
35
|
+
* to 0 (empty axis). A dynamic dim previously truncated silently
|
|
36
|
+
* (`(long)` / `Math.trunc`), so `zeros(1, 3.7)` built a 1×3 instead of
|
|
37
|
+
* raising. */
|
|
38
|
+
export declare const CHECK_DIM_SNIPPET: InlineSnippet;
|
|
39
|
+
/** Options for `defineShapeConstructor`. When `cFillValue` is set, the
|
|
40
|
+
* factory builds a "parameterized fill" constructor: the runtime
|
|
41
|
+
* helpers are invoked with `cFillValue` as their first arg
|
|
42
|
+
* (`mtoc2_tensor_fill_nd(v, ndim, dims)` style) and the scalar-
|
|
43
|
+
* collapse emit uses `cFillValue` verbatim. This is the path used by
|
|
44
|
+
* the non-finite constants (`nan`/`NaN`/`Inf`/`inf`), where the JS
|
|
45
|
+
* number's `toString` ("NaN" / "Infinity") doesn't round-trip to
|
|
46
|
+
* valid C. When `cFillValue` is undefined, the factory keeps the
|
|
47
|
+
* original zeros/ones contract: helpers take `(ndim, dims)` only
|
|
48
|
+
* and scalar collapse emits a JS-derived literal. */
|
|
49
|
+
interface ShapeConstructorOpts {
|
|
50
|
+
/** Inclusive lower bound on argument count. Defaults to 1 (zeros /
|
|
51
|
+
* ones don't accept the 0-arg form). Set to 0 by callers that
|
|
52
|
+
* combine a scalar-constant 0-arg branch with the shape
|
|
53
|
+
* constructor (the constants in `math/constants.ts`); the
|
|
54
|
+
* combined builtin's transfer/codegen pre-dispatches 0 args
|
|
55
|
+
* before delegating to this factory's transfer/codegen. */
|
|
56
|
+
minArgs?: number;
|
|
57
|
+
/** When set, prepend this C expression as the first arg of every
|
|
58
|
+
* helper call and emit it directly for the scalar-collapse case.
|
|
59
|
+
* Required when `fillValue` is non-finite (NaN/Infinity). */
|
|
60
|
+
cFillValue?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Build a `zeros` / `ones` / fill-style shape-constructor builtin.
|
|
63
|
+
* `fillValue` is the constant the output is filled with at the
|
|
64
|
+
* type level (Float64Array). See `ShapeConstructorOpts.cFillValue`
|
|
65
|
+
* for the per-helper invocation contract. */
|
|
66
|
+
export declare function defineShapeConstructor(name: string, fillValue: number, ndHelper: string, squareHelper: string, opts?: ShapeConstructorOpts): Builtin;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared logic for `triu` / `tril` — the two builtins differ only by
|
|
3
|
+
* the keep-predicate (column - row vs. row - column) and the runtime
|
|
4
|
+
* helper they dispatch to. This module centralizes:
|
|
5
|
+
*
|
|
6
|
+
* - argument validation (1..2 args, real-double tensor, k literal int)
|
|
7
|
+
* - `transfer` (exact-fold when input data fits)
|
|
8
|
+
* - hooks builders (emitC / emitJs / call) parameterized by the
|
|
9
|
+
* family-specific predicate + runtime helper.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors `triPart` in numbl's
|
|
12
|
+
* `interpreter/builtins/array-extras.ts`. Real and complex inputs
|
|
13
|
+
* both supported; sparse inputs and rank > 2 are deferred / rejected.
|
|
14
|
+
*/
|
|
15
|
+
import type { Builtin } from "../../registry.js";
|
|
16
|
+
import type { RuntimeTensor } from "../../../runtime/value.js";
|
|
17
|
+
import { mtoc2_tensor_triu as jsTriu, mtoc2_tensor_tril as jsTril, mtoc2_tensor_triu_complex as jsTriuComplex, mtoc2_tensor_tril_complex as jsTrilComplex } from "../../runtime/snippets.gen.js";
|
|
18
|
+
interface TriangularSpec {
|
|
19
|
+
/** Source-level name (registry key). */
|
|
20
|
+
name: string;
|
|
21
|
+
/** C runtime helper name for real-input (e.g. `"mtoc2_tensor_triu"`). */
|
|
22
|
+
cHelper: string;
|
|
23
|
+
/** C runtime helper name for complex-input
|
|
24
|
+
* (e.g. `"mtoc2_tensor_triu_complex"`). */
|
|
25
|
+
cHelperComplex: string;
|
|
26
|
+
/** Keep predicate matching numbl's `triPart` (column-major i,j). */
|
|
27
|
+
keep(i: number, j: number, k: number): boolean;
|
|
28
|
+
/** JS-side helper for real input. */
|
|
29
|
+
jsHelper: (a: RuntimeTensor, k: number) => unknown;
|
|
30
|
+
/** JS-side helper for complex input. */
|
|
31
|
+
jsHelperComplex: (a: RuntimeTensor, k: number) => unknown;
|
|
32
|
+
}
|
|
33
|
+
export declare function defineTriangular(spec: TriangularSpec): Builtin;
|
|
34
|
+
export { jsTriu, jsTril, jsTriuComplex, jsTrilComplex };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cat` builtin — concatenate N tensors along a given dimension.
|
|
3
|
+
*
|
|
4
|
+
* Surface: `cat(dim, A, B, ...)` where `dim >= 1` is a statically-known
|
|
5
|
+
* positive integer literal (dynamic dims are deferred). Mirrors numbl's
|
|
6
|
+
* `cat` (and the underlying `catAlongDim` in
|
|
7
|
+
* `numbl/runtime/tensor-construction.ts`):
|
|
8
|
+
*
|
|
9
|
+
* - dim==1 → vertical concat (along rows). Equivalent to `[A; B]`.
|
|
10
|
+
* - dim==2 → horizontal concat (along cols). Equivalent to `[A B]`.
|
|
11
|
+
* - dim>=3 → grow a new outer axis; result is N-D.
|
|
12
|
+
*
|
|
13
|
+
* Discipline:
|
|
14
|
+
* - Every non-dim arg must be numeric (double or logical), real
|
|
15
|
+
* or complex. Any complex input contaminates the result to
|
|
16
|
+
* complex (real inputs flow through with `imag = 0` lanes).
|
|
17
|
+
* - Scalar args are treated as 1×1 tensors (matching numbl).
|
|
18
|
+
* - Empty inputs along the cat axis are dropped at runtime. A zero-
|
|
19
|
+
* element input also drops when its non-cat dims don't match the
|
|
20
|
+
* reference shape (the asymmetric MATLAB rule).
|
|
21
|
+
* - All inputs must agree on every non-cat axis; the result extent
|
|
22
|
+
* along the cat axis is the sum of input extents.
|
|
23
|
+
*
|
|
24
|
+
* Exact-folding: when every input has statically-known shape and exact
|
|
25
|
+
* data, and the result fits `EXACT_ARRAY_MAX_ELEMENTS`, the result is
|
|
26
|
+
* computed at transfer time.
|
|
27
|
+
*
|
|
28
|
+
* Codegen dispatches to `mtoc2_tensor_cat(dim, nin, xs)` (a single
|
|
29
|
+
* runtime helper that accepts a tagged-arg array — see
|
|
30
|
+
* `tensor_cat.h`).
|
|
31
|
+
*/
|
|
32
|
+
import type { Builtin } from "../../registry.js";
|
|
33
|
+
export declare const cat: Builtin;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `diag` builtin — matrix-diagonal extract / vector-to-diagonal
|
|
3
|
+
* construct.
|
|
4
|
+
*
|
|
5
|
+
* diag(v) — vector (1×N or N×1) ⇒ N×N matrix with v on the
|
|
6
|
+
* main diagonal, zeros elsewhere.
|
|
7
|
+
* diag(A) — 2-D matrix (neither dim ≡ 1) ⇒ min(M,N)×1 column
|
|
8
|
+
* vector of the main diagonal.
|
|
9
|
+
* diag(v, k) — k-th super-/sub-diagonal. `k` must be a
|
|
10
|
+
* statically-known integer literal. `k > 0` is
|
|
11
|
+
* super-, `k < 0` is sub-diagonal.
|
|
12
|
+
* diag(scalar) — pass-through (matches numbl's 1+|k| sizing
|
|
13
|
+
* with k=0).
|
|
14
|
+
* diag(scalar, k≠0) — (|k|+1)×(|k|+1) matrix with the scalar at
|
|
15
|
+
* the k-th diagonal position.
|
|
16
|
+
*
|
|
17
|
+
* Mirrors numbl's `diag` tensor-branch in
|
|
18
|
+
* `interpreter/builtins/array-manipulation.ts`. Real and complex
|
|
19
|
+
* inputs both supported (complex routes through `*_diag_*_complex`
|
|
20
|
+
* runtime helpers); the sparse-matrix branch is N/A (mtoc2 has no
|
|
21
|
+
* sparse type).
|
|
22
|
+
*
|
|
23
|
+
* Input shape must be statically known (matches numbl's eager
|
|
24
|
+
* dispatch on rows/cols), and `k` must be statically known so the
|
|
25
|
+
* result shape is decidable at lowering time. Both restrictions can
|
|
26
|
+
* be relaxed later.
|
|
27
|
+
*/
|
|
28
|
+
import type { Builtin } from "../../registry.js";
|
|
29
|
+
export declare const diag: Builtin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `meshgrid` — 2-D coordinate grid builder.
|
|
3
|
+
*
|
|
4
|
+
* Forms supported:
|
|
5
|
+
* - `[X, Y] = meshgrid(x, y)` — `x` length M, `y` length N.
|
|
6
|
+
* Returns X (N×M, each row = x) and
|
|
7
|
+
* Y (N×M, each column = y).
|
|
8
|
+
* - `[X, Y] = meshgrid(x)` — shorthand for `meshgrid(x, x)`.
|
|
9
|
+
* - `Z = meshgrid(x, y)` / `Z = meshgrid(x)` — returns just X.
|
|
10
|
+
*/
|
|
11
|
+
import type { Builtin } from "../../registry.js";
|
|
12
|
+
export declare const meshgrid: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ones: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `repmat` builtin. Surface forms (mirrors numbl's
|
|
3
|
+
* array-manipulation `repmat`):
|
|
4
|
+
*
|
|
5
|
+
* repmat(A, n) — `n×n` tile (single scalar rep → square)
|
|
6
|
+
* repmat(A, m, n, ...) — Form A: variadic scalar reps per axis
|
|
7
|
+
* repmat(A, [m n p ...]) — Form B: dim-vector reps (must be static)
|
|
8
|
+
*
|
|
9
|
+
* Discipline:
|
|
10
|
+
* - A may be a scalar or a tensor of double / logical / complex
|
|
11
|
+
* elements. Complex inputs route through `mtoc2_tensor_repmat_complex`
|
|
12
|
+
* (or `_fill_nd_complex` for scalar A).
|
|
13
|
+
* - Each rep arg is a scalar real double; statically-known finite
|
|
14
|
+
* integers pin the corresponding output axis, dynamic scalars leave
|
|
15
|
+
* that axis as `unknown` in the result lattice.
|
|
16
|
+
* - Form B requires the dim vector to be a statically-known constant
|
|
17
|
+
* (no runtime-vector reps in v1).
|
|
18
|
+
* - Negative reps clamp to 0 (matching numbl/MATLAB), which yields an
|
|
19
|
+
* empty axis at runtime. Statically-known negatives propagate
|
|
20
|
+
* through the type system as 0 too.
|
|
21
|
+
* - Output shape is `padShape[i] * padReps[i]` where the input's
|
|
22
|
+
* shape and the reps vector are both right-padded with 1s to a
|
|
23
|
+
* common rank. There's one numbl quirk we replicate: scalar input
|
|
24
|
+
* with a single-element Form B vector (`repmat(5, [3])`) produces
|
|
25
|
+
* an `n×n` square instead of a 1-D vector.
|
|
26
|
+
*
|
|
27
|
+
* Codegen:
|
|
28
|
+
* - Scalar input: emit `mtoc2_tensor_fill_nd(<val>, ndim, dims)`
|
|
29
|
+
* directly — no need to build a 1×1 tensor first.
|
|
30
|
+
* - Tensor input: emit `mtoc2_tensor_repmat(<in>, ndim, dims)`.
|
|
31
|
+
*
|
|
32
|
+
* Exact-data folding: when the input is exact and the reps are exact,
|
|
33
|
+
* the transfer computes the tiled data and pins it on the result type
|
|
34
|
+
* (subject to the EXACT_ARRAY_MAX_ELEMENTS cap).
|
|
35
|
+
*/
|
|
36
|
+
import type { Builtin } from "../../registry.js";
|
|
37
|
+
export declare const repmat: Builtin;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `reshape` builtin. Two surface forms:
|
|
3
|
+
*
|
|
4
|
+
* Form A — variadic scalar dims: reshape(A, d1, d2, …, dN)
|
|
5
|
+
* Form B — vector of dims: reshape(A, [d1, d2, …, dN])
|
|
6
|
+
*
|
|
7
|
+
* Discipline (mirrors numbl's array-manipulation `reshape`):
|
|
8
|
+
* - 1 ≤ N ≤ MTOC2_MAX_NDIM (8). Trailing-singletons are stripped
|
|
9
|
+
* down to a 2-axis minimum (numbl:
|
|
10
|
+
* `while (s.length>2 && s.last===1) s.pop()`), then padded back
|
|
11
|
+
* up to 2 axes if N=1 was given (mtoc2 represents every tensor
|
|
12
|
+
* as min-2D).
|
|
13
|
+
* - Form A — each `di` is a scalar real double; statically-known
|
|
14
|
+
* finite non-negative integers pin the corresponding axis, and
|
|
15
|
+
* dynamic scalars (no `exact`) leave the axis as `unknown` in
|
|
16
|
+
* the result lattice.
|
|
17
|
+
* - Form B — the dim vector must be a statically-known
|
|
18
|
+
* `Float64Array` of dims (runtime vectors are not yet supported).
|
|
19
|
+
* - Form A allows at most one `[]` auto-infer slot. The translator
|
|
20
|
+
* fills it from `numel(A)` / `prod(other dims)` when both are
|
|
21
|
+
* known statically, else codegen passes `-1L` to
|
|
22
|
+
* `mtoc2_reshape_nd` which computes the slot at runtime. Form B
|
|
23
|
+
* still rejects the placeholder (the dim vector itself must be a
|
|
24
|
+
* static constant; a single `[]` inside the bracket is ambiguous).
|
|
25
|
+
* - Input `A` must be a real numeric (scalar or tensor); complex /
|
|
26
|
+
* handle / struct / class / void / string rejected with TypeError.
|
|
27
|
+
* - Element-count check at transfer time when the input shape and
|
|
28
|
+
* every new dim are statically known; deferred to the runtime
|
|
29
|
+
* helper otherwise.
|
|
30
|
+
*
|
|
31
|
+
* Codegen routes through the per-op runtime helper `mtoc2_reshape_nd`
|
|
32
|
+
* (declared in `src/codegen/runtime/tensor_reshape_nd.h`), which
|
|
33
|
+
* already accepts a runtime `(int ndim, const long *dims)` pair plus
|
|
34
|
+
* an optional `-1L` auto-infer sentinel. The result is freshly owned,
|
|
35
|
+
* so the standard ANF / scope-exit-free pipeline carries it without
|
|
36
|
+
* changes.
|
|
37
|
+
*/
|
|
38
|
+
import type { Builtin } from "../../registry.js";
|
|
39
|
+
export declare const reshape: Builtin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `size` builtin.
|
|
3
|
+
*
|
|
4
|
+
* Three forms supported in mtoc2 v1:
|
|
5
|
+
*
|
|
6
|
+
* - `size(A)` → 1×ndim row tensor of dim sizes.
|
|
7
|
+
* - `size(A, k)` → scalar (k-th dim, 1-based).
|
|
8
|
+
* - `[d1, d2, ...] → one scalar per requested output. Each output
|
|
9
|
+
* = size(A)` slot i (0-based) returns `A.dims[i]` when
|
|
10
|
+
* i < ndim and 1 otherwise — matches numbl,
|
|
11
|
+
* which does NOT collapse trailing dims into
|
|
12
|
+
* the last output (unlike MATLAB).
|
|
13
|
+
*
|
|
14
|
+
* Multi-output combined with the `dim` arg is rejected — numbl
|
|
15
|
+
* silently drops the extra outputs in that combo (leaves them
|
|
16
|
+
* unset), and matching that behavior would leak undefined values
|
|
17
|
+
* into mtoc2's typed env.
|
|
18
|
+
*/
|
|
19
|
+
import type { Builtin } from "../../registry.js";
|
|
20
|
+
export declare const size: Builtin;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sort` — stable sort with optional 'ascend' / 'descend' mode arg.
|
|
3
|
+
*
|
|
4
|
+
* Supported forms in v1:
|
|
5
|
+
* - `b = sort(a)` — ascending
|
|
6
|
+
* - `b = sort(a, 'ascend' | 'descend')` — explicit mode
|
|
7
|
+
* - `[v, i] = sort(...)` — values + 1-based positions
|
|
8
|
+
*
|
|
9
|
+
* Real and complex inputs both supported. Complex sort orders by
|
|
10
|
+
* magnitude (then phase as tiebreak), matching numbl / MATLAB.
|
|
11
|
+
*
|
|
12
|
+
* `dim` arg and `sort(a, dim, mode)` form are out of scope for v1 —
|
|
13
|
+
* the runtime helper walks the flat column-major buffer and the
|
|
14
|
+
* type system restricts inputs to 1×N / N×1 vectors. The descending
|
|
15
|
+
* comparator preserves the stable tie-break (ascending original
|
|
16
|
+
* index) in both directions, matching numbl.
|
|
17
|
+
*/
|
|
18
|
+
import type { Builtin } from "../../registry.js";
|
|
19
|
+
export declare const sort: Builtin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tril(A [, k])` — lower triangular part of a matrix around the k-th
|
|
3
|
+
* diagonal. Keeps entries where `i - j >= -k` (equivalently
|
|
4
|
+
* `j - i <= k`), zeros the rest.
|
|
5
|
+
*
|
|
6
|
+
* tril(A) ≡ tril(A, 0): zero everything strictly above the main
|
|
7
|
+
* diagonal.
|
|
8
|
+
* tril(A, k) with `k > 0` widens the kept block upward by `k`
|
|
9
|
+
* super-diagonals; `k < 0` narrows it (kept band
|
|
10
|
+
* starts `|k|` below the main diagonal).
|
|
11
|
+
*
|
|
12
|
+
* `k` must be a statically-known integer literal. Real and complex
|
|
13
|
+
* inputs both supported; rank > 2 is deferred with `UnsupportedConstruct`.
|
|
14
|
+
* Mirrors numbl's `tril` in `interpreter/builtins/array-extras.ts`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const tril: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `triu(A [, k])` — upper triangular part of a matrix around the k-th
|
|
3
|
+
* diagonal. Keeps entries where `j - i >= k`, zeros the rest.
|
|
4
|
+
*
|
|
5
|
+
* triu(A) ≡ triu(A, 0): zero everything strictly below the main
|
|
6
|
+
* diagonal.
|
|
7
|
+
* triu(A, k) with `k > 0` shifts the kept band upward (kept block
|
|
8
|
+
* starts at the k-th super-diagonal); `k < 0` shifts
|
|
9
|
+
* downward (kept block extends into the |k| sub-
|
|
10
|
+
* diagonals).
|
|
11
|
+
*
|
|
12
|
+
* `k` must be a statically-known integer literal. Real and complex
|
|
13
|
+
* inputs both supported; rank > 2 is deferred with `UnsupportedConstruct`.
|
|
14
|
+
* Mirrors numbl's `triu` in `interpreter/builtins/array-extras.ts`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const triu: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const zeros: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deal` — multi-output passthrough.
|
|
3
|
+
*
|
|
4
|
+
* [a, b, c] = deal(x, y, z) → a=x, b=y, c=z (N-arg form)
|
|
5
|
+
* [a, b, c] = deal(x) → a=x, b=x, c=x (broadcast form)
|
|
6
|
+
* a = deal(x) → x
|
|
7
|
+
*
|
|
8
|
+
* Numbl's rule (the dialect oracle): single-input broadcasts to any
|
|
9
|
+
* `nargout >= 1`; otherwise `args.length` must equal `nargout` or
|
|
10
|
+
* it's a runtime error. mtoc2 lifts the equality check into
|
|
11
|
+
* `transfer` so the mismatch is a type-time error.
|
|
12
|
+
*
|
|
13
|
+
* The result types are the input types as-is. The c-aot backend
|
|
14
|
+
* still has to emit `_copy(...)` for owned types to satisfy the
|
|
15
|
+
* "freshly-owned at every consume site" invariant; the js-aot
|
|
16
|
+
* backend uses `mtoc2_deep_clone` for the same reason; the
|
|
17
|
+
* interpreter follows numbl and deep-clones owned values too.
|
|
18
|
+
*/
|
|
19
|
+
import type { Builtin } from "../../registry.js";
|
|
20
|
+
export declare const deal: Builtin;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* feval(handle_or_name, args...) — invoke a function handle (or a
|
|
3
|
+
* function named by a char) with the given args.
|
|
4
|
+
*
|
|
5
|
+
* Implementation strategy:
|
|
6
|
+
*
|
|
7
|
+
* The c-aot / js-aot backends cannot route through a builtin
|
|
8
|
+
* emitC / emitJs hook because invoking a user function requires
|
|
9
|
+
* specialization (the target's mangled C name is created at
|
|
10
|
+
* lowering time, with the actual arg types) — information a
|
|
11
|
+
* builtin emit hook doesn't have access to. So the lowerer
|
|
12
|
+
* intercepts `feval(...)` in `lowerFuncCall` and
|
|
13
|
+
* `lowerMultiAssign` and rewrites it to a direct call on the
|
|
14
|
+
* underlying handle / function name (see `tryLowerFevalCall` in
|
|
15
|
+
* `src/lowering/lowerFuncCall.ts`). Once the rewrite fires, the
|
|
16
|
+
* builtin's emit hooks are never reached.
|
|
17
|
+
*
|
|
18
|
+
* The interpreter parallels this with a special-case in
|
|
19
|
+
* `callByName` (next to the existing `struct` / `cell`
|
|
20
|
+
* special-cases) — it consumes args[0] as a handle or char,
|
|
21
|
+
* dispatches via `callHandle` or recursively via `callByName`,
|
|
22
|
+
* and threads `nargout` through. Once that fires, this builtin's
|
|
23
|
+
* `call` hook is unreachable.
|
|
24
|
+
*
|
|
25
|
+
* This file therefore exists primarily to:
|
|
26
|
+
* - keep `feval` in `allBuiltinNames()` for syntax highlighting
|
|
27
|
+
* and the `@feval` rejection path,
|
|
28
|
+
* - validate arity / argument shape via `transfer` as a safety
|
|
29
|
+
* net if a future codepath bypasses the lowerer / interpreter
|
|
30
|
+
* interception.
|
|
31
|
+
*
|
|
32
|
+
* All four hooks raise `UnsupportedConstruct` with a message
|
|
33
|
+
* pointing the reader at where the real implementation lives.
|
|
34
|
+
*/
|
|
35
|
+
import type { Builtin } from "../../registry.js";
|
|
36
|
+
export declare const feval: Builtin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtins package. Each builtin lives in its own file and is registered
|
|
3
|
+
* here via `registerBuiltin`. Public API:
|
|
4
|
+
*
|
|
5
|
+
* - `getBuiltin(name)` / `allBuiltinNames()` for runtime lookup.
|
|
6
|
+
* - `binaryOpBuiltin(op)` / `unaryOpBuiltin(op)` to map AST operator
|
|
7
|
+
* enums to builtin names.
|
|
8
|
+
*
|
|
9
|
+
* See `registry.ts` for the `Builtin` interface and the registry itself.
|
|
10
|
+
*/
|
|
11
|
+
import type { Span } from "../parser/index.js";
|
|
12
|
+
import { BinaryOperation, UnaryOperation } from "../parser/index.js";
|
|
13
|
+
export type { Builtin } from "./registry.js";
|
|
14
|
+
export { registerBuiltin, getBuiltin, allBuiltinNames } from "./registry.js";
|
|
15
|
+
export declare function binaryOpBuiltin(op: BinaryOperation, span: Span): string;
|
|
16
|
+
export declare function unaryOpBuiltin(op: UnaryOperation, span: Span): string;
|