mathjs 13.0.0 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HISTORY.md +220 -468
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/function/matrix/eigs/complexEigs.js +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/matrix/DenseMatrix.js +1 -1
- package/lib/cjs/type/matrix/utils/broadcast.js +34 -64
- package/lib/cjs/type/matrix/utils/matrixAlgorithmSuite.js +20 -24
- package/lib/cjs/version.js +1 -1
- package/lib/esm/type/matrix/utils/broadcast.js +34 -63
- package/lib/esm/type/matrix/utils/matrixAlgorithmSuite.js +3 -7
- package/lib/esm/version.js +1 -1
- package/package.json +17 -16
- package/types/index.d.ts +32 -2
@@ -606,7 +606,7 @@ function createComplexEigs(_ref) {
|
|
606
606
|
b = randomOrthogonalVector(N, orthog, type);
|
607
607
|
try {
|
608
608
|
b = usolve(A, b);
|
609
|
-
} catch {
|
609
|
+
} catch (_unused) {
|
610
610
|
// That direction didn't work, likely because the original matrix
|
611
611
|
// was defective. But still make the full number of tries...
|
612
612
|
continue;
|
package/lib/cjs/header.js
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
* It features real and complex numbers, units, matrices, a large set of
|
7
7
|
* mathematical functions, and a flexible expression parser.
|
8
8
|
*
|
9
|
-
* @version 13.0.
|
10
|
-
* @date 2024-
|
9
|
+
* @version 13.0.1
|
10
|
+
* @date 2024-06-28
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
|
@@ -345,7 +345,7 @@ const createDenseMatrixClass = exports.createDenseMatrixClass = /* #__PURE__ */(
|
|
345
345
|
submatrix = (0, _array.broadcastTo)(submatrix, iSize);
|
346
346
|
}
|
347
347
|
sSize = (0, _array.arraySize)(submatrix);
|
348
|
-
} catch {}
|
348
|
+
} catch (_unused) {}
|
349
349
|
}
|
350
350
|
|
351
351
|
// validate dimensions
|
@@ -3,73 +3,43 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.broadcast = broadcast;
|
7
7
|
var _array = require("../../../utils/array.js");
|
8
|
-
var
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
*
|
19
|
-
* @param {Matrix} A First Matrix
|
20
|
-
* @param {Matrix} B Second Matrix
|
21
|
-
*
|
22
|
-
* @return {Matrix[]} [ broadcastedA, broadcastedB ]
|
23
|
-
*/
|
24
|
-
return function (A, B) {
|
25
|
-
const N = Math.max(A._size.length, B._size.length); // max number of dims
|
26
|
-
if (A._size.length === B._size.length) {
|
27
|
-
if (A._size.every((dim, i) => dim === B._size[i])) {
|
28
|
-
// If matrices have the same size return them
|
29
|
-
return [A, B];
|
30
|
-
}
|
31
|
-
}
|
32
|
-
const sizeA = _padLeft(A._size, N, 0); // pad to the left to align dimensions to the right
|
33
|
-
const sizeB = _padLeft(B._size, N, 0); // pad to the left to align dimensions to the right
|
8
|
+
var _object = require("../../../utils/object.js");
|
9
|
+
/**
|
10
|
+
* Broadcasts two matrices, and return both in an array
|
11
|
+
* It checks if it's possible with broadcasting rules
|
12
|
+
*
|
13
|
+
* @param {Matrix} A First Matrix
|
14
|
+
* @param {Matrix} B Second Matrix
|
15
|
+
*
|
16
|
+
* @return {Matrix[]} [ broadcastedA, broadcastedB ]
|
17
|
+
*/
|
34
18
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
// check if the broadcasting rules applyes for both matrices
|
42
|
-
(0, _array.checkBroadcastingRules)(sizeA, sizeMax);
|
43
|
-
(0, _array.checkBroadcastingRules)(sizeB, sizeMax);
|
19
|
+
function broadcast(A, B) {
|
20
|
+
if ((0, _object.deepStrictEqual)(A.size(), B.size())) {
|
21
|
+
// If matrices have the same size return them
|
22
|
+
return [A, B];
|
23
|
+
}
|
44
24
|
|
45
|
-
|
46
|
-
|
47
|
-
let BB = B.clone();
|
48
|
-
if (AA._size.length < N) {
|
49
|
-
AA.reshape(_padLeft(AA._size, N, 1));
|
50
|
-
} else if (BB._size.length < N) {
|
51
|
-
BB.reshape(_padLeft(BB._size, N, 1));
|
52
|
-
}
|
25
|
+
// calculate the broadcasted sizes
|
26
|
+
const newSize = (0, _array.broadcastSizes)(A.size(), B.size());
|
53
27
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
AA = _stretch(AA, sizeMax[dim], dim);
|
58
|
-
}
|
59
|
-
if (BB._size[dim] < sizeMax[dim]) {
|
60
|
-
BB = _stretch(BB, sizeMax[dim], dim);
|
61
|
-
}
|
62
|
-
}
|
28
|
+
// return the array with the two broadcasted matrices
|
29
|
+
return [A, B].map(M => _broadcastTo(M, newSize));
|
30
|
+
}
|
63
31
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
32
|
+
/**
|
33
|
+
* Broadcasts a matrix to the given size.
|
34
|
+
*
|
35
|
+
* @param {Matrix} M - The matrix to be broadcasted.
|
36
|
+
* @param {number[]} size - The desired size of the broadcasted matrix.
|
37
|
+
* @returns {Matrix} The broadcasted matrix.
|
38
|
+
* @throws {Error} If the size parameter is not an array of numbers.
|
39
|
+
*/
|
40
|
+
function _broadcastTo(M, size) {
|
41
|
+
if ((0, _object.deepStrictEqual)(M.size(), size)) {
|
42
|
+
return M;
|
74
43
|
}
|
75
|
-
|
44
|
+
return M.create((0, _array.broadcastTo)(M.valueOf(), size), M.datatype());
|
45
|
+
}
|
@@ -10,12 +10,11 @@ var _matAlgo13xDD = require("./matAlgo13xDD.js");
|
|
10
10
|
var _matAlgo14xDs = require("./matAlgo14xDs.js");
|
11
11
|
var _broadcast = require("./broadcast.js");
|
12
12
|
const name = 'matrixAlgorithmSuite';
|
13
|
-
const dependencies = ['typed', 'matrix'
|
13
|
+
const dependencies = ['typed', 'matrix'];
|
14
14
|
const createMatrixAlgorithmSuite = exports.createMatrixAlgorithmSuite = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
|
15
15
|
let {
|
16
16
|
typed,
|
17
|
-
matrix
|
18
|
-
concat
|
17
|
+
matrix
|
19
18
|
} = _ref;
|
20
19
|
const matAlgo13xDD = (0, _matAlgo13xDD.createMatAlgo13xDD)({
|
21
20
|
typed
|
@@ -23,9 +22,6 @@ const createMatrixAlgorithmSuite = exports.createMatrixAlgorithmSuite = /* #__PU
|
|
23
22
|
const matAlgo14xDs = (0, _matAlgo14xDs.createMatAlgo14xDs)({
|
24
23
|
typed
|
25
24
|
});
|
26
|
-
const broadcast = (0, _broadcast.createBroadcast)({
|
27
|
-
concat
|
28
|
-
});
|
29
25
|
|
30
26
|
/**
|
31
27
|
* Return a signatures object with the usual boilerplate of
|
@@ -51,60 +47,60 @@ const createMatrixAlgorithmSuite = exports.createMatrixAlgorithmSuite = /* #__PU
|
|
51
47
|
if (elop) {
|
52
48
|
// First the dense ones
|
53
49
|
matrixSignatures = {
|
54
|
-
'DenseMatrix, DenseMatrix': (x, y) => matAlgo13xDD(...broadcast(x, y), elop),
|
55
|
-
'Array, Array': (x, y) => matAlgo13xDD(...broadcast(matrix(x), matrix(y)), elop).valueOf(),
|
56
|
-
'Array, DenseMatrix': (x, y) => matAlgo13xDD(...broadcast(matrix(x), y), elop),
|
57
|
-
'DenseMatrix, Array': (x, y) => matAlgo13xDD(...broadcast(x, matrix(y)), elop)
|
50
|
+
'DenseMatrix, DenseMatrix': (x, y) => matAlgo13xDD(...(0, _broadcast.broadcast)(x, y), elop),
|
51
|
+
'Array, Array': (x, y) => matAlgo13xDD(...(0, _broadcast.broadcast)(matrix(x), matrix(y)), elop).valueOf(),
|
52
|
+
'Array, DenseMatrix': (x, y) => matAlgo13xDD(...(0, _broadcast.broadcast)(matrix(x), y), elop),
|
53
|
+
'DenseMatrix, Array': (x, y) => matAlgo13xDD(...(0, _broadcast.broadcast)(x, matrix(y)), elop)
|
58
54
|
};
|
59
55
|
// Now incorporate sparse matrices
|
60
56
|
if (options.SS) {
|
61
|
-
matrixSignatures['SparseMatrix, SparseMatrix'] = (x, y) => options.SS(...broadcast(x, y), elop, false);
|
57
|
+
matrixSignatures['SparseMatrix, SparseMatrix'] = (x, y) => options.SS(...(0, _broadcast.broadcast)(x, y), elop, false);
|
62
58
|
}
|
63
59
|
if (options.DS) {
|
64
|
-
matrixSignatures['DenseMatrix, SparseMatrix'] = (x, y) => options.DS(...broadcast(x, y), elop, false);
|
65
|
-
matrixSignatures['Array, SparseMatrix'] = (x, y) => options.DS(...broadcast(matrix(x), y), elop, false);
|
60
|
+
matrixSignatures['DenseMatrix, SparseMatrix'] = (x, y) => options.DS(...(0, _broadcast.broadcast)(x, y), elop, false);
|
61
|
+
matrixSignatures['Array, SparseMatrix'] = (x, y) => options.DS(...(0, _broadcast.broadcast)(matrix(x), y), elop, false);
|
66
62
|
}
|
67
63
|
if (SD) {
|
68
|
-
matrixSignatures['SparseMatrix, DenseMatrix'] = (x, y) => SD(...broadcast(y, x), elop, true);
|
69
|
-
matrixSignatures['SparseMatrix, Array'] = (x, y) => SD(...broadcast(matrix(y), x), elop, true);
|
64
|
+
matrixSignatures['SparseMatrix, DenseMatrix'] = (x, y) => SD(...(0, _broadcast.broadcast)(y, x), elop, true);
|
65
|
+
matrixSignatures['SparseMatrix, Array'] = (x, y) => SD(...(0, _broadcast.broadcast)(matrix(y), x), elop, true);
|
70
66
|
}
|
71
67
|
} else {
|
72
68
|
// No elop, use this
|
73
69
|
// First the dense ones
|
74
70
|
matrixSignatures = {
|
75
71
|
'DenseMatrix, DenseMatrix': typed.referToSelf(self => (x, y) => {
|
76
|
-
return matAlgo13xDD(...broadcast(x, y), self);
|
72
|
+
return matAlgo13xDD(...(0, _broadcast.broadcast)(x, y), self);
|
77
73
|
}),
|
78
74
|
'Array, Array': typed.referToSelf(self => (x, y) => {
|
79
|
-
return matAlgo13xDD(...broadcast(matrix(x), matrix(y)), self).valueOf();
|
75
|
+
return matAlgo13xDD(...(0, _broadcast.broadcast)(matrix(x), matrix(y)), self).valueOf();
|
80
76
|
}),
|
81
77
|
'Array, DenseMatrix': typed.referToSelf(self => (x, y) => {
|
82
|
-
return matAlgo13xDD(...broadcast(matrix(x), y), self);
|
78
|
+
return matAlgo13xDD(...(0, _broadcast.broadcast)(matrix(x), y), self);
|
83
79
|
}),
|
84
80
|
'DenseMatrix, Array': typed.referToSelf(self => (x, y) => {
|
85
|
-
return matAlgo13xDD(...broadcast(x, matrix(y)), self);
|
81
|
+
return matAlgo13xDD(...(0, _broadcast.broadcast)(x, matrix(y)), self);
|
86
82
|
})
|
87
83
|
};
|
88
84
|
// Now incorporate sparse matrices
|
89
85
|
if (options.SS) {
|
90
86
|
matrixSignatures['SparseMatrix, SparseMatrix'] = typed.referToSelf(self => (x, y) => {
|
91
|
-
return options.SS(...broadcast(x, y), self, false);
|
87
|
+
return options.SS(...(0, _broadcast.broadcast)(x, y), self, false);
|
92
88
|
});
|
93
89
|
}
|
94
90
|
if (options.DS) {
|
95
91
|
matrixSignatures['DenseMatrix, SparseMatrix'] = typed.referToSelf(self => (x, y) => {
|
96
|
-
return options.DS(...broadcast(x, y), self, false);
|
92
|
+
return options.DS(...(0, _broadcast.broadcast)(x, y), self, false);
|
97
93
|
});
|
98
94
|
matrixSignatures['Array, SparseMatrix'] = typed.referToSelf(self => (x, y) => {
|
99
|
-
return options.DS(...broadcast(matrix(x), y), self, false);
|
95
|
+
return options.DS(...(0, _broadcast.broadcast)(matrix(x), y), self, false);
|
100
96
|
});
|
101
97
|
}
|
102
98
|
if (SD) {
|
103
99
|
matrixSignatures['SparseMatrix, DenseMatrix'] = typed.referToSelf(self => (x, y) => {
|
104
|
-
return SD(...broadcast(y, x), self, true);
|
100
|
+
return SD(...(0, _broadcast.broadcast)(y, x), self, true);
|
105
101
|
});
|
106
102
|
matrixSignatures['SparseMatrix, Array'] = typed.referToSelf(self => (x, y) => {
|
107
|
-
return SD(...broadcast(matrix(y), x), self, true);
|
103
|
+
return SD(...(0, _broadcast.broadcast)(matrix(y), x), self, true);
|
108
104
|
});
|
109
105
|
}
|
110
106
|
}
|
package/lib/cjs/version.js
CHANGED
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.version = void 0;
|
7
|
-
const version = exports.version = '13.0.
|
7
|
+
const version = exports.version = '13.0.1';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
@@ -1,69 +1,40 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
var name = 'broadcast';
|
4
|
-
var dependancies = ['concat'];
|
5
|
-
export var createBroadcast = /* #__PURE__ */factory(name, dependancies, _ref => {
|
6
|
-
var {
|
7
|
-
concat
|
8
|
-
} = _ref;
|
9
|
-
/**
|
10
|
-
* Broadcasts two matrices, and return both in an array
|
11
|
-
* It checks if it's possible with broadcasting rules
|
12
|
-
*
|
13
|
-
* @param {Matrix} A First Matrix
|
14
|
-
* @param {Matrix} B Second Matrix
|
15
|
-
*
|
16
|
-
* @return {Matrix[]} [ broadcastedA, broadcastedB ]
|
17
|
-
*/
|
18
|
-
return function (A, B) {
|
19
|
-
var N = Math.max(A._size.length, B._size.length); // max number of dims
|
20
|
-
if (A._size.length === B._size.length) {
|
21
|
-
if (A._size.every((dim, i) => dim === B._size[i])) {
|
22
|
-
// If matrices have the same size return them
|
23
|
-
return [A, B];
|
24
|
-
}
|
25
|
-
}
|
26
|
-
var sizeA = _padLeft(A._size, N, 0); // pad to the left to align dimensions to the right
|
27
|
-
var sizeB = _padLeft(B._size, N, 0); // pad to the left to align dimensions to the right
|
1
|
+
import { broadcastSizes, broadcastTo } from '../../../utils/array.js';
|
2
|
+
import { deepStrictEqual } from '../../../utils/object.js';
|
28
3
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
4
|
+
/**
|
5
|
+
* Broadcasts two matrices, and return both in an array
|
6
|
+
* It checks if it's possible with broadcasting rules
|
7
|
+
*
|
8
|
+
* @param {Matrix} A First Matrix
|
9
|
+
* @param {Matrix} B Second Matrix
|
10
|
+
*
|
11
|
+
* @return {Matrix[]} [ broadcastedA, broadcastedB ]
|
12
|
+
*/
|
34
13
|
|
35
|
-
|
36
|
-
|
37
|
-
|
14
|
+
export function broadcast(A, B) {
|
15
|
+
if (deepStrictEqual(A.size(), B.size())) {
|
16
|
+
// If matrices have the same size return them
|
17
|
+
return [A, B];
|
18
|
+
}
|
38
19
|
|
39
|
-
|
40
|
-
|
41
|
-
var BB = B.clone();
|
42
|
-
if (AA._size.length < N) {
|
43
|
-
AA.reshape(_padLeft(AA._size, N, 1));
|
44
|
-
} else if (BB._size.length < N) {
|
45
|
-
BB.reshape(_padLeft(BB._size, N, 1));
|
46
|
-
}
|
20
|
+
// calculate the broadcasted sizes
|
21
|
+
var newSize = broadcastSizes(A.size(), B.size());
|
47
22
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
AA = _stretch(AA, sizeMax[_dim], _dim);
|
52
|
-
}
|
53
|
-
if (BB._size[_dim] < sizeMax[_dim]) {
|
54
|
-
BB = _stretch(BB, sizeMax[_dim], _dim);
|
55
|
-
}
|
56
|
-
}
|
23
|
+
// return the array with the two broadcasted matrices
|
24
|
+
return [A, B].map(M => _broadcastTo(M, newSize));
|
25
|
+
}
|
57
26
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
27
|
+
/**
|
28
|
+
* Broadcasts a matrix to the given size.
|
29
|
+
*
|
30
|
+
* @param {Matrix} M - The matrix to be broadcasted.
|
31
|
+
* @param {number[]} size - The desired size of the broadcasted matrix.
|
32
|
+
* @returns {Matrix} The broadcasted matrix.
|
33
|
+
* @throws {Error} If the size parameter is not an array of numbers.
|
34
|
+
*/
|
35
|
+
function _broadcastTo(M, size) {
|
36
|
+
if (deepStrictEqual(M.size(), size)) {
|
37
|
+
return M;
|
68
38
|
}
|
69
|
-
|
39
|
+
return M.create(broadcastTo(M.valueOf(), size), M.datatype());
|
40
|
+
}
|
@@ -2,14 +2,13 @@ import { factory } from '../../../utils/factory.js';
|
|
2
2
|
import { extend } from '../../../utils/object.js';
|
3
3
|
import { createMatAlgo13xDD } from './matAlgo13xDD.js';
|
4
4
|
import { createMatAlgo14xDs } from './matAlgo14xDs.js';
|
5
|
-
import {
|
5
|
+
import { broadcast } from './broadcast.js';
|
6
6
|
var name = 'matrixAlgorithmSuite';
|
7
|
-
var dependencies = ['typed', 'matrix'
|
7
|
+
var dependencies = ['typed', 'matrix'];
|
8
8
|
export var createMatrixAlgorithmSuite = /* #__PURE__ */factory(name, dependencies, _ref => {
|
9
9
|
var {
|
10
10
|
typed,
|
11
|
-
matrix
|
12
|
-
concat
|
11
|
+
matrix
|
13
12
|
} = _ref;
|
14
13
|
var matAlgo13xDD = createMatAlgo13xDD({
|
15
14
|
typed
|
@@ -17,9 +16,6 @@ export var createMatrixAlgorithmSuite = /* #__PURE__ */factory(name, dependencie
|
|
17
16
|
var matAlgo14xDs = createMatAlgo14xDs({
|
18
17
|
typed
|
19
18
|
});
|
20
|
-
var broadcast = createBroadcast({
|
21
|
-
concat
|
22
|
-
});
|
23
19
|
|
24
20
|
/**
|
25
21
|
* Return a signatures object with the usual boilerplate of
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "13.0.
|
3
|
+
"version": "13.0.1",
|
4
4
|
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
|
5
5
|
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
|
6
6
|
"homepage": "https://mathjs.org",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"unit"
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
|
-
"@babel/runtime": "^7.24.
|
28
|
+
"@babel/runtime": "^7.24.7",
|
29
29
|
"complex.js": "^2.1.1",
|
30
30
|
"decimal.js": "^10.4.3",
|
31
31
|
"escape-latex": "^1.2.0",
|
@@ -33,22 +33,23 @@
|
|
33
33
|
"javascript-natural-sort": "^0.7.1",
|
34
34
|
"seedrandom": "^3.0.5",
|
35
35
|
"tiny-emitter": "^2.1.0",
|
36
|
-
"typed-function": "^4.
|
36
|
+
"typed-function": "^4.2.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.24.
|
40
|
-
"@babel/plugin-transform-object-assign": "7.24.
|
41
|
-
"@babel/plugin-transform-
|
42
|
-
"@babel/
|
39
|
+
"@babel/core": "7.24.7",
|
40
|
+
"@babel/plugin-transform-object-assign": "7.24.7",
|
41
|
+
"@babel/plugin-transform-optional-catch-binding": "7.24.7",
|
42
|
+
"@babel/plugin-transform-runtime": "7.24.7",
|
43
|
+
"@babel/preset-env": "7.24.7",
|
43
44
|
"@babel/register": "7.24.6",
|
44
45
|
"@types/assert": "1.5.10",
|
45
|
-
"@types/mocha": "10.0.
|
46
|
-
"@typescript-eslint/eslint-plugin": "7.
|
47
|
-
"@typescript-eslint/parser": "7.
|
46
|
+
"@types/mocha": "10.0.7",
|
47
|
+
"@typescript-eslint/eslint-plugin": "7.14.1",
|
48
|
+
"@typescript-eslint/parser": "7.14.1",
|
48
49
|
"assert": "2.1.0",
|
49
50
|
"babel-loader": "9.1.3",
|
50
51
|
"benchmark": "2.1.4",
|
51
|
-
"c8": "
|
52
|
+
"c8": "10.1.2",
|
52
53
|
"codecov": "3.8.3",
|
53
54
|
"core-js": "3.37.1",
|
54
55
|
"del": "7.1.0",
|
@@ -64,7 +65,7 @@
|
|
64
65
|
"expect-type": "0.19.0",
|
65
66
|
"expr-eval": "2.0.2",
|
66
67
|
"fancy-log": "2.0.0",
|
67
|
-
"glob": "10.4.
|
68
|
+
"glob": "10.4.2",
|
68
69
|
"gulp": "5.0.0",
|
69
70
|
"gulp-babel": "8.0.0",
|
70
71
|
"handlebars": "4.7.8",
|
@@ -76,7 +77,7 @@
|
|
76
77
|
"karma-mocha-reporter": "2.2.5",
|
77
78
|
"karma-webpack": "5.0.1",
|
78
79
|
"mkdirp": "3.0.1",
|
79
|
-
"mocha": "10.
|
80
|
+
"mocha": "10.5.2",
|
80
81
|
"mocha-junit-reporter": "2.2.1",
|
81
82
|
"ndarray": "1.0.19",
|
82
83
|
"ndarray-determinant": "1.0.0",
|
@@ -85,13 +86,13 @@
|
|
85
86
|
"ndarray-pack": "1.2.1",
|
86
87
|
"numericjs": "1.2.6",
|
87
88
|
"pad-right": "0.2.2",
|
88
|
-
"prettier": "3.2
|
89
|
+
"prettier": "3.3.2",
|
89
90
|
"process": "0.11.10",
|
90
91
|
"sinon": "18.0.0",
|
91
92
|
"sylvester": "0.0.21",
|
92
93
|
"ts-node": "10.9.2",
|
93
|
-
"typescript": "5.
|
94
|
-
"webpack": "5.
|
94
|
+
"typescript": "5.5.2",
|
95
|
+
"webpack": "5.92.1",
|
95
96
|
"zeros": "1.0.0"
|
96
97
|
},
|
97
98
|
"type": "module",
|
package/types/index.d.ts
CHANGED
@@ -4292,14 +4292,44 @@ export interface MathNode {
|
|
4292
4292
|
}
|
4293
4293
|
|
4294
4294
|
export interface Parser {
|
4295
|
+
/**
|
4296
|
+
* Evaluate an expression. Returns the result of the expression.
|
4297
|
+
* @param expr The expression to evaluate
|
4298
|
+
*/
|
4295
4299
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4296
4300
|
evaluate(expr: string | string[]): any
|
4301
|
+
/**
|
4302
|
+
* Retrieve a variable or function from the parser’s scope.
|
4303
|
+
* @param name The name of the variable or function to be retrieved
|
4304
|
+
*/
|
4297
4305
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4298
|
-
get(
|
4306
|
+
get(name: string): any
|
4307
|
+
/**
|
4308
|
+
* Retrieve an object with all defined variables in the parser’s scope.
|
4309
|
+
* @returns An object with all defined variables
|
4310
|
+
*/
|
4299
4311
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4300
4312
|
getAll(): { [key: string]: any }
|
4313
|
+
/**
|
4314
|
+
* Retrieve a map with all defined variables in the parser’s scope.
|
4315
|
+
*/
|
4301
4316
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4302
|
-
|
4317
|
+
getAllAsMap(): Map<string, any>
|
4318
|
+
/**
|
4319
|
+
* Set a variable or function in the parser’s scope.
|
4320
|
+
* @param name The name of the variable or function to be set
|
4321
|
+
* @param value The value of the variable or function to be set
|
4322
|
+
*/
|
4323
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4324
|
+
set: (name: string, value: any) => void
|
4325
|
+
/**
|
4326
|
+
* Remove a variable or function from the parser’s scope.
|
4327
|
+
* @param name The name of the variable or function to be removed
|
4328
|
+
*/
|
4329
|
+
remove: (name: string) => void
|
4330
|
+
/**
|
4331
|
+
* Completely clear the parser’s scope.
|
4332
|
+
*/
|
4303
4333
|
clear: () => void
|
4304
4334
|
}
|
4305
4335
|
|