numbl 0.4.1 → 0.4.3
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/dist-cli/cli.js +1225 -49
- package/dist-lib/graphics/axisLimits.d.ts +23 -0
- package/dist-lib/graphics/figuresReducer.d.ts +73 -0
- package/dist-lib/graphics/types.d.ts +17 -0
- package/dist-lib/lib.js +1224 -48
- package/dist-lib/numbl-core/helpers/effectively-real.d.ts +25 -0
- package/dist-lib/numbl-core/helpers/eigs-select.d.ts +25 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_imag_all_zero.d.ts +1 -0
- package/dist-lib/numbl-core/runtime/axisCommand.d.ts +34 -0
- package/dist-lib/numbl-core/runtime/runtime.d.ts +5 -0
- package/dist-lib/numbl-core/version.d.ts +1 -1
- package/dist-plot-viewer/assets/index-ClpZQuMR.js +4426 -0
- package/dist-plot-viewer/index.html +1 -1
- package/dist-site-viewer/assets/index-CgKjTQT7.js +4748 -0
- package/dist-site-viewer/assets/{numbl-worker-CkoM4MUa.js → numbl-worker-DarsHbBe.js} +297 -140
- package/dist-site-viewer/index.html +1 -1
- package/package.json +1 -1
- package/dist-plot-viewer/assets/index-DfxsWeyf.js +0 -4426
- package/dist-site-viewer/assets/index-C5c2lKAx.js +0 -4748
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Effectively real" helpers.
|
|
3
|
+
*
|
|
4
|
+
* numbl's JIT cannot always prove at compile time that the result of an
|
|
5
|
+
* operation is real (e.g. `sqrt(1 - x.^2/2)` — the argument's sign is not
|
|
6
|
+
* statically provable, so `sqrt` lifts to the complex path). The result is
|
|
7
|
+
* a complex-typed tensor whose imaginary lane is entirely zero — an
|
|
8
|
+
* artifact of static typing, not a value the user asked to be complex.
|
|
9
|
+
*
|
|
10
|
+
* Value-sensitive builtins (`isreal`, `min`, `max`, `sort`, …) must treat
|
|
11
|
+
* such a tensor exactly as they would a real one: otherwise `min`/`max`
|
|
12
|
+
* silently switch to magnitude ordering and `isreal` reports `false`,
|
|
13
|
+
* diverging from the interpreter (`--opt 0`, which never creates the
|
|
14
|
+
* artifact) and from MATLAB on real data. These helpers detect the
|
|
15
|
+
* all-zero imaginary lane and drop it so the real code path runs.
|
|
16
|
+
*/
|
|
17
|
+
import type { RuntimeValue } from "../runtime/index.js";
|
|
18
|
+
import { type RuntimeTensor } from "../runtime/types.js";
|
|
19
|
+
/** True when `imag` is absent or every element is exactly zero. */
|
|
20
|
+
export declare function imagAllZero(imag: ArrayLike<number> | undefined): boolean;
|
|
21
|
+
/** If `t` carries an all-zero imaginary lane, return a real view sharing
|
|
22
|
+
* its data; otherwise return `t` unchanged. */
|
|
23
|
+
export declare function stripZeroImagTensor(t: RuntimeTensor): RuntimeTensor;
|
|
24
|
+
/** Tensor-aware variant for the generic `RuntimeValue` channel. */
|
|
25
|
+
export declare function stripZeroImagValue(v: RuntimeValue): RuntimeValue;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection + ordering logic for `eigs` (a subset of eigenvalues).
|
|
3
|
+
*
|
|
4
|
+
* `eigs` in numbl piggybacks on the dense `eig`: the runtime computes every
|
|
5
|
+
* eigenvalue, then this module picks the requested `k` of them according to
|
|
6
|
+
* `sigma` and returns their original indices in the order `eigs` reports
|
|
7
|
+
* them. It is pure (operates on plain number arrays) so it can be unit
|
|
8
|
+
* tested without the runtime.
|
|
9
|
+
*/
|
|
10
|
+
export type SigmaKind = "largestabs" | "smallestabs" | "largestreal" | "smallestreal" | "bothendsreal" | "largestimag" | "smallestimag" | "bothendsimag";
|
|
11
|
+
export type SigmaSpec = {
|
|
12
|
+
kind: SigmaKind;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "scalar";
|
|
15
|
+
re: number;
|
|
16
|
+
im: number;
|
|
17
|
+
};
|
|
18
|
+
/** Map a text sigma value to a canonical kind, or `null` if unrecognized. */
|
|
19
|
+
export declare function normalizeSigmaString(s: string): SigmaKind | null;
|
|
20
|
+
/**
|
|
21
|
+
* Pick `k` eigenvalues (by original index) and return them in the order
|
|
22
|
+
* `eigs` reports for the given `sigma`. `re`/`im` are the real/imaginary
|
|
23
|
+
* parts of all `n` eigenvalues.
|
|
24
|
+
*/
|
|
25
|
+
export declare function selectEigsIndices(re: number[], im: number[], k: number, sigma: SigmaSpec): number[];
|
|
@@ -44,6 +44,7 @@ export * from "./tensor_ops/tensor_eye.js";
|
|
|
44
44
|
export * from "./tensor_ops/tensor_fill_nd.js";
|
|
45
45
|
export * from "./tensor_ops/tensor_fill_square.js";
|
|
46
46
|
export * from "./tensor_ops/tensor_flip.js";
|
|
47
|
+
export * from "./tensor_ops/tensor_imag_all_zero.js";
|
|
47
48
|
export * from "./tensor_ops/tensor_linspace.js";
|
|
48
49
|
export * from "./tensor_ops/tensor_logical_real.js";
|
|
49
50
|
export * from "./tensor_ops/tensor_logspace.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function mtoc2_tensor_imag_all_zero(a: any): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `axis(...)` argument parsing — the single place that turns every `axis`
|
|
3
|
+
* call form into `PlotInstruction`s.
|
|
4
|
+
*
|
|
5
|
+
* Supported forms (evaluated left to right, later options overriding earlier
|
|
6
|
+
* ones):
|
|
7
|
+
* - a limit vector `[xmin xmax ymin ymax (zmin zmax (cmin cmax))]`, where a
|
|
8
|
+
* non-finite bound (`inf`/`-inf`) leaves that bound automatic;
|
|
9
|
+
* - a scalar `0/1` or logical `false/true` toggling axes visibility;
|
|
10
|
+
* - a style word (`tight`, `padded`, `fill`, `equal`, `image`, `square`,
|
|
11
|
+
* `vis3d`, `normal`, `tickaligned`);
|
|
12
|
+
* - a limit mode (`manual`, `auto`, `'auto x'`, `'auto y'`, `'auto z'`,
|
|
13
|
+
* `'auto xy'`, `'auto xz'`, `'auto yz'`);
|
|
14
|
+
* - a y-direction (`xy`, `ij`);
|
|
15
|
+
* - a visibility word (`on`, `off`).
|
|
16
|
+
*
|
|
17
|
+
* A leading axes handle (numbl has no real axes handles) is accepted and
|
|
18
|
+
* skipped, so `axis(ax, ...)` works. The query forms `lim = axis` /
|
|
19
|
+
* `lim = axis(ax)` carry no setting argument; the runtime detects them via
|
|
20
|
+
* the `false` return value and computes the limits separately.
|
|
21
|
+
*/
|
|
22
|
+
import type { RuntimeValue } from "./types.js";
|
|
23
|
+
import type { PlotInstruction } from "../../graphics/types.js";
|
|
24
|
+
/**
|
|
25
|
+
* Process an `axis(...)` call, pushing instructions onto `instructions`.
|
|
26
|
+
*
|
|
27
|
+
* @param freezeLimits Optional provider of the current limit vector
|
|
28
|
+
* `[xmin xmax ymin ymax (zmin zmax)]`, used to implement `axis manual`
|
|
29
|
+
* (freeze the current limits). When omitted, `axis manual` records the
|
|
30
|
+
* request without concrete values.
|
|
31
|
+
* @returns `true` if any setting was applied. `false` means the call carried
|
|
32
|
+
* no setting argument (a query, e.g. `lim = axis`).
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyAxisCommand(args: RuntimeValue[], instructions: PlotInstruction[], freezeLimits?: () => number[]): boolean;
|
|
@@ -308,6 +308,11 @@ export declare class Runtime {
|
|
|
308
308
|
nargoutchk(actualNargout: unknown, minArgs: unknown, maxArgs: unknown): void;
|
|
309
309
|
/** Read the hold state, for `ishold()` queries. */
|
|
310
310
|
ishold(): RuntimeValue;
|
|
311
|
+
/** Current axis limits of the active axes, as MATLAB's `axis` query
|
|
312
|
+
* returns them: `[xmin xmax ymin ymax]` (2-D) or with `zmin zmax`
|
|
313
|
+
* appended (3-D). Reduces the accumulated plot instructions into a figure
|
|
314
|
+
* state and reads the current axes' explicit/data-derived limits. */
|
|
315
|
+
currentAxisLimits(): number[];
|
|
311
316
|
drawnow(): void;
|
|
312
317
|
pause(seconds: unknown): void;
|
|
313
318
|
readInput(prompt: string): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Numbl version, used for JIT disk cache invalidation. */
|
|
2
|
-
export declare const NUMBL_VERSION = "0.4.
|
|
2
|
+
export declare const NUMBL_VERSION = "0.4.3";
|