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,10 @@
|
|
|
1
|
+
import type { Builtin } from "../../registry.js";
|
|
2
|
+
export declare const islogical: Builtin;
|
|
3
|
+
export declare const isfloat: Builtin;
|
|
4
|
+
export declare const ischarBuiltin: Builtin;
|
|
5
|
+
export declare const isstring: Builtin;
|
|
6
|
+
export declare const isinteger: Builtin;
|
|
7
|
+
export declare const ndims: Builtin;
|
|
8
|
+
export declare const ismatrix: Builtin;
|
|
9
|
+
export declare const isrow: Builtin;
|
|
10
|
+
export declare const iscolumn: Builtin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `xor(a, b)` — logical exclusive-or of two real scalars. The result is
|
|
3
|
+
* a logical scalar that is `true` iff exactly one operand is nonzero.
|
|
4
|
+
*
|
|
5
|
+
* Scalar-only: tensor or complex operands throw `UnsupportedConstruct`
|
|
6
|
+
* so the call falls back to the interpreter (which broadcasts and
|
|
7
|
+
* handles complex). Booleanization uses `(x != 0)` on the C side and
|
|
8
|
+
* `Number(x) !== 0` on the JS side so both agree element-for-element —
|
|
9
|
+
* including `NaN` (nonzero → true on both).
|
|
10
|
+
*/
|
|
11
|
+
import type { Builtin } from "../../registry.js";
|
|
12
|
+
export declare const xorBuiltin: Builtin;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JS-side scalar-complex fold functions for unary math builtins.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the cscalar.h `mtoc2_c*` helpers — both the C side and
|
|
5
|
+
* c2js's JS-runtime side must agree with these formulas. Used by
|
|
6
|
+
* `_unary_real.ts`'s factory at type-system-fold time when an input
|
|
7
|
+
* has an exact `{re, im}` carrier.
|
|
8
|
+
*
|
|
9
|
+
* Real input is projected to `{re: x, im: 0}` upstream of these
|
|
10
|
+
* helpers via `exactScalarAsComplex`; that case is rare for unary
|
|
11
|
+
* math since the same builtin's real-path fold already catches it.
|
|
12
|
+
*/
|
|
13
|
+
export type C = {
|
|
14
|
+
re: number;
|
|
15
|
+
im: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function cSqrt(z: C): C;
|
|
18
|
+
export declare function cExp(z: C): C;
|
|
19
|
+
export declare function cLog(z: C): C;
|
|
20
|
+
export declare function cLog2(z: C): C;
|
|
21
|
+
export declare function cLog10(z: C): C;
|
|
22
|
+
export declare function cSin(z: C): C;
|
|
23
|
+
export declare function cCos(z: C): C;
|
|
24
|
+
export declare function cTan(z: C): C;
|
|
25
|
+
export declare function cSinh(z: C): C;
|
|
26
|
+
export declare function cCosh(z: C): C;
|
|
27
|
+
export declare function cTanh(z: C): C;
|
|
28
|
+
export declare function cAtan(z: C): C;
|
|
29
|
+
export declare function cFloor(z: C): C;
|
|
30
|
+
export declare function cCeil(z: C): C;
|
|
31
|
+
/** Half-away-from-zero on each component (matches C99 `round`). */
|
|
32
|
+
export declare function cRound(z: C): C;
|
|
33
|
+
export declare function cFix(z: C): C;
|
|
34
|
+
export declare function cSign(z: C): C;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type NumericType, type Sign } from "../../../lowering/types.js";
|
|
2
|
+
import type { Builtin } from "../../registry.js";
|
|
3
|
+
export interface UnaryRealMathOpts {
|
|
4
|
+
/** Source-level builtin name (also the runtime helper suffix). */
|
|
5
|
+
name: string;
|
|
6
|
+
/** C `<math.h>` function name for the scalar path (e.g. `"cos"`). */
|
|
7
|
+
cFnReal: string;
|
|
8
|
+
/** JS-side scalar fn for compile-time fold (and for the interpreter's
|
|
9
|
+
* `call` hook). */
|
|
10
|
+
jsFn: (x: number) => number;
|
|
11
|
+
/** Optional JS expression form (textual) for `emitJs`'s scalar real
|
|
12
|
+
* path. Defaults to `Math.${name}(arg)` which works for most names
|
|
13
|
+
* (sin/cos/tan/sqrt/exp/log/log2/log10/abs/atan/floor/ceil/sign).
|
|
14
|
+
* Override for `fix` (`Math.trunc`) and `round`
|
|
15
|
+
* (custom half-away-from-zero form). */
|
|
16
|
+
jsExpr?: (arg: string) => string;
|
|
17
|
+
/** Sign refinement on the result type. Called with the (validated)
|
|
18
|
+
* real-numeric input type. */
|
|
19
|
+
signRule: (t: NumericType) => Sign;
|
|
20
|
+
/** Optional real-domain predicate. `true` means the real input stays
|
|
21
|
+
* on the real path; `false` means it leaves the real domain (would
|
|
22
|
+
* produce NaN / -Inf / complex). When `false` AND `complex.liftOnDomainMiss`
|
|
23
|
+
* is set, the call lifts to the complex path (real-input,
|
|
24
|
+
* complex-output); otherwise the factory throws `TypeError`. */
|
|
25
|
+
realDomainOk?: (t: NumericType) => boolean;
|
|
26
|
+
/** Optional complex-input support. When set, complex scalars route
|
|
27
|
+
* through `cFnComplex` (a `mtoc2_c*` helper); complex tensors
|
|
28
|
+
* route through `mtoc2_tensor_<name>_complex`. `jsFnComplex`
|
|
29
|
+
* folds at the type-system layer when the input has an exact
|
|
30
|
+
* `{re, im}` carrier. `liftOnDomainMiss` makes the factory lift
|
|
31
|
+
* a real-typed input through the same complex path when
|
|
32
|
+
* `realDomainOk` returns false (e.g. `sqrt(-1)`). */
|
|
33
|
+
complex?: {
|
|
34
|
+
cFnComplex: string;
|
|
35
|
+
jsFnComplex: (z: {
|
|
36
|
+
re: number;
|
|
37
|
+
im: number;
|
|
38
|
+
}) => {
|
|
39
|
+
re: number;
|
|
40
|
+
im: number;
|
|
41
|
+
};
|
|
42
|
+
liftOnDomainMiss?: boolean;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Sign rule for rounding-toward-zero builtins (`fix`, `round`, `ceil`,
|
|
46
|
+
* `floor`). Captures the "may collapse to zero" pattern: if a side of
|
|
47
|
+
* the number line can land on 0, its strict-sign input weakens to the
|
|
48
|
+
* corresponding non-strict sign. The flags say whether the operation's
|
|
49
|
+
* rounding direction can reach 0 from that side. */
|
|
50
|
+
export declare function roundingSignRule(positiveCanLand: boolean, negativeCanLand: boolean): (t: NumericType) => Sign;
|
|
51
|
+
export declare function defineUnaryRealMath(opts: UnaryRealMathOpts): Builtin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Builtin } from "../../registry.js";
|
|
2
|
+
/** Complex-aware `abs`. Real inputs route through the existing real
|
|
3
|
+
* builtin (preserving its sign refinement and tensor path); complex
|
|
4
|
+
* inputs return `hypot(creal, cimag)` per-element, with a REAL result
|
|
5
|
+
* type (different shape contract from the rest of the unary-math
|
|
6
|
+
* family). */
|
|
7
|
+
export declare const abs: Builtin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `angle(z)` — phase angle in radians. Returns `atan2(im, re)`. For
|
|
3
|
+
* real input the result is 0 when the value is non-negative, π when
|
|
4
|
+
* negative; complex input yields `carg(z)`.
|
|
5
|
+
*/
|
|
6
|
+
import type { Builtin } from "../../registry.js";
|
|
7
|
+
export declare const angle: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const asinh: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const atan: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `conj(z)` — complex conjugate. Accepts real or complex, scalar or
|
|
3
|
+
* tensor. For real input it's the identity; for complex input it
|
|
4
|
+
* flips the sign of the imaginary part.
|
|
5
|
+
*/
|
|
6
|
+
import type { Builtin } from "../../registry.js";
|
|
7
|
+
export declare const conj: Builtin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Builtin } from "../../registry.js";
|
|
2
|
+
export declare const pi: Builtin;
|
|
3
|
+
export declare const eps: Builtin;
|
|
4
|
+
export declare const Inf: Builtin;
|
|
5
|
+
export declare const inf: Builtin;
|
|
6
|
+
export declare const NaNBuiltin: Builtin;
|
|
7
|
+
export declare const nan: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cos: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cosh: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dot(a, b)` — real or complex dot product.
|
|
3
|
+
*
|
|
4
|
+
* Numbl semantics
|
|
5
|
+
* (`numbl-core/interpreter/builtins/linear-algebra.ts`):
|
|
6
|
+
* - Two same-length 1-D vectors (any combination of row / column /
|
|
7
|
+
* scalar) → scalar `sum_i a_i * b_i` (real) or
|
|
8
|
+
* `sum_i conj(a_i) * b_i` (complex).
|
|
9
|
+
* - Two matrices of the **same** shape M×N → column-wise dot,
|
|
10
|
+
* returned as a 1×N row vector.
|
|
11
|
+
* - Length / shape mismatch → runtime error.
|
|
12
|
+
* - Any complex operand promotes the result to complex (real
|
|
13
|
+
* tensors flow through with `imag = 0`).
|
|
14
|
+
*
|
|
15
|
+
* Real folding: when both inputs are exact and small enough, the
|
|
16
|
+
* result is computed at type-check time and lands as `exact` on the
|
|
17
|
+
* output type, so call sites used in `if`-conds get the static fold.
|
|
18
|
+
*/
|
|
19
|
+
import type { Builtin } from "../../registry.js";
|
|
20
|
+
export declare const dot: Builtin;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `double(x)` — numeric conversion to double.
|
|
3
|
+
*
|
|
4
|
+
* Matches numbl `type-constructors.ts`:
|
|
5
|
+
* - Numeric scalar (double / logical / complex_or_number):
|
|
6
|
+
* scalar real number out. For complex scalars, returns the real
|
|
7
|
+
* part (numbl's `apply` returns `v.re`).
|
|
8
|
+
* - Numeric tensor: same shape; logical lane → double (drop the
|
|
9
|
+
* logical flag); complex tensors pass through as complex
|
|
10
|
+
* (numbl preserves `isComplex` in the match shape).
|
|
11
|
+
* - Char (single-quoted): char-code conversion. Empty → 0×0
|
|
12
|
+
* tensor; 1 char → scalar double; N chars → 1×N row.
|
|
13
|
+
*
|
|
14
|
+
* Scope notes:
|
|
15
|
+
* - The mtoc2 C representation already stores logical and double
|
|
16
|
+
* scalars as `double`, and logical tensors as `mtoc2_tensor_t`
|
|
17
|
+
* with a `double *` buffer. So a numeric → double conversion is
|
|
18
|
+
* either identity (scalar) or a fresh struct copy (tensor); no
|
|
19
|
+
* per-element rewrite is needed.
|
|
20
|
+
* - Char input is supported only when the char carries `exact`
|
|
21
|
+
* (the common case — char literals always carry exact text).
|
|
22
|
+
* Non-exact char input (e.g. `double(sprintf(...))`) raises
|
|
23
|
+
* `UnsupportedConstruct`. Folding at transfer time avoids
|
|
24
|
+
* introducing a new runtime helper for the char-tensor → numeric
|
|
25
|
+
* tensor path.
|
|
26
|
+
*/
|
|
27
|
+
import type { Builtin } from "../../registry.js";
|
|
28
|
+
export declare const doubleBuiltin: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const exp: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** `floor(x)` rounds toward -Inf. Complex inputs round each component
|
|
2
|
+
* independently (MATLAB convention). Only `positive` inputs may land
|
|
3
|
+
* on 0 (e.g. `floor(0.5) = 0`); `negative` inputs are bounded away. */
|
|
4
|
+
export declare const floor: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `imag(z)` — imaginary part. Accepts scalar real or complex; returns
|
|
3
|
+
* a real double. For real input the result is always 0; for complex
|
|
4
|
+
* input the result is `cimag(z)`.
|
|
5
|
+
*/
|
|
6
|
+
import type { Builtin } from "../../registry.js";
|
|
7
|
+
export declare const imag: Builtin;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `logspace(a, b)` / `logspace(a, b, n)` — n logarithmically-spaced
|
|
3
|
+
* values from 10^a to 10^b as a 1×n row tensor (default n = 50).
|
|
4
|
+
* Matches numbl's interpreter, including the MATLAB special case where
|
|
5
|
+
* an upper limit of exactly `pi` makes the last point `pi` (not 10^pi).
|
|
6
|
+
*/
|
|
7
|
+
import type { Builtin } from "../../registry.js";
|
|
8
|
+
export declare const logspace: Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mod: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const round: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sin: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sinh: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** `sqrt(x)`: real input that's provably non-negative stays on the
|
|
2
|
+
* real path; everything else lifts to the complex path
|
|
3
|
+
* (`mtoc2_csqrt` for scalars, `mtoc2_tensor_sqrt_complex` for
|
|
4
|
+
* tensors). Matches MATLAB: `sqrt(-1)` returns `0 + 1i`,
|
|
5
|
+
* `sqrt([-1 4])` returns `[0+1i, 2]`.
|
|
6
|
+
*
|
|
7
|
+
* Sign rule on the (real-path) input:
|
|
8
|
+
* - `positive` → `positive` (sqrt of strictly positive is strictly positive)
|
|
9
|
+
* - everything else (`nonneg` / `zero`) → `nonneg`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const sqrt: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tan: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tanh: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `uniquetol(x)` / `uniquetol(x, tol)` — first-occurrence dedup of
|
|
3
|
+
* a real-double tensor with absolute tolerance.
|
|
4
|
+
*
|
|
5
|
+
* Numbl semantics
|
|
6
|
+
* (`numbl-core/interpreter/builtins/set-operations.ts`):
|
|
7
|
+
* - Default `tol = 1e-6` when no second arg.
|
|
8
|
+
* - Algorithm: naive pairwise scan against the running unique
|
|
9
|
+
* list — first-occurrence order preserved, NOT sorted.
|
|
10
|
+
* Transitive chaining is a real consequence (e.g.
|
|
11
|
+
* `uniquetol([0 0.6 1.2 1.8], 0.7) == [0 1.2]`).
|
|
12
|
+
* - NaN is never within tol of anything; each NaN survives.
|
|
13
|
+
* - Output shape: row input (1×N) → row output `[1, ?]`;
|
|
14
|
+
* anything else (column / matrix / empty) → column output
|
|
15
|
+
* `[?, 1]`. Empty input gives `[0, 1]`.
|
|
16
|
+
*
|
|
17
|
+
* The multi-output `[c, ia, ic] = uniquetol(...)` form, the
|
|
18
|
+
* `'ByRows'` name-value pair, and complex inputs are not yet
|
|
19
|
+
* supported and raise `UnsupportedConstruct`.
|
|
20
|
+
*/
|
|
21
|
+
import type { Builtin } from "../../registry.js";
|
|
22
|
+
export declare const uniquetol: Builtin;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared scaffold for the `cumsum` / `cumprod` family — prefix-scan
|
|
3
|
+
* builtins that return a tensor of the SAME shape as the input.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors numbl's `cumOp` (helpers/reduction/cumulative.ts) for both
|
|
6
|
+
* default-axis pick (first dim > 1, else dim 1) and per-fiber column-
|
|
7
|
+
* major scan. Real and complex inputs both supported; complex routes
|
|
8
|
+
* through `_complex_dim` runtime helpers that scan both lanes
|
|
9
|
+
* (cumprod uses per-step complex multiplication).
|
|
10
|
+
*
|
|
11
|
+
* Exact-fold rule: when input has an exact data carrier AND the result
|
|
12
|
+
* fits `EXACT_ARRAY_MAX_ELEMENTS`, scan at translate time and attach
|
|
13
|
+
* the result as `exact` on the returned type.
|
|
14
|
+
*
|
|
15
|
+
* Out of scope: runtime (non-exact) `dim`, and the lattice-only shape
|
|
16
|
+
* form when no dim is given (`cumsum(A)` on a tensor whose static shape
|
|
17
|
+
* is unknown raises — pass an explicit dim).
|
|
18
|
+
*/
|
|
19
|
+
import { type Sign } from "../../../lowering/types.js";
|
|
20
|
+
import type { Builtin } from "../../registry.js";
|
|
21
|
+
export interface CumulativeSpec {
|
|
22
|
+
/** Source-level builtin name (also the runtime helper suffix:
|
|
23
|
+
* `mtoc2_tensor_<name>_dim`). */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Identity seed (`0` for cumsum, `1` for cumprod). */
|
|
26
|
+
init: number;
|
|
27
|
+
/** Per-element accumulator step (real). */
|
|
28
|
+
step(acc: number, x: number): number;
|
|
29
|
+
/** Per-element accumulator step (complex). Takes `(accRe, accIm,
|
|
30
|
+
* xRe, xIm)` and returns the next `[re, im]` pair. Required when
|
|
31
|
+
* `supportsComplex` is not `false`. */
|
|
32
|
+
stepComplex?(accRe: number, accIm: number, xRe: number, xIm: number): [number, number];
|
|
33
|
+
/** Sign rule on the result given the input's sign. */
|
|
34
|
+
signRule(s: Sign): Sign;
|
|
35
|
+
/** Whether complex input is JIT-compiled. Defaults to `true`
|
|
36
|
+
* (cumsum/cumprod). `cummax`/`cummin` set this `false`: numbl's
|
|
37
|
+
* complex cummax is a quirky component-wise max that isn't worth
|
|
38
|
+
* replicating — complex input declines to the interpreter. */
|
|
39
|
+
supportsComplex?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function defineCumulative(spec: CumulativeSpec): Builtin;
|
|
42
|
+
/** cumsum: a prefix sum of like-signed values stays in the same sign
|
|
43
|
+
* class. (Mixed signs collapse to `unknown` because partial sums can
|
|
44
|
+
* cross zero.) */
|
|
45
|
+
export declare function cumsumSign(s: Sign): Sign;
|
|
46
|
+
/** cumprod: products of nonneg stay nonneg; products of positives stay
|
|
47
|
+
* positive; everything else (including alternating-sign negative
|
|
48
|
+
* inputs) is `unknown`. */
|
|
49
|
+
export declare function cumprodSign(s: Sign): Sign;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared reducer infrastructure for the `sum / prod / mean / min /
|
|
3
|
+
* max / any / all` family. Each builtin is a thin wrapper that
|
|
4
|
+
* supplies its kernel spec (init, op, finalize, sign rule, empty
|
|
5
|
+
* result) and lets this module drive transfer / codegen / arity.
|
|
6
|
+
*
|
|
7
|
+
* Numbl is the dialect oracle (see `../numbl/src/numbl-core/interpreter/
|
|
8
|
+
* builtins/reductions.ts`). The shape rules here mirror numbl's
|
|
9
|
+
* `shapeAfterReduction` against mtoc2's `DimInfo` lattice
|
|
10
|
+
* (`{exact, value}` / `unknown`) plus concrete `shape` when set.
|
|
11
|
+
*
|
|
12
|
+
* The lattice analysis is sharper than numbl's static type pass in one
|
|
13
|
+
* place worth flagging:
|
|
14
|
+
* - A `(unknown, 1, ..., 1)` dims signature (e.g. a slice
|
|
15
|
+
* `M(:, 2:3)` of a known-row-vector `M`) proves the output is
|
|
16
|
+
* scalar even though the leading dim's runtime length is unknown,
|
|
17
|
+
* because every later axis is statically `1`.
|
|
18
|
+
*
|
|
19
|
+
* Folding: when every input element is exact (scalar `t.exact: number`
|
|
20
|
+
* or tensor `t.exact: Float64Array`), the transfer computes the
|
|
21
|
+
* compile-time result. We cap the materialized result size at
|
|
22
|
+
* `EXACT_ARRAY_MAX_ELEMENTS`; beyond the cap the runtime path takes
|
|
23
|
+
* over.
|
|
24
|
+
*
|
|
25
|
+
* Out of scope: complex inputs, the `omitnan` / `includenan` flag,
|
|
26
|
+
* runtime (non-exact) integer `dim`, and multi-output
|
|
27
|
+
* `[v, i] = min(x)` — all rejected with span.
|
|
28
|
+
*/
|
|
29
|
+
import { type DimInfo, type NumericType, type Sign, type Type } from "../../../lowering/types.js";
|
|
30
|
+
import type { Builtin } from "../../registry.js";
|
|
31
|
+
/** What kind of reducer we're computing. Drives the kernel pieces
|
|
32
|
+
* (init / accumulator / finalizer / empty fallback / sign rule /
|
|
33
|
+
* result element type) without each builtin file rewriting the
|
|
34
|
+
* reduce loop. */
|
|
35
|
+
export interface KernelSpec {
|
|
36
|
+
/** Public source-level name (e.g. `"sum"`). */
|
|
37
|
+
name: string;
|
|
38
|
+
/** Position of the dim slot in the source-level arg list. For
|
|
39
|
+
* `sum/prod/mean/any/all`: slot 2 (`name(A, dim)`).
|
|
40
|
+
* For `min/max`: slot 3 (`name(A, [], dim)`). */
|
|
41
|
+
dimArgIndex: 1 | 2;
|
|
42
|
+
/** Identity / empty result. For scalar reducers (`sum`, `prod`,
|
|
43
|
+
* `mean`), the empty-data scalar (`0`, `1`, `NaN`). For
|
|
44
|
+
* logical reducers (`any`, `all`), 0 or 1. For NaN-seed
|
|
45
|
+
* reducers (`min`, `max`), `NaN`. */
|
|
46
|
+
emptyValue: number;
|
|
47
|
+
/** Accumulator step. NaN-aware (the impl skips NaN where
|
|
48
|
+
* appropriate). Receives the running accumulator and the next
|
|
49
|
+
* element; returns the new accumulator. */
|
|
50
|
+
step(acc: number, x: number, count: number): number;
|
|
51
|
+
/** Optional finalizer (e.g. mean divides by count). */
|
|
52
|
+
finalize?(acc: number, count: number): number;
|
|
53
|
+
/** Output element kind. `"double"` for sum/prod/mean/min/max,
|
|
54
|
+
* `"logical"` for any/all. */
|
|
55
|
+
outputElem: "double" | "logical";
|
|
56
|
+
/** Compute the sign of the result given the *input* type plus a
|
|
57
|
+
* flag indicating whether the reduced fiber is provably
|
|
58
|
+
* non-empty. */
|
|
59
|
+
resultSign(t: NumericType, nonEmpty: boolean): Sign;
|
|
60
|
+
}
|
|
61
|
+
export interface AxisAll {
|
|
62
|
+
kind: "all";
|
|
63
|
+
}
|
|
64
|
+
export interface AxisFixed {
|
|
65
|
+
kind: "fixed";
|
|
66
|
+
/** 1-based axis number, statically known. */
|
|
67
|
+
dim: number;
|
|
68
|
+
}
|
|
69
|
+
/** When no explicit dim was supplied, pick the reduction axis from
|
|
70
|
+
* the input's lattice. This is the sharp pass: a leading `unknown`
|
|
71
|
+
* followed only by `one` axes still proves the output is scalar
|
|
72
|
+
* (the leading axis MUST be the non-singleton one, or the whole
|
|
73
|
+
* tensor is `(1×1×…)`-shaped → scalar collapse anyway).
|
|
74
|
+
*
|
|
75
|
+
* Returns `all` for the degenerate `(1, 1, ...)` case (matches
|
|
76
|
+
* scalar input), `fixed(k)` for a clearly chosen axis, or throws
|
|
77
|
+
* for the genuinely ambiguous case (`unknown` leading dim followed
|
|
78
|
+
* by at least one known-non-1 or another `unknown`). */
|
|
79
|
+
export declare function chooseDefaultAxis(name: string, t: NumericType): AxisAll | AxisFixed;
|
|
80
|
+
/** Mirror of numbl's `shapeAfterReduction(shape, dim)` on a concrete
|
|
81
|
+
* shape. Returns either `{ scalar: true }` (every axis is 1 after
|
|
82
|
+
* the collapse) or `{ scalar: false, shape: [...] }`. */
|
|
83
|
+
export declare function reduceConcreteShape(shape: number[], dim: number): {
|
|
84
|
+
scalar: true;
|
|
85
|
+
} | {
|
|
86
|
+
scalar: false;
|
|
87
|
+
shape: number[];
|
|
88
|
+
};
|
|
89
|
+
/** Same as `reduceConcreteShape` but for the lattice form. Result
|
|
90
|
+
* is either `scalar` (every dim collapses to `one`) or a new dims
|
|
91
|
+
* array, post-squeeze. */
|
|
92
|
+
export declare function reduceLatticeDims(dims: DimInfo[], dim: number): {
|
|
93
|
+
scalar: true;
|
|
94
|
+
} | {
|
|
95
|
+
scalar: false;
|
|
96
|
+
dims: DimInfo[];
|
|
97
|
+
};
|
|
98
|
+
/** The transfer function. Returns the result type; throws with no
|
|
99
|
+
* span (framework's `withSpan` backfills at the call site). */
|
|
100
|
+
export declare function reductionTransfer(argTypes: Type[], spec: KernelSpec): Type;
|
|
101
|
+
export declare function reductionEmitJs(spec: {
|
|
102
|
+
name: string;
|
|
103
|
+
dimArgIndex: 1 | 2;
|
|
104
|
+
outputElem: "double" | "logical";
|
|
105
|
+
}): Builtin["emitJs"];
|
|
106
|
+
export declare function reductionCall(spec: {
|
|
107
|
+
name: string;
|
|
108
|
+
dimArgIndex: 1 | 2;
|
|
109
|
+
outputElem: "double" | "logical";
|
|
110
|
+
}): Builtin["call"];
|
|
111
|
+
export declare function reductionEmit(spec: {
|
|
112
|
+
name: string;
|
|
113
|
+
dimArgIndex: 1 | 2;
|
|
114
|
+
outputElem: "double" | "logical";
|
|
115
|
+
}): Builtin["emitC"];
|
|
116
|
+
/** Build a complete `Builtin` registration from a `KernelSpec`. */
|
|
117
|
+
export declare function defineReducer(spec: KernelSpec): Builtin;
|
|
118
|
+
export declare function sumSign(t: NumericType, nonEmpty: boolean): Sign;
|
|
119
|
+
export declare function meanSign(t: NumericType, nonEmpty: boolean): Sign;
|
|
120
|
+
export declare function prodSign(t: NumericType, nonEmpty: boolean): Sign;
|
|
121
|
+
/** Sign transfer for `min` and `max` reductions on a real fiber.
|
|
122
|
+
* min and max preserve the same sign classes: both stay in the
|
|
123
|
+
* half-line their input occupies (positive→positive,
|
|
124
|
+
* negative→negative, nonneg/zero→nonneg, nonpositive→nonpositive),
|
|
125
|
+
* so the two ops share one transfer. */
|
|
126
|
+
export declare function minMaxSign(t: NumericType, nonEmpty: boolean): Sign;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `var` / `std` reductions. Two-pass (mean, then mean-square-deviation),
|
|
3
|
+
* matching numbl's `varianceOf` (interpreter/builtins/reductions.ts):
|
|
4
|
+
*
|
|
5
|
+
* var(A) weight 0 (÷ n-1), reduce along the first non-singleton axis
|
|
6
|
+
* var(A, w) w ∈ {0, 1}: 0 ÷ (n-1), 1 ÷ n
|
|
7
|
+
* var(A, w, dim) reduce along axis `dim`
|
|
8
|
+
* var(A, w, 'all')reduce every element
|
|
9
|
+
* std(...) = sqrt(var(...))
|
|
10
|
+
*
|
|
11
|
+
* Real only. Complex input, vector weights, `omitnan`/`includenan`,
|
|
12
|
+
* the empty-weight `var(A, [], dim)` form, and runtime (non-exact) w/dim
|
|
13
|
+
* all decline to the interpreter. A scalar input yields 0 (numbl returns
|
|
14
|
+
* 0 for any scalar, regardless of value or weight).
|
|
15
|
+
*/
|
|
16
|
+
import type { Builtin } from "../../registry.js";
|
|
17
|
+
export declare function defineVariance(name: "var" | "std"): Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const all: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const any: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cummax: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cummin: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cumprod: import("../../registry.js").Builtin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cumsum: import("../../registry.js").Builtin;
|
|
@@ -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;
|