numbl 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +17 -33
- package/dist-cli/cli.js +61511 -46223
- package/dist-lib/graphics/types.d.ts +22 -0
- package/dist-lib/lib.js +37582 -22275
- package/dist-lib/numbl-core/executeCode.d.ts +11 -16
- package/dist-lib/numbl-core/executors/cache.d.ts +26 -0
- package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
- package/dist-lib/numbl-core/executors/context.d.ts +76 -0
- package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
- package/dist-lib/numbl-core/executors/index.d.ts +14 -0
- 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 +120 -0
- package/dist-lib/numbl-core/executors/plugins.d.ts +32 -0
- package/dist-lib/numbl-core/executors/registry.d.ts +148 -0
- package/dist-lib/numbl-core/executors/types.d.ts +103 -0
- package/dist-lib/numbl-core/functionResolve.d.ts +7 -0
- package/dist-lib/numbl-core/helpers/check-helpers.d.ts +4 -5
- package/dist-lib/numbl-core/helpers/linsolve.d.ts +2 -3
- package/dist-lib/numbl-core/helpers/prng.d.ts +1 -2
- package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/datetime.d.ts +2 -1
- package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
- package/dist-lib/numbl-core/interpreter/builtins/misc.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +4 -109
- package/dist-lib/numbl-core/interpreter/interpreter.d.ts +51 -49
- package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
- package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
- package/dist-lib/numbl-core/interpreter/types.d.ts +27 -12
- 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 +13 -5
- 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 +94 -0
- package/dist-lib/numbl-core/jsUserFunctions.d.ts +10 -2
- package/dist-lib/numbl-core/lowering/loweringContext.d.ts +24 -0
- package/dist-lib/numbl-core/native/lapack-bridge.d.ts +3 -3
- package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
- package/dist-lib/numbl-core/parser/types.d.ts +20 -0
- package/dist-lib/numbl-core/runtime/alloc.d.ts +12 -23
- package/dist-lib/numbl-core/runtime/constructors.d.ts +6 -6
- package/dist-lib/numbl-core/runtime/cow.d.ts +33 -0
- package/dist-lib/numbl-core/runtime/index.d.ts +4 -3
- package/dist-lib/numbl-core/runtime/indexing.d.ts +17 -2
- package/dist-lib/numbl-core/runtime/plotBuiltinDispatch.d.ts +86 -0
- package/dist-lib/numbl-core/runtime/plotUtils.d.ts +17 -2
- package/dist-lib/numbl-core/runtime/refcount.d.ts +85 -0
- package/dist-lib/numbl-core/runtime/runtime.d.ts +43 -67
- package/dist-lib/numbl-core/runtime/runtimeDispatch.d.ts +2 -2
- package/dist-lib/numbl-core/runtime/runtimeIndexing.d.ts +2 -2
- package/dist-lib/numbl-core/runtime/runtimeMemberAccess.d.ts +1 -1
- package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +1 -0
- package/dist-lib/numbl-core/runtime/struct-access.d.ts +2 -1
- package/dist-lib/numbl-core/runtime/types.d.ts +117 -62
- package/dist-lib/numbl-core/runtime/utils.d.ts +2 -8
- 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-COAM8o1E.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-CgBUy7v7.js +4748 -0
- package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
- package/dist-site-viewer/assets/numbl-worker-VkVtodCX.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/lapack_linsolve.cpp +1 -1
- package/native/numbl_addon_common.h +2 -2
- package/native/ops/comparison.c +1 -1
- package/native/ops/real_unary_elemwise.c +3 -1
- package/package.json +16 -13
- package/dist-lib/numbl-core/jit/c/abi.d.ts +0 -90
- package/dist-lib/numbl-core/jit/c/assemble.d.ts +0 -56
- package/dist-lib/numbl-core/jit/c/classify.d.ts +0 -70
- package/dist-lib/numbl-core/jit/c/compile.d.ts +0 -37
- package/dist-lib/numbl-core/jit/c/context.d.ts +0 -152
- package/dist-lib/numbl-core/jit/c/emit/assign.d.ts +0 -20
- package/dist-lib/numbl-core/jit/c/emit/complexScalar.d.ts +0 -18
- package/dist-lib/numbl-core/jit/c/emit/fused.d.ts +0 -42
- package/dist-lib/numbl-core/jit/c/emit/helpers.d.ts +0 -40
- package/dist-lib/numbl-core/jit/c/emit/index.d.ts +0 -14
- package/dist-lib/numbl-core/jit/c/emit/scalar.d.ts +0 -23
- package/dist-lib/numbl-core/jit/c/emit/stmt.d.ts +0 -25
- package/dist-lib/numbl-core/jit/c/emit/tensor.d.ts +0 -127
- package/dist-lib/numbl-core/jit/c/emit/userCall.d.ts +0 -58
- package/dist-lib/numbl-core/jit/c/epilogue.d.ts +0 -26
- package/dist-lib/numbl-core/jit/c/feasibility.d.ts +0 -44
- package/dist-lib/numbl-core/jit/c/prelude.d.ts +0 -37
- package/dist-lib/numbl-core/jit/c/visit.d.ts +0 -63
- package/dist-lib/numbl-core/jit/e1/complexKernelEmit.d.ts +0 -46
- package/dist-lib/numbl-core/jit/e1/hash.d.ts +0 -10
- package/dist-lib/numbl-core/jit/e1/install.d.ts +0 -13
- package/dist-lib/numbl-core/jit/e1/kernelEmit.d.ts +0 -54
- package/dist-lib/numbl-core/jit/e1/multiReductionKernel.d.ts +0 -66
- package/dist-lib/numbl-core/jit/e1/openmpFlag.d.ts +0 -13
- package/dist-lib/numbl-core/jit/e1/scalarFnKernel.d.ts +0 -44
- package/dist-lib/numbl-core/jit/e2/assignKernel.d.ts +0 -34
- package/dist-lib/numbl-core/jit/e2/astToJitExpr.d.ts +0 -25
- package/dist-lib/numbl-core/jit/e2/cache.d.ts +0 -80
- package/dist-lib/numbl-core/jit/e2/chainKernelEmit.d.ts +0 -55
- package/dist-lib/numbl-core/jit/e2/classify.d.ts +0 -119
- package/dist-lib/numbl-core/jit/e2/compileFn.d.ts +0 -16
- package/dist-lib/numbl-core/jit/e2/complexChainKernelEmit.d.ts +0 -79
- package/dist-lib/numbl-core/jit/e2/emitShared.d.ts +0 -71
- package/dist-lib/numbl-core/jit/e2/install.d.ts +0 -11
- package/dist-lib/numbl-core/jit/e2/liveness.d.ts +0 -29
- package/dist-lib/numbl-core/jit/e2/loopKernel.d.ts +0 -49
- package/dist-lib/numbl-core/jit/e2/loopKernelEmit.d.ts +0 -75
- package/dist-lib/numbl-core/jit/e2/multiReductionDriver.d.ts +0 -24
- package/dist-lib/numbl-core/jit/e2/reductionKernelEmit.d.ts +0 -72
- package/dist-lib/numbl-core/jit/e2/scalarFnDriver.d.ts +0 -29
- package/dist-lib/numbl-core/jit/fusedChainHelpers.d.ts +0 -65
- package/dist-lib/numbl-core/jit/fusedScalarEmit.d.ts +0 -69
- package/dist-lib/numbl-core/jit/fusion.d.ts +0 -71
- package/dist-lib/numbl-core/jit/fusionOps.d.ts +0 -25
- package/dist-lib/numbl-core/jit/heavyOps.d.ts +0 -15
- package/dist-lib/numbl-core/jit/jitBailSafety.d.ts +0 -41
- package/dist-lib/numbl-core/jit/jitLoop.d.ts +0 -25
- package/dist-lib/numbl-core/jit/jitLoopAnalysis.d.ts +0 -37
- package/dist-lib/numbl-core/jit/jitLower.d.ts +0 -122
- package/dist-lib/numbl-core/jit/jitLowerExpr.d.ts +0 -27
- package/dist-lib/numbl-core/jit/jitLowerStmt.d.ts +0 -9
- package/dist-lib/numbl-core/jit/jitLowerTypes.d.ts +0 -29
- package/dist-lib/numbl-core/jit/jitTopLevel.d.ts +0 -22
- package/dist-lib/numbl-core/jit/jitTypes.d.ts +0 -394
- package/dist-lib/numbl-core/jit/js/jitCodegen.d.ts +0 -7
- package/dist-lib/numbl-core/jit/js/jitCodegenHoist.d.ts +0 -70
- package/dist-lib/numbl-core/jit/js/jitHelpers.d.ts +0 -34
- package/dist-lib/numbl-core/jit/js/jitHelpersComplex.d.ts +0 -21
- package/dist-lib/numbl-core/jit/js/jitHelpersIndex.d.ts +0 -33
- package/dist-lib/numbl-core/jit/js/jitHelpersTensor.d.ts +0 -34
- package/dist-lib/numbl-core/jit/js/jsFusedCodegen.d.ts +0 -17
- package/dist-lib/numbl-core/jit/js/jsMultiReduction.d.ts +0 -70
- package/dist-lib/numbl-core/jit/scalarEmit.d.ts +0 -58
- package/dist-plot-viewer/assets/index-GiUNnMQg.js +0 -4426
- package/native/jit_runtime/jit_runtime.c +0 -261
- package/native/jit_runtime/jit_runtime.h +0 -204
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIT type system.
|
|
3
|
+
*
|
|
4
|
+
* Used by the executor classification phase and by the JIT type
|
|
5
|
+
* adapter to map numbl runtime values onto JIT specializations.
|
|
6
|
+
* The IR node definitions that previously lived alongside this file
|
|
7
|
+
* (`JitExpr` / `JitStmt` / `JitCacheEntry`) belonged to the legacy
|
|
8
|
+
* in-tree JS-JIT / C-JIT pipeline and were deleted with it.
|
|
9
|
+
*/
|
|
10
|
+
export type SignCategory = "positive" | "nonneg" | "nonpositive" | "negative";
|
|
11
|
+
export type JitType = {
|
|
12
|
+
kind: "number";
|
|
13
|
+
exact?: number;
|
|
14
|
+
sign?: SignCategory;
|
|
15
|
+
isInteger?: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
kind: "boolean";
|
|
18
|
+
value?: boolean;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "complex_or_number";
|
|
21
|
+
pureImaginary?: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "tensor";
|
|
24
|
+
isComplex: boolean;
|
|
25
|
+
shape?: number[];
|
|
26
|
+
ndim?: number;
|
|
27
|
+
isLogical?: boolean;
|
|
28
|
+
nonneg?: boolean;
|
|
29
|
+
} | {
|
|
30
|
+
kind: "string";
|
|
31
|
+
value?: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "char";
|
|
34
|
+
value?: string;
|
|
35
|
+
} | {
|
|
36
|
+
kind: "struct";
|
|
37
|
+
fields?: Record<string, JitType>;
|
|
38
|
+
} | {
|
|
39
|
+
/**
|
|
40
|
+
* A 1-D homogeneous array of structs (matlab struct array form
|
|
41
|
+
* `T.nodes(i)`). `elemFields` records the per-element field types
|
|
42
|
+
* unified across all elements. `length` is optional and carries
|
|
43
|
+
* the statically-known element count when available.
|
|
44
|
+
*/
|
|
45
|
+
kind: "struct_array";
|
|
46
|
+
elemFields?: Record<string, JitType>;
|
|
47
|
+
length?: number;
|
|
48
|
+
} | {
|
|
49
|
+
kind: "class_instance";
|
|
50
|
+
className: string;
|
|
51
|
+
isHandleClass?: boolean;
|
|
52
|
+
fields?: Record<string, JitType>;
|
|
53
|
+
} | {
|
|
54
|
+
kind: "sparse_matrix";
|
|
55
|
+
isComplex: boolean;
|
|
56
|
+
m?: number;
|
|
57
|
+
n?: number;
|
|
58
|
+
} | {
|
|
59
|
+
kind: "cell";
|
|
60
|
+
shape?: number[];
|
|
61
|
+
/** Per-index element types (1-based), tracked when literal-index
|
|
62
|
+
* writes happen with a known type. Reads with a literal index in
|
|
63
|
+
* the map return the tracked type instead of `unknown`, which
|
|
64
|
+
* unblocks chunkerfunc's `[out{1:3}] = fcurve(ts); r = out{1}; …`
|
|
65
|
+
* pattern. Sparse — missing keys mean "unknown". */
|
|
66
|
+
elements?: Record<number, JitType>;
|
|
67
|
+
} | {
|
|
68
|
+
kind: "dictionary";
|
|
69
|
+
} | {
|
|
70
|
+
kind: "function_handle";
|
|
71
|
+
} | {
|
|
72
|
+
kind: "unknown";
|
|
73
|
+
};
|
|
74
|
+
export declare function signFromNumber(v: number): SignCategory | undefined;
|
|
75
|
+
export declare function isNonneg(t: JitType): boolean;
|
|
76
|
+
export declare function flipSign(s?: SignCategory): SignCategory | undefined;
|
|
77
|
+
export declare function unifySign(a?: SignCategory, b?: SignCategory): SignCategory | undefined;
|
|
78
|
+
export declare function jitTypeKey(t: JitType): string;
|
|
79
|
+
/** Widen/unify two types at control-flow join points. */
|
|
80
|
+
export declare function unifyJitTypes(a: JitType, b: JitType): JitType;
|
|
81
|
+
export declare function isScalarType(t: JitType): boolean;
|
|
82
|
+
export declare function isNumericScalarType(t: JitType): boolean;
|
|
83
|
+
export declare function isTensorType(t: JitType): boolean;
|
|
84
|
+
export declare function isComplexType(t: JitType): boolean;
|
|
85
|
+
/** True when the type guarantees an integer value at runtime (safe for |0). */
|
|
86
|
+
export declare function isKnownInteger(t: JitType): boolean;
|
|
87
|
+
/** Types that support arithmetic binary operations in the JIT. */
|
|
88
|
+
export declare function isArithmeticType(t: JitType): boolean;
|
|
89
|
+
export declare function shapeAfterReduction(shape: number[], dim?: number): {
|
|
90
|
+
scalar: true;
|
|
91
|
+
} | {
|
|
92
|
+
scalar: false;
|
|
93
|
+
shape: number[];
|
|
94
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Loader for .numbl.js user functions.
|
|
3
3
|
*
|
|
4
4
|
* Evaluates .numbl.js files that define IBuiltins via
|
|
5
|
-
* register({ resolve
|
|
5
|
+
* register({ resolve }).
|
|
6
6
|
* Supports optional WASM and native shared library bindings via directives:
|
|
7
7
|
* // wasm: <name>
|
|
8
8
|
* // native: <name>
|
|
@@ -21,12 +21,20 @@ export interface LoadedJsUserFunction {
|
|
|
21
21
|
}
|
|
22
22
|
/** Returns true if the file is a numbl JS user function file (`*.numbl.js`). */
|
|
23
23
|
export declare function isNumblJsFile(fileName: string): boolean;
|
|
24
|
+
/** Returns true if the file is an mtoc2-only user function file (`*.mtoc2.js`).
|
|
25
|
+
* Numbl recognizes the extension for workspace discovery + function-name
|
|
26
|
+
* resolution, but never executes the body — mtoc2's loader does that. */
|
|
27
|
+
export declare function isMtoc2JsFile(fileName: string): boolean;
|
|
28
|
+
/** Derive a function name from a `.mtoc2.js` workspace file path.
|
|
29
|
+
* "myadd.mtoc2.js" → "myadd"
|
|
30
|
+
* "/path/to/myadd.mtoc2.js" → "myadd" */
|
|
31
|
+
export declare function funcNameFromMtoc2JsFile(fileName: string): string;
|
|
24
32
|
/**
|
|
25
33
|
* Load .numbl.js user function files and return them as LoadedJsUserFunction
|
|
26
34
|
* records. Each loaded record carries the function name, source file name,
|
|
27
35
|
* and the IBuiltin object built from the file's `register()` call.
|
|
28
36
|
*
|
|
29
|
-
* Each .numbl.js file calls register({ resolve
|
|
37
|
+
* Each .numbl.js file calls register({ resolve }) to define an
|
|
30
38
|
* IBuiltin. resolve(argTypes, nargout) returns { outputTypes, apply } or null.
|
|
31
39
|
*
|
|
32
40
|
* A .numbl.js file can specify bindings via directives at the top of the file:
|
|
@@ -23,6 +23,13 @@ interface WorkspaceRegistry {
|
|
|
23
23
|
fileName: string;
|
|
24
24
|
builtin: IBuiltin;
|
|
25
25
|
}>;
|
|
26
|
+
/** mtoc2-only user functions (.mtoc2.js): functionName → { fileName, source }.
|
|
27
|
+
* Numbl never executes these — the source text is stored for mtoc2's loader
|
|
28
|
+
* to consume. Numbl's interpreter rejects calls to them with a clear error. */
|
|
29
|
+
mtoc2UserFunctionsByName: Map<string, {
|
|
30
|
+
fileName: string;
|
|
31
|
+
source: string;
|
|
32
|
+
}>;
|
|
26
33
|
/** Per-workspace-file lowering contexts (created on demand) */
|
|
27
34
|
fileContexts: Map<string, LoweringContext>;
|
|
28
35
|
/** Workspace classes: qualifiedName → ClassInfo */
|
|
@@ -68,6 +75,10 @@ export interface FunctionIndex {
|
|
|
68
75
|
workspaceFunctions: Set<string>;
|
|
69
76
|
/** JS user functions (resolved at workspace-function priority, not builtin) */
|
|
70
77
|
jsUserFunctions: Set<string>;
|
|
78
|
+
/** mtoc2-only user functions (.mtoc2.js). Resolved at workspace-function
|
|
79
|
+
* priority, like jsUserFunctions. Numbl's interpreter rejects calls to
|
|
80
|
+
* these; mtoc2 routes them through its own loader. */
|
|
81
|
+
mtoc2UserFunctions: Set<string>;
|
|
71
82
|
/** Workspace classes (classdef files) */
|
|
72
83
|
workspaceClasses: Set<string>;
|
|
73
84
|
/** Local subfunctions per workspace file: primaryFuncName → Set<subfuncName> */
|
|
@@ -139,6 +150,12 @@ export declare class LoweringContext {
|
|
|
139
150
|
* Register workspace files for on-demand resolution.
|
|
140
151
|
* Extracts function names from filenames (top-level only, plus +pkg namespaces).
|
|
141
152
|
* Also handles @ClassName class folders.
|
|
153
|
+
*
|
|
154
|
+
* `.m` files register as workspace functions / classes / private functions
|
|
155
|
+
* (the regular MATLAB-style discovery). `.mtoc2.js` files register as
|
|
156
|
+
* mtoc2-only user functions: numbl tracks the name so resolution sees
|
|
157
|
+
* them, but the body stays unparsed — mtoc2's loader evaluates them.
|
|
158
|
+
* `.mtoc2.js` files in `@ClassName/` are not yet supported.
|
|
142
159
|
*/
|
|
143
160
|
registerWorkspaceFiles(files: WorkspaceFile[]): void;
|
|
144
161
|
isWorkspaceFunction(name: string): boolean;
|
|
@@ -149,6 +166,13 @@ export declare class LoweringContext {
|
|
|
149
166
|
* Uses first-wins semantics so search-path priority is honored.
|
|
150
167
|
*/
|
|
151
168
|
registerJsUserFunction(funcName: string, fileName: string, builtin: IBuiltin): void;
|
|
169
|
+
/**
|
|
170
|
+
* Register an mtoc2-only user function (.mtoc2.js) in the workspace
|
|
171
|
+
* registry. Numbl stores the source text verbatim; mtoc2's loader
|
|
172
|
+
* evaluates it. Uses first-wins semantics so search-path priority is
|
|
173
|
+
* honored — same as `.numbl.js`.
|
|
174
|
+
*/
|
|
175
|
+
registerMtoc2UserFunction(funcName: string, fileName: string, source: string): void;
|
|
152
176
|
/**
|
|
153
177
|
* Get the effective directory for this context's file, used for
|
|
154
178
|
* private function resolution. If the file is inside a private/ folder,
|
|
@@ -26,7 +26,7 @@ export interface LapackBridge {
|
|
|
26
26
|
* Invert an n×n real matrix stored in column-major order (MATLAB/LAPACK convention).
|
|
27
27
|
* @param data Column-major Float64Array of length n*n (not modified).
|
|
28
28
|
* @param n Matrix dimension.
|
|
29
|
-
* @returns Inverted matrix as a
|
|
29
|
+
* @returns Inverted matrix as a allocFloat64Array in column-major order.
|
|
30
30
|
* @throws Error if the matrix is singular.
|
|
31
31
|
*/
|
|
32
32
|
inv(data: Float64Array, n: number): Float64Array;
|
|
@@ -138,7 +138,7 @@ export interface LapackBridge {
|
|
|
138
138
|
* @param k Number of columns in A and rows in B.
|
|
139
139
|
* @param B Column-major Float64Array of length k*n (B is k×n, not modified).
|
|
140
140
|
* @param n Number of columns in B and C.
|
|
141
|
-
* @returns C = A*B as a
|
|
141
|
+
* @returns C = A*B as a allocFloat64Array of length m*n in column-major order.
|
|
142
142
|
*/
|
|
143
143
|
matmul?(A: Float64Array, m: number, k: number, B: Float64Array, n: number): Float64Array;
|
|
144
144
|
/**
|
|
@@ -168,7 +168,7 @@ export interface LapackBridge {
|
|
|
168
168
|
* @param n Number of columns in A; also the number of rows in the result X.
|
|
169
169
|
* @param B Column-major Float64Array of length m*nrhs (B is m×nrhs, not modified).
|
|
170
170
|
* @param nrhs Number of right-hand sides (columns of B and X).
|
|
171
|
-
* @returns X as a
|
|
171
|
+
* @returns X as a allocFloat64Array of length n*nrhs in column-major order.
|
|
172
172
|
*/
|
|
173
173
|
linsolve?(A: Float64Array, m: number, n: number, B: Float64Array, nrhs: number): Float64Array;
|
|
174
174
|
/**
|
|
@@ -8,6 +8,9 @@ export declare class ClassParser extends FunctionParser {
|
|
|
8
8
|
parseClassDef(): Stmt;
|
|
9
9
|
private parseNameBlock;
|
|
10
10
|
private parsePropertiesNamesBlock;
|
|
11
|
+
/** Consume a balanced `open ... close` run (handling nesting). Assumes the
|
|
12
|
+
* next token is `open`; no-op otherwise. */
|
|
13
|
+
private skipBalanced;
|
|
11
14
|
private parseOptionalAttrList;
|
|
12
15
|
/**
|
|
13
16
|
* Parse a single method signature.
|
|
@@ -316,6 +316,26 @@ export type Stmt = {
|
|
|
316
316
|
directive: string;
|
|
317
317
|
args: string[];
|
|
318
318
|
span: Span;
|
|
319
|
+
} | {
|
|
320
|
+
/** Synthetic stmt produced by an executor-registered AST
|
|
321
|
+
* transformer (e.g. the C-JIT chain pass). Wraps a contiguous
|
|
322
|
+
* run of original stmts so a specialized executor can claim
|
|
323
|
+
* them as a unit; the interpreter falls back to executing
|
|
324
|
+
* `subStmts` in order when the executor isn't registered or
|
|
325
|
+
* declines.
|
|
326
|
+
*
|
|
327
|
+
* Never produced by the parser. */
|
|
328
|
+
type: "Synth";
|
|
329
|
+
/** Identifies the executor that this synth node was built for
|
|
330
|
+
* (e.g. `"c-jit-chain"`). The matching executor reads `data`. */
|
|
331
|
+
tag: string;
|
|
332
|
+
/** Original adjacent stmts, in source order. Used by the
|
|
333
|
+
* interpreter fallback. */
|
|
334
|
+
subStmts: Stmt[];
|
|
335
|
+
/** Executor-specific pre-computed analysis. Opaque to the
|
|
336
|
+
* interpreter. */
|
|
337
|
+
data: unknown;
|
|
338
|
+
span: Span;
|
|
319
339
|
};
|
|
320
340
|
export interface AbstractSyntaxTree {
|
|
321
341
|
body: Stmt[];
|
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
* use `new Float64Array(n)` / `new FloatXArray(n)` instead.
|
|
14
|
-
*
|
|
15
|
-
* In non-Node environments (browser, Deno without node-compat, …) where
|
|
16
|
-
* `Buffer` is unavailable, we fall back to the zero-filling constructor
|
|
17
|
-
* — still correct, just slower.
|
|
18
|
-
*/
|
|
19
|
-
import { FloatXArray } from "./types.js";
|
|
20
|
-
type FloatXInstance = InstanceType<typeof FloatXArray>;
|
|
21
|
-
export declare function uninitFloat64(n: number): Float64Array<ArrayBuffer>;
|
|
22
|
-
export declare function uninitFloatX(n: number): FloatXInstance;
|
|
23
|
-
export {};
|
|
1
|
+
/** Allocate a Float64Array. Thin wrapper around `new Float64Array(x)`
|
|
2
|
+
* kept as a single allocation site so future strategies (pooling,
|
|
3
|
+
* COW-aware allocation, etc.) can be reintroduced without touching
|
|
4
|
+
* every callsite. */
|
|
5
|
+
export declare function allocFloat64Array(x: number | number[] | Float64Array): Float64Array;
|
|
6
|
+
/** No-op. Kept as a placeholder for future explicit-release strategies
|
|
7
|
+
* (e.g. pool release, arena reset). With pure JS GC, scratch buffers
|
|
8
|
+
* are reclaimed when the wrapper goes out of scope. */
|
|
9
|
+
export declare function releaseFloat64Array(_buf: Float64Array): void;
|
|
10
|
+
/** Pass-through. Kept as a placeholder for future scratch-arena
|
|
11
|
+
* strategies. Today it just runs `fn` and returns its result. */
|
|
12
|
+
export declare function withScratch<T>(fn: () => T): T;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RuntimeValue constructor helpers (the
|
|
2
|
+
* RuntimeValue constructor helpers (the RTV namespace).
|
|
3
3
|
*/
|
|
4
4
|
import { ItemType } from "../lowering/itemTypes.js";
|
|
5
|
-
import { type RuntimeNumber,
|
|
5
|
+
import { type RuntimeNumber, RuntimeTensor, type RuntimeString, RuntimeChar, type RuntimeLogical, RuntimeCell, RuntimeStruct, RuntimeFunction, RuntimeClassInstance, RuntimeComplexNumber, RuntimeDummyHandle, RuntimeGraphicsHandle, RuntimeStructArray, RuntimeSparseMatrix, RuntimeDictionary, type RuntimeValue } from "./types.js";
|
|
6
6
|
export declare const RTV: {
|
|
7
7
|
num(value: number): RuntimeNumber;
|
|
8
|
-
tensor(data:
|
|
9
|
-
/** Fast tensor constructor — data must be
|
|
10
|
-
tensorRaw(data:
|
|
8
|
+
tensor(data: Float64Array | number[], shape: number[], imag?: Float64Array | number[]): RuntimeTensor;
|
|
9
|
+
/** Fast tensor constructor — data must be Float64Array, shape already normalized (no trailing singletons). */
|
|
10
|
+
tensorRaw(data: Float64Array, shape: number[]): RuntimeTensor;
|
|
11
11
|
/** Create a scalar tensor (1x1) */
|
|
12
12
|
scalar(value: number): RuntimeNumber;
|
|
13
13
|
/** Create a row vector [1 x n] */
|
|
@@ -15,7 +15,7 @@ export declare const RTV: {
|
|
|
15
15
|
/** Create a column vector [n x 1] */
|
|
16
16
|
col(data: number[], imag?: number[]): RuntimeTensor;
|
|
17
17
|
/** Create a matrix from row-major data */
|
|
18
|
-
matrix(rows: number, cols: number, data: number[] |
|
|
18
|
+
matrix(rows: number, cols: number, data: number[] | Float64Array, imag?: number[] | Float64Array): RuntimeTensor;
|
|
19
19
|
string(value: string): RuntimeString;
|
|
20
20
|
char(value: string): RuntimeChar;
|
|
21
21
|
logical(value: boolean): RuntimeLogical;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refcount-driven copy-on-write helpers.
|
|
3
|
+
*
|
|
4
|
+
* The lvalue write path uses these to make sure the chain from the env
|
|
5
|
+
* root to the leaf is uniquely owned before mutation: at each level, if
|
|
6
|
+
* the container is shared (`isShared`), it's cloned and the clone is
|
|
7
|
+
* rebound in the parent. After the chain is unique, in-place mutation
|
|
8
|
+
* at the leaf is observable only to the LHS variable.
|
|
9
|
+
*/
|
|
10
|
+
import { type RuntimeValue } from "./types.js";
|
|
11
|
+
import { type RefcountRuntime } from "./refcount.js";
|
|
12
|
+
/** Return a fresh wrapper that shadows `v`'s contents but has rc=0
|
|
13
|
+
* (modulo scope adoption from the constructor). The new wrapper holds
|
|
14
|
+
* its own copy of the underlying buffers (for tensors) or its own
|
|
15
|
+
* fields/data array (for containers). Refs to child values are
|
|
16
|
+
* shared with the original — child wrappers get incref'd by the new
|
|
17
|
+
* container's constructor. Caller is responsible for binding the
|
|
18
|
+
* fresh wrapper into the parent slot.
|
|
19
|
+
*
|
|
20
|
+
* Returns the original value unchanged for kinds that don't need to
|
|
21
|
+
* be copied (handle-class instances, primitives) — the caller can
|
|
22
|
+
* `=== v` test if the copy was a no-op. */
|
|
23
|
+
export declare function cowCopy(v: RuntimeValue): RuntimeValue;
|
|
24
|
+
/** If `v` is shared (rc-driven), return a fresh non-shared copy;
|
|
25
|
+
* otherwise return `v` unchanged. The new wrapper has refcount 0
|
|
26
|
+
* (or 1 if the active scope adopts it via the constructor); the
|
|
27
|
+
* caller must bind it into the parent slot to keep it alive.
|
|
28
|
+
*
|
|
29
|
+
* Returns the original `v` for handle-class instances and primitives —
|
|
30
|
+
* callers can `result === v` test to detect a no-op. */
|
|
31
|
+
export declare function cowIfShared(v: RuntimeValue): RuntimeValue;
|
|
32
|
+
export { isShared } from "./refcount.js";
|
|
33
|
+
export type { RefcountRuntime };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export type { RuntimeValue,
|
|
1
|
+
export type { RuntimeValue, RuntimeString, RuntimeLogical } from "./types.js";
|
|
2
|
+
export { RuntimeTensor, RuntimeCell, RuntimeStruct, RuntimeFunction, RuntimeDictionary, } from "./types.js";
|
|
2
3
|
export { RuntimeError, CancellationError, offsetToLine, offsetToColumn, } from "./error.js";
|
|
3
4
|
export type { CallFrame } from "./error.js";
|
|
4
|
-
export { tensorSize2D, numel, colMajorIndex
|
|
5
|
+
export { tensorSize2D, numel, colMajorIndex } from "./utils.js";
|
|
5
6
|
export { toNumber, toBool, toString } from "./convert.js";
|
|
6
7
|
export { valuesAreEqual } from "./compare.js";
|
|
7
8
|
export { displayValue } from "./display.js";
|
|
8
9
|
export { RTV } from "./constructors.js";
|
|
9
10
|
export { mAdd, mSub, mMul, mElemMul, mDiv, mElemDiv, mPow, mElemPow, mNeg, mTranspose, mConjugateTranspose, mEqual, mNotEqual, mLess, mLessEqual, mGreater, mGreaterEqual, } from "../helpers/arithmetic.js";
|
|
10
|
-
export { COLON_INDEX, indexIntoRTValue as mIndex, storeIntoRTValueIndex as mIndexStore, } from "./indexing.js";
|
|
11
|
+
export { COLON_INDEX, indexIntoRTValue as mIndex, storeIntoRTValueIndex as mIndexStore, charToNumericTensor, numericTensorToChar, } from "./indexing.js";
|
|
11
12
|
export { getRTValueField as mGetField, setRTValueField as mSetField, } from "./struct-access.js";
|
|
12
13
|
export { makeRangeTensor as mRange, horzcat, vertcat, } from "./tensor-construction.js";
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Indexing, struct field access, range creation, and tensor concatenation.
|
|
3
3
|
*/
|
|
4
|
-
import { type RuntimeValue } from "./types.js";
|
|
4
|
+
import { type RuntimeValue, RuntimeTensor, RuntimeChar } from "./types.js";
|
|
5
|
+
import { type RefcountRuntime } from "./refcount.js";
|
|
6
|
+
/** Runtime surface needed by index-store mutations. The full Runtime
|
|
7
|
+
* class satisfies this structurally. */
|
|
8
|
+
type StoreRuntime = RefcountRuntime;
|
|
5
9
|
/** Sentinel marker for colon (:) indexing — means "all indices in this dimension" */
|
|
6
10
|
export declare const COLON_INDEX: RuntimeValue;
|
|
11
|
+
/** Convert a char value to a numeric (column-major) tensor of its code
|
|
12
|
+
* points. A RuntimeChar stores its `value` row-major (each of `shape[0]`
|
|
13
|
+
* rows is `shape[1]` chars, concatenated), so we transpose into the
|
|
14
|
+
* tensor's column-major layout. Used so indexed assignment into / from a
|
|
15
|
+
* char array runs on the numeric tensor machinery (MATLAB treats char as
|
|
16
|
+
* numeric for indexed assignment). */
|
|
17
|
+
export declare function charToNumericTensor(c: RuntimeChar): RuntimeTensor;
|
|
18
|
+
/** Inverse of charToNumericTensor: read a numeric tensor's column-major
|
|
19
|
+
* data into a row-major char value, rounding codes to integers. */
|
|
20
|
+
export declare function numericTensorToChar(t: RuntimeTensor): RuntimeChar;
|
|
7
21
|
/** Index into a value: v(i1, i2, ...) */
|
|
8
22
|
export declare function indexIntoRTValue(base: RuntimeValue, indices: RuntimeValue[]): RuntimeValue;
|
|
9
23
|
/** Store into indexed position: base(indices) = rhs — uses copy-on-write for shared data */
|
|
10
|
-
export declare function storeIntoRTValueIndex(base: RuntimeValue, indices: RuntimeValue[], rhs: RuntimeValue, parenAssign?: boolean): RuntimeValue;
|
|
24
|
+
export declare function storeIntoRTValueIndex(base: RuntimeValue, indices: RuntimeValue[], rhs: RuntimeValue, parenAssign?: boolean, rt?: StoreRuntime): RuntimeValue;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plot builtin dispatch — the single source of truth for the
|
|
3
|
+
* `(name, args)` → `PlotInstruction[]` mapping that every plotting
|
|
4
|
+
* builtin performs.
|
|
5
|
+
*
|
|
6
|
+
* Historically this logic was scattered across two places:
|
|
7
|
+
* - `runtime.ts` registered the data-bearing plot names
|
|
8
|
+
* (`plot`, `surf`, `imagesc`, …) inside `initBuiltins`.
|
|
9
|
+
* - `specialBuiltins.ts` registered the graphics ops (`figure`,
|
|
10
|
+
* `title`, `xlabel`, `hold`, `subplot`, `clf`, …) inside
|
|
11
|
+
* `registerSpecialBuiltins`.
|
|
12
|
+
*
|
|
13
|
+
* Both sites pushed onto `rt.plotInstructions` and (for `hold` /
|
|
14
|
+
* `tiledlayout` / `nexttile`) updated small flags on the Runtime.
|
|
15
|
+
* `dispatchPlotBuiltin` is the consolidation. The Runtime registers
|
|
16
|
+
* each name with a 1-line wrapper that calls this function and then
|
|
17
|
+
* returns the right `nargout`-handle value; the side-effect (the
|
|
18
|
+
* push) lives here.
|
|
19
|
+
*
|
|
20
|
+
* Out-of-scope names — kept registered separately because their
|
|
21
|
+
* semantics need the full Runtime context:
|
|
22
|
+
* - `fplot` / `fplot3` — evaluate a user function-handle, need
|
|
23
|
+
* the Runtime's executor.
|
|
24
|
+
* - `drawnow` / `pause` — call the `ExecOptions` callbacks
|
|
25
|
+
* (`onDrawnow`, `onPause`).
|
|
26
|
+
* - `streamline` / `stream2` — return non-trivial values.
|
|
27
|
+
* - `ishold` — reads `state.holdState`, but is a pure query (no
|
|
28
|
+
* instructions pushed); the Runtime can call `state.holdState`
|
|
29
|
+
* directly.
|
|
30
|
+
*
|
|
31
|
+
* Reusable from outside numbl: mtoc2 (the static-translation
|
|
32
|
+
* sibling project) imports this function to render plots in its
|
|
33
|
+
* browser IDE without reimplementing per-builtin logic.
|
|
34
|
+
*/
|
|
35
|
+
import type { RuntimeValue } from "./types.js";
|
|
36
|
+
import type { PlotInstruction } from "../../graphics/types.js";
|
|
37
|
+
/** State carried by graphics ops that need to remember things between
|
|
38
|
+
* calls. `holdState` is read by `ishold()` so `hold on; if ishold ...`
|
|
39
|
+
* works; `tiledLayoutState` lets `nexttile` know where to place the
|
|
40
|
+
* next axes. The `Runtime` class implements this interface; mtoc2's
|
|
41
|
+
* browser viewer keeps its own instance. */
|
|
42
|
+
export interface PlotDispatchState {
|
|
43
|
+
holdState: boolean;
|
|
44
|
+
tiledLayoutState: TiledLayoutState | null;
|
|
45
|
+
}
|
|
46
|
+
/** Active tiled-layout grid. `mode` controls how the grid grows: in
|
|
47
|
+
* `flow` (default), nexttile expands rows/cols to fit; `vertical` and
|
|
48
|
+
* `horizontal` extend one axis; `fixed` uses the M/N from the
|
|
49
|
+
* tiledlayout(M,N) call verbatim. */
|
|
50
|
+
export interface TiledLayoutState {
|
|
51
|
+
rows: number;
|
|
52
|
+
cols: number;
|
|
53
|
+
mode: "fixed" | "flow" | "vertical" | "horizontal";
|
|
54
|
+
count: number;
|
|
55
|
+
}
|
|
56
|
+
/** Run a single plot-builtin call. Pushes onto `instructions` and
|
|
57
|
+
* updates `state` to mirror what numbl's runtime did before this
|
|
58
|
+
* refactor. Returns `true` iff `name` was a recognized plot builtin;
|
|
59
|
+
* callers fall through to their own dispatch on `false`. */
|
|
60
|
+
export declare function dispatchPlotBuiltin(name: string, args: RuntimeValue[], instructions: PlotInstruction[], state: PlotDispatchState): boolean;
|
|
61
|
+
/** Names handled by `dispatchPlotBuiltin`. Useful for registering all
|
|
62
|
+
* of them in a loop (numbl's `initBuiltins` / `registerSpecialBuiltins`
|
|
63
|
+
* do that for the side-effect-only subset). Stays in sync with the
|
|
64
|
+
* cases above by construction. */
|
|
65
|
+
export declare const PLOT_DISPATCH_NAMES: ReadonlyArray<string>;
|
|
66
|
+
/** Graphics-related names numbl exposes as no-op (or near-no-op)
|
|
67
|
+
* stubs — they don't push plot instructions and don't render, but
|
|
68
|
+
* numbl accepts them so MATLAB scripts compile and run. Sources:
|
|
69
|
+
* - `interpreter/builtins/misc.ts` (`groot`, `gcf`, `gca`, `shg`,
|
|
70
|
+
* `newplot`, `xlim`, `ylim`, `set`, `get`, `ishold`)
|
|
71
|
+
* - `runtime/specialBuiltins.ts` (`drawnow`, `pause`)
|
|
72
|
+
*
|
|
73
|
+
* These names belong here, alongside `PLOT_DISPATCH_NAMES`, because
|
|
74
|
+
* downstream consumers (mtoc2's translator, syntax highlighters,
|
|
75
|
+
* doc generators) want to know the full "plot-script surface area"
|
|
76
|
+
* numbl tolerates — not just the renderable subset. Keeping the
|
|
77
|
+
* union in one place is the whole point of consolidating dispatch
|
|
78
|
+
* here. */
|
|
79
|
+
export declare const PLOT_STUB_NAMES: ReadonlyArray<string>;
|
|
80
|
+
/** The union of `PLOT_DISPATCH_NAMES` (renderable) and
|
|
81
|
+
* `PLOT_STUB_NAMES` (recognized-but-no-render). Every name a plotting
|
|
82
|
+
* script might invoke that numbl tolerates. Mtoc2 imports this to
|
|
83
|
+
* drive its own builtin registration so the two repos stay in
|
|
84
|
+
* lockstep — when numbl gains a new plot builtin, mtoc2 picks it up
|
|
85
|
+
* at the next `tsc` / `vite build` with no mtoc2-side edit. */
|
|
86
|
+
export declare const PLOT_ALL_NAMES: ReadonlyArray<string>;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* plot(X1,Y1,LineSpec1,...), and Name-Value pairs like 'Color','r','LineWidth',2.
|
|
6
6
|
*/
|
|
7
7
|
import { type RuntimeValue } from "./types.js";
|
|
8
|
-
export type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, } from "../../graphics/types.js";
|
|
9
|
-
import type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace } from "../../graphics/types.js";
|
|
8
|
+
export type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace, } from "../../graphics/types.js";
|
|
9
|
+
import type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, PcolorTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, QuiverTrace } from "../../graphics/types.js";
|
|
10
10
|
export interface ParsedLineSpec {
|
|
11
11
|
color?: string;
|
|
12
12
|
lineStyle?: string;
|
|
@@ -222,3 +222,18 @@ export declare function parsePiechartArgs(args: RuntimeValue[], innerRadius: num
|
|
|
222
222
|
* heatmap(xvalues, yvalues, cdata) — with axis labels
|
|
223
223
|
*/
|
|
224
224
|
export declare function parseHeatmapArgs(args: RuntimeValue[]): HeatmapTrace;
|
|
225
|
+
/**
|
|
226
|
+
* Parse quiver() arguments.
|
|
227
|
+
*
|
|
228
|
+
* Supported forms:
|
|
229
|
+
* quiver(U, V)
|
|
230
|
+
* quiver(X, Y, U, V)
|
|
231
|
+
* quiver(..., scale) — scale: nonnegative number or 'off'
|
|
232
|
+
* quiver(..., LineSpec)
|
|
233
|
+
* quiver(..., LineSpec, 'filled')
|
|
234
|
+
* quiver(..., Name, Value) — Color, LineStyle, LineWidth, ShowArrowHead, etc.
|
|
235
|
+
*
|
|
236
|
+
* X, Y, U, V can be vectors or matrices. If U,V are matrices and X,Y are
|
|
237
|
+
* vectors, X and Y are expanded to a meshgrid.
|
|
238
|
+
*/
|
|
239
|
+
export declare function parseQuiverArgs(args: RuntimeValue[]): QuiverTrace[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference counting for RuntimeValue containers, used both for
|
|
3
|
+
* lifecycle (decref → _destroy chain) and for refcount-driven COW.
|
|
4
|
+
*
|
|
5
|
+
* Every container kind extends `Refcounted`. The count starts at 0
|
|
6
|
+
* (newly-constructed value, not yet bound to anything), is incremented
|
|
7
|
+
* when a slot (env binding, struct field, cell element, ...) takes
|
|
8
|
+
* ownership, and decremented when the slot releases ownership. When the
|
|
9
|
+
* count reaches 0, `_destroy` runs and decrefs every child value.
|
|
10
|
+
*
|
|
11
|
+
* COW uses `effectiveRc(v)` — the count minus the number of currently
|
|
12
|
+
* active per-statement scopes that hold the value. Scope adoption is
|
|
13
|
+
* a transient lifecycle artifact (it keeps the wrapper alive across an
|
|
14
|
+
* expression's evaluation); it isn't an ownership relationship that
|
|
15
|
+
* should force a copy.
|
|
16
|
+
*
|
|
17
|
+
* Strict mode (`rt.strictRefcount`) makes a decref of an already-zero
|
|
18
|
+
* count throw.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pushCurrentRuntime(rt: RefcountRuntime): void;
|
|
21
|
+
export declare function popCurrentRuntime(rt: RefcountRuntime): void;
|
|
22
|
+
export declare function getCurrentRuntime(): RefcountRuntime | null;
|
|
23
|
+
/** Minimal runtime surface used by the refcount API. The real `Runtime`
|
|
24
|
+
* class satisfies this; using an interface here avoids a circular
|
|
25
|
+
* import between refcount.ts ↔ runtime.ts ↔ types.ts. */
|
|
26
|
+
export interface RefcountRuntime {
|
|
27
|
+
/** When true, decref of a zero count throws. */
|
|
28
|
+
strictRefcount?: boolean;
|
|
29
|
+
/** Per-statement transient scope. Constructors auto-adopt fresh
|
|
30
|
+
* values here so an unbound expression result stays alive until end
|
|
31
|
+
* of statement. Null when no statement is in flight. */
|
|
32
|
+
currentScope?: RefScope | null;
|
|
33
|
+
}
|
|
34
|
+
/** Base class for every refcounted runtime value. */
|
|
35
|
+
export declare abstract class Refcounted {
|
|
36
|
+
/** Public so type guards can look for a `kind` discriminator without
|
|
37
|
+
* walking the prototype. The string is set by every subclass. */
|
|
38
|
+
abstract readonly kind: string;
|
|
39
|
+
/** Reference count. Starts at 0; incremented when bound to a slot. */
|
|
40
|
+
_rc: number;
|
|
41
|
+
/** Subset of `_rc` contributed by active per-statement scopes. The
|
|
42
|
+
* COW check uses `_rc - _scopeHolds` so transient scope holds don't
|
|
43
|
+
* force unnecessary copies (a value freshly constructed during a
|
|
44
|
+
* statement and passed to a function would otherwise look "shared"
|
|
45
|
+
* to the callee). */
|
|
46
|
+
_scopeHolds: number;
|
|
47
|
+
constructor();
|
|
48
|
+
incref(): void;
|
|
49
|
+
decref(rt: RefcountRuntime): void;
|
|
50
|
+
/** Subclasses release child refs. Idempotent must NOT be assumed —
|
|
51
|
+
* callers guarantee this fires exactly once. Default is a no-op for
|
|
52
|
+
* kinds that have no child refs (RuntimeChar, RuntimeComplexNumber,
|
|
53
|
+
* RuntimeDummyHandle, etc.). */
|
|
54
|
+
protected _destroy(_rt: RefcountRuntime): void;
|
|
55
|
+
}
|
|
56
|
+
/** True if the value is a container that participates in refcounting.
|
|
57
|
+
* Primitives (number, boolean, string) return false. */
|
|
58
|
+
export declare function isRefcountable(v: unknown): v is Refcounted;
|
|
59
|
+
/** Increment refcount on a value if it's a container; primitives are noop. */
|
|
60
|
+
export declare function incref(v: unknown): void;
|
|
61
|
+
/** Decrement refcount on a value if it's a container; primitives are noop. */
|
|
62
|
+
export declare function decref(rt: RefcountRuntime, v: unknown): void;
|
|
63
|
+
/** True if `v` has more than one external (non-scope) holder — i.e. a
|
|
64
|
+
* mutation through one slot would observably affect another holder.
|
|
65
|
+
* Primitives return false; primitives can never be "shared" since
|
|
66
|
+
* every slot stores a copy of the value. */
|
|
67
|
+
export declare function isShared(v: unknown): boolean;
|
|
68
|
+
/** Per-statement transients harness. Fresh values produced by constructors
|
|
69
|
+
* and operators are adopted here at rc=1; on `drain`, every member is
|
|
70
|
+
* decref'd. Anything bound to a slot during the statement gets an extra
|
|
71
|
+
* incref from the slot, so it survives drain at slot count.
|
|
72
|
+
*
|
|
73
|
+
* Each adopt also increments the value's `_scopeHolds`, which the COW
|
|
74
|
+
* check (`isShared`) subtracts from `_rc` — the scope's hold is a
|
|
75
|
+
* lifecycle artifact, not an ownership relationship that should force
|
|
76
|
+
* a copy. */
|
|
77
|
+
export declare class RefScope {
|
|
78
|
+
private members;
|
|
79
|
+
/** Take ownership of a fresh value: incref and remember for drain. */
|
|
80
|
+
adopt(v: unknown): void;
|
|
81
|
+
/** Release every adopted value. Called in `withScope`'s finally. */
|
|
82
|
+
drain(rt: RefcountRuntime): void;
|
|
83
|
+
/** Number of currently-adopted values (for assertions/tests). */
|
|
84
|
+
size(): number;
|
|
85
|
+
}
|