mathjs 12.4.0 → 12.4.2
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +22 -0
- package/README.md +28 -0
- package/bin/cli.js +1 -1
- package/bin/repl.js +1 -1
- 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/core/create.js +3 -3
- package/lib/cjs/defaultInstance.js +1 -1
- package/lib/cjs/entry/allFactoriesAny.js +1 -1
- package/lib/cjs/entry/allFactoriesNumber.js +1 -1
- package/lib/cjs/expression/node/AccessorNode.js +2 -3
- package/lib/cjs/expression/node/ArrayNode.js +2 -3
- package/lib/cjs/expression/node/AssignmentNode.js +2 -3
- package/lib/cjs/expression/node/BlockNode.js +2 -3
- package/lib/cjs/expression/node/ConditionalNode.js +2 -3
- package/lib/cjs/expression/node/ConstantNode.js +7 -6
- package/lib/cjs/expression/node/FunctionAssignmentNode.js +2 -3
- package/lib/cjs/expression/node/FunctionNode.js +5 -6
- package/lib/cjs/expression/node/IndexNode.js +2 -3
- package/lib/cjs/expression/node/Node.js +1 -2
- package/lib/cjs/expression/node/ObjectNode.js +2 -3
- package/lib/cjs/expression/node/OperatorNode.js +2 -3
- package/lib/cjs/expression/node/ParenthesisNode.js +2 -3
- package/lib/cjs/expression/node/RangeNode.js +2 -3
- package/lib/cjs/expression/node/RelationalNode.js +2 -3
- package/lib/cjs/expression/node/SymbolNode.js +2 -3
- package/lib/cjs/function/algebra/simplifyCore.js +3 -0
- package/lib/cjs/function/algebra/sparse/csAmd.js +4 -2
- package/lib/cjs/function/algebra/sparse/csChol.js +4 -2
- package/lib/cjs/function/algebra/sparse/csCounts.js +4 -2
- package/lib/cjs/function/algebra/sparse/csCumsum.js +4 -2
- package/lib/cjs/function/algebra/sparse/csDfs.js +4 -2
- package/lib/cjs/function/algebra/sparse/csEreach.js +4 -2
- package/lib/cjs/function/algebra/sparse/csEtree.js +4 -2
- package/lib/cjs/function/algebra/sparse/csFkeep.js +4 -2
- package/lib/cjs/function/algebra/sparse/csFlip.js +4 -2
- package/lib/cjs/function/algebra/sparse/csIpvec.js +4 -0
- package/lib/cjs/function/algebra/sparse/csLeaf.js +4 -2
- package/lib/cjs/function/algebra/sparse/csLu.js +4 -2
- package/lib/cjs/function/algebra/sparse/csMark.js +4 -2
- package/lib/cjs/function/algebra/sparse/csMarked.js +4 -2
- package/lib/cjs/function/algebra/sparse/csPermute.js +4 -2
- package/lib/cjs/function/algebra/sparse/csPost.js +4 -2
- package/lib/cjs/function/algebra/sparse/csReach.js +4 -2
- package/lib/cjs/function/algebra/sparse/csSpsolve.js +4 -2
- package/lib/cjs/function/algebra/sparse/csSqr.js +4 -2
- package/lib/cjs/function/algebra/sparse/csSymperm.js +4 -2
- package/lib/cjs/function/algebra/sparse/csTdfs.js +4 -2
- package/lib/cjs/function/algebra/sparse/csUnflip.js +4 -2
- package/lib/cjs/function/utils/isNaN.js +5 -3
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/unit/Unit.js +6 -2
- package/lib/cjs/utils/map.js +2 -4
- package/lib/cjs/utils/object.js +0 -6
- package/lib/cjs/utils/snapshot.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/core/create.js +3 -3
- package/lib/esm/expression/node/ConstantNode.js +5 -3
- package/lib/esm/expression/node/FunctionNode.js +3 -3
- package/lib/esm/function/algebra/simplifyCore.js +3 -0
- package/lib/esm/function/algebra/sparse/csAmd.js +3 -2
- package/lib/esm/function/algebra/sparse/csChol.js +3 -2
- package/lib/esm/function/algebra/sparse/csCounts.js +3 -2
- package/lib/esm/function/algebra/sparse/csCumsum.js +4 -2
- package/lib/esm/function/algebra/sparse/csDfs.js +3 -2
- package/lib/esm/function/algebra/sparse/csEreach.js +3 -2
- package/lib/esm/function/algebra/sparse/csEtree.js +4 -2
- package/lib/esm/function/algebra/sparse/csFkeep.js +4 -2
- package/lib/esm/function/algebra/sparse/csFlip.js +4 -2
- package/lib/esm/function/algebra/sparse/csIpvec.js +4 -0
- package/lib/esm/function/algebra/sparse/csLeaf.js +4 -2
- package/lib/esm/function/algebra/sparse/csLu.js +4 -2
- package/lib/esm/function/algebra/sparse/csMark.js +4 -2
- package/lib/esm/function/algebra/sparse/csMarked.js +4 -2
- package/lib/esm/function/algebra/sparse/csPermute.js +4 -2
- package/lib/esm/function/algebra/sparse/csPost.js +3 -2
- package/lib/esm/function/algebra/sparse/csReach.js +4 -2
- package/lib/esm/function/algebra/sparse/csSpsolve.js +3 -2
- package/lib/esm/function/algebra/sparse/csSqr.js +3 -2
- package/lib/esm/function/algebra/sparse/csSymperm.js +3 -2
- package/lib/esm/function/algebra/sparse/csTdfs.js +4 -2
- package/lib/esm/function/algebra/sparse/csUnflip.js +3 -2
- package/lib/esm/function/utils/isNaN.js +1 -3
- package/lib/esm/type/unit/Unit.js +6 -2
- package/lib/esm/utils/object.js +0 -3
- package/lib/esm/version.js +1 -1
- package/package.json +18 -18
- package/types/index.d.ts +4 -0
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.csEreach = csEreach;
|
7
7
|
var _csMark = require("./csMark.js");
|
8
8
|
var _csMarked = require("./csMarked.js");
|
9
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
10
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
11
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
12
|
+
|
9
13
|
/**
|
10
14
|
* Find nonzero pattern of Cholesky L(k,1:k-1) using etree and triu(A(:,k))
|
11
15
|
*
|
@@ -16,8 +20,6 @@ var _csMarked = require("./csMarked.js");
|
|
16
20
|
* The first n entries is the nonzero pattern, the last n entries is the stack
|
17
21
|
*
|
18
22
|
* @return {Number} The index for the nonzero pattern
|
19
|
-
*
|
20
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
21
23
|
*/
|
22
24
|
function csEreach(a, k, parent, w) {
|
23
25
|
// a arrays
|
@@ -4,14 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csEtree = csEtree;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* Computes the elimination tree of Matrix A (using triu(A)) or the
|
9
13
|
* elimination tree of A'A without forming A'A.
|
10
14
|
*
|
11
15
|
* @param {Matrix} a The A Matrix
|
12
16
|
* @param {boolean} ata A value of true the function computes the etree of A'A
|
13
|
-
*
|
14
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
15
17
|
*/
|
16
18
|
function csEtree(a, ata) {
|
17
19
|
// check inputs
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csFkeep = csFkeep;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* Keeps entries in the matrix when the callback function returns true, removes the entry otherwise
|
9
13
|
*
|
@@ -16,8 +20,6 @@ exports.csFkeep = csFkeep;
|
|
16
20
|
* @param {any} other The state
|
17
21
|
*
|
18
22
|
* @return The number of nonzero elements in the matrix
|
19
|
-
*
|
20
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
21
23
|
*/
|
22
24
|
function csFkeep(a, callback, other) {
|
23
25
|
// a arrays
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csFlip = csFlip;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* This function "flips" its input about the integer -1.
|
9
13
|
*
|
10
14
|
* @param {Number} i The value to flip
|
11
|
-
*
|
12
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
13
15
|
*/
|
14
16
|
function csFlip(i) {
|
15
17
|
// flip the value
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csIpvec = csIpvec;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* Permutes a vector; x = P'b. In MATLAB notation, x(p)=b.
|
9
13
|
*
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csLeaf = csLeaf;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* This function determines if j is a leaf of the ith row subtree.
|
9
13
|
* Consider A(i,j), node j in ith row subtree and return lca(jprev,j)
|
@@ -17,8 +21,6 @@ exports.csLeaf = csLeaf;
|
|
17
21
|
* @param {Number} ancestor The index offset within the workspace for the ancestor array
|
18
22
|
*
|
19
23
|
* @return {Object}
|
20
|
-
*
|
21
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
22
24
|
*/
|
23
25
|
function csLeaf(i, j, w, first, maxfirst, prevleaf, ancestor) {
|
24
26
|
var s, sparent;
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.createCsLu = void 0;
|
7
7
|
var _factory = require("../../../utils/factory.js");
|
8
8
|
var _csSpsolve = require("./csSpsolve.js");
|
9
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
10
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
11
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
12
|
+
|
9
13
|
var name = 'csLu';
|
10
14
|
var dependencies = ['abs', 'divideScalar', 'multiply', 'subtract', 'larger', 'largerEq', 'SparseMatrix'];
|
11
15
|
var createCsLu = exports.createCsLu = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -34,8 +38,6 @@ var createCsLu = exports.createCsLu = /* #__PURE__ */(0, _factory.factory)(name,
|
|
34
38
|
* @param {Number} tol Partial pivoting threshold (1 for partial pivoting)
|
35
39
|
*
|
36
40
|
* @return {Number} The numeric LU factorization of A or null
|
37
|
-
*
|
38
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
39
41
|
*/
|
40
42
|
return function csLu(m, s, tol) {
|
41
43
|
// validate input
|
@@ -5,13 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.csMark = csMark;
|
7
7
|
var _csFlip = require("./csFlip.js");
|
8
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
9
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
10
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
11
|
+
|
8
12
|
/**
|
9
13
|
* Marks the node at w[j]
|
10
14
|
*
|
11
15
|
* @param {Array} w The array
|
12
16
|
* @param {Number} j The array index
|
13
|
-
*
|
14
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
15
17
|
*/
|
16
18
|
function csMark(w, j) {
|
17
19
|
// mark w[j]
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csMarked = csMarked;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* Checks if the node at w[j] is marked
|
9
13
|
*
|
10
14
|
* @param {Array} w The array
|
11
15
|
* @param {Number} j The array index
|
12
|
-
*
|
13
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
14
16
|
*/
|
15
17
|
function csMarked(w, j) {
|
16
18
|
// check node is marked
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csPermute = csPermute;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* Permutes a sparse matrix C = P * A * Q
|
9
13
|
*
|
@@ -13,8 +17,6 @@ exports.csPermute = csPermute;
|
|
13
17
|
* @param {boolean} values Create a pattern matrix (false), values and pattern otherwise
|
14
18
|
*
|
15
19
|
* @return {Matrix} C = P * A * Q, null on error
|
16
|
-
*
|
17
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
18
20
|
*/
|
19
21
|
function csPermute(a, pinv, q, values) {
|
20
22
|
// a arrays
|
@@ -5,13 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.csPost = csPost;
|
7
7
|
var _csTdfs = require("./csTdfs.js");
|
8
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
9
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
10
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
11
|
+
|
8
12
|
/**
|
9
13
|
* Post order a tree of forest
|
10
14
|
*
|
11
15
|
* @param {Array} parent The tree or forest
|
12
16
|
* @param {Number} n Number of columns
|
13
|
-
*
|
14
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
15
17
|
*/
|
16
18
|
function csPost(parent, n) {
|
17
19
|
// check inputs
|
@@ -7,6 +7,10 @@ exports.csReach = csReach;
|
|
7
7
|
var _csMarked = require("./csMarked.js");
|
8
8
|
var _csMark = require("./csMark.js");
|
9
9
|
var _csDfs = require("./csDfs.js");
|
10
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
11
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
12
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
13
|
+
|
10
14
|
/**
|
11
15
|
* The csReach function computes X = Reach(B), where B is the nonzero pattern of the n-by-1
|
12
16
|
* sparse column of vector b. The function returns the set of nodes reachable from any node in B. The
|
@@ -20,8 +24,6 @@ var _csDfs = require("./csDfs.js");
|
|
20
24
|
* @param {Array} pinv The inverse row permutation vector
|
21
25
|
*
|
22
26
|
* @return {Number} The index for the nonzero pattern
|
23
|
-
*
|
24
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
25
27
|
*/
|
26
28
|
function csReach(g, b, k, xi, pinv) {
|
27
29
|
// g arrays
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.createCsSpsolve = void 0;
|
7
7
|
var _csReach = require("./csReach.js");
|
8
8
|
var _factory = require("../../../utils/factory.js");
|
9
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
10
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
11
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
12
|
+
|
9
13
|
var name = 'csSpsolve';
|
10
14
|
var dependencies = ['divideScalar', 'multiply', 'subtract'];
|
11
15
|
var createCsSpsolve = exports.createCsSpsolve = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -28,8 +32,6 @@ var createCsSpsolve = exports.createCsSpsolve = /* #__PURE__ */(0, _factory.fact
|
|
28
32
|
* @param {boolean} lo The lower (true) upper triangular (false) flag
|
29
33
|
*
|
30
34
|
* @return {Number} The index for the nonzero pattern
|
31
|
-
*
|
32
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
33
35
|
*/
|
34
36
|
return function csSpsolve(g, b, k, xi, x, pinv, lo) {
|
35
37
|
// g arrays
|
@@ -10,6 +10,10 @@ var _csEtree = require("./csEtree.js");
|
|
10
10
|
var _csAmd = require("./csAmd.js");
|
11
11
|
var _csCounts = require("./csCounts.js");
|
12
12
|
var _factory = require("../../../utils/factory.js");
|
13
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
14
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
15
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
16
|
+
|
13
17
|
var name = 'csSqr';
|
14
18
|
var dependencies = ['add', 'multiply', 'transpose'];
|
15
19
|
var createCsSqr = exports.createCsSqr = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -34,8 +38,6 @@ var createCsSqr = exports.createCsSqr = /* #__PURE__ */(0, _factory.factory)(nam
|
|
34
38
|
* symbolic ordering and analysis for LU decomposition (false)
|
35
39
|
*
|
36
40
|
* @return {Object} The Symbolic ordering and analysis for matrix A
|
37
|
-
*
|
38
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
39
41
|
*/
|
40
42
|
return function csSqr(order, a, qr) {
|
41
43
|
// a arrays
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.createCsSymperm = void 0;
|
7
7
|
var _csCumsum = require("./csCumsum.js");
|
8
8
|
var _factory = require("../../../utils/factory.js");
|
9
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
10
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
11
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
12
|
+
|
9
13
|
var name = 'csSymperm';
|
10
14
|
var dependencies = ['conj', 'SparseMatrix'];
|
11
15
|
var createCsSymperm = exports.createCsSymperm = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -22,8 +26,6 @@ var createCsSymperm = exports.createCsSymperm = /* #__PURE__ */(0, _factory.fact
|
|
22
26
|
* @param {boolean} values Process matrix values (true)
|
23
27
|
*
|
24
28
|
* @return {Matrix} The C matrix, C = P * A * P'
|
25
|
-
*
|
26
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
27
29
|
*/
|
28
30
|
return function csSymperm(a, pinv, values) {
|
29
31
|
// A matrix arrays
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csTdfs = csTdfs;
|
7
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
8
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
9
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
10
|
+
|
7
11
|
/**
|
8
12
|
* Depth-first search and postorder of a tree rooted at node j
|
9
13
|
*
|
@@ -14,8 +18,6 @@ exports.csTdfs = csTdfs;
|
|
14
18
|
* @param {Number} next The index offset within the workspace for the next array
|
15
19
|
* @param {Array} post The post ordering array
|
16
20
|
* @param {Number} stack The index offset within the workspace for the stack array
|
17
|
-
*
|
18
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
19
21
|
*/
|
20
22
|
function csTdfs(j, k, w, head, next, post, stack) {
|
21
23
|
// variables
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.csUnflip = csUnflip;
|
7
7
|
var _csFlip = require("./csFlip.js");
|
8
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
9
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
10
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
11
|
+
|
8
12
|
/**
|
9
13
|
* Flips the value if it is negative of returns the same value otherwise.
|
10
14
|
*
|
11
15
|
* @param {Number} i The value to flip
|
12
|
-
*
|
13
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
14
16
|
*/
|
15
17
|
function csUnflip(i) {
|
16
18
|
// flip the value if it is negative
|
@@ -54,8 +54,10 @@ var createIsNaN = exports.createIsNaN = /* #__PURE__ */(0, _factory.factory)(nam
|
|
54
54
|
Unit: function Unit(x) {
|
55
55
|
return Number.isNaN(x.value);
|
56
56
|
},
|
57
|
-
'Array | Matrix': function
|
58
|
-
return
|
59
|
-
|
57
|
+
'Array | Matrix': typed.referToSelf(function (self) {
|
58
|
+
return function (x) {
|
59
|
+
return (0, _collection.deepMap)(x, self);
|
60
|
+
};
|
61
|
+
})
|
60
62
|
});
|
61
63
|
});
|
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 12.4.
|
10
|
-
* @date 2024-
|
9
|
+
* @version 12.4.2
|
10
|
+
* @date 2024-04-24
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
|
@@ -3281,6 +3281,7 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
3281
3281
|
};
|
3282
3282
|
|
3283
3283
|
// aliases (formerly plurals)
|
3284
|
+
// note that ALIASES is only used at creation to create more entries in UNITS by copying the aliased units
|
3284
3285
|
var ALIASES = {
|
3285
3286
|
meters: 'meter',
|
3286
3287
|
inches: 'inch',
|
@@ -3926,13 +3927,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
3926
3927
|
_alias.name = aliasName;
|
3927
3928
|
Unit.UNITS[aliasName] = _alias;
|
3928
3929
|
}
|
3929
|
-
|
3930
|
-
//
|
3930
|
+
|
3931
|
+
// delete the memoization cache because we created a new unit
|
3931
3932
|
delete _findUnit.cache;
|
3932
3933
|
return new Unit(null, name);
|
3933
3934
|
};
|
3934
3935
|
Unit.deleteUnit = function (name) {
|
3935
3936
|
delete Unit.UNITS[name];
|
3937
|
+
|
3938
|
+
// delete the memoization cache because we deleted a unit
|
3939
|
+
delete _findUnit.cache;
|
3936
3940
|
};
|
3937
3941
|
|
3938
3942
|
// expose arrays with prefixes, dimensions, units, systems
|
package/lib/cjs/utils/map.js
CHANGED
@@ -32,7 +32,7 @@ var ObjectWrappingMap = exports.ObjectWrappingMap = /*#__PURE__*/function () {
|
|
32
32
|
this.wrappedObject = object;
|
33
33
|
this[Symbol.iterator] = this.entries;
|
34
34
|
}
|
35
|
-
(0, _createClass2["default"])(ObjectWrappingMap, [{
|
35
|
+
return (0, _createClass2["default"])(ObjectWrappingMap, [{
|
36
36
|
key: "keys",
|
37
37
|
value: function keys() {
|
38
38
|
return Object.keys(this.wrappedObject).values();
|
@@ -104,7 +104,6 @@ var ObjectWrappingMap = exports.ObjectWrappingMap = /*#__PURE__*/function () {
|
|
104
104
|
return Object.keys(this.wrappedObject).length;
|
105
105
|
}
|
106
106
|
}]);
|
107
|
-
return ObjectWrappingMap;
|
108
107
|
}();
|
109
108
|
/**
|
110
109
|
* Create a map with two partitions: a and b.
|
@@ -133,7 +132,7 @@ var PartitionedMap = exports.PartitionedMap = /*#__PURE__*/function () {
|
|
133
132
|
this.bKeys = bKeys;
|
134
133
|
this[Symbol.iterator] = this.entries;
|
135
134
|
}
|
136
|
-
(0, _createClass2["default"])(PartitionedMap, [{
|
135
|
+
return (0, _createClass2["default"])(PartitionedMap, [{
|
137
136
|
key: "get",
|
138
137
|
value: function get(key) {
|
139
138
|
return this.bKeys.has(key) ? this.b.get(key) : this.a.get(key);
|
@@ -199,7 +198,6 @@ var PartitionedMap = exports.PartitionedMap = /*#__PURE__*/function () {
|
|
199
198
|
return (0, _toConsumableArray2["default"])(this.keys()).length;
|
200
199
|
}
|
201
200
|
}]);
|
202
|
-
return PartitionedMap;
|
203
201
|
}();
|
204
202
|
/**
|
205
203
|
* Create a new iterator that maps over the provided iterator, applying a mapping function to each item
|
package/lib/cjs/utils/object.js
CHANGED
@@ -19,7 +19,6 @@ exports.pick = pick;
|
|
19
19
|
exports.pickShallow = pickShallow;
|
20
20
|
exports.set = set;
|
21
21
|
exports.traverse = traverse;
|
22
|
-
exports.values = values;
|
23
22
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
24
23
|
var _is = require("./is.js");
|
25
24
|
/**
|
@@ -387,11 +386,6 @@ function pickShallow(object, properties) {
|
|
387
386
|
}
|
388
387
|
return copy;
|
389
388
|
}
|
390
|
-
function values(object) {
|
391
|
-
return Object.keys(object).map(function (key) {
|
392
|
-
return object[key];
|
393
|
-
});
|
394
|
-
}
|
395
389
|
|
396
390
|
// helper function to test whether a string contains a path like 'user.name'
|
397
391
|
function isPath(str) {
|
@@ -15,7 +15,7 @@ var allIsFunctions = _interopRequireWildcard(require("./is.js"));
|
|
15
15
|
var _create = require("../core/create.js");
|
16
16
|
var _string = require("./string.js");
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
19
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
20
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
21
21
|
* This file contains helper methods to create expected snapshot structures
|
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
|
-
var version = exports.version = '12.4.
|
7
|
+
var version = exports.version = '12.4.2';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
package/lib/esm/core/create.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import typedFunction from 'typed-function';
|
3
|
-
import { deepFlatten, isLegacyFactory
|
3
|
+
import { deepFlatten, isLegacyFactory } from '../utils/object.js';
|
4
4
|
import * as emitter from './../utils/emitter.js';
|
5
5
|
import { importFactory } from './function/import.js';
|
6
6
|
import { configFactory } from './function/config.js';
|
@@ -170,7 +170,7 @@ export function create(factories, config) {
|
|
170
170
|
// listen for changes in config, import all functions again when changed
|
171
171
|
// TODO: move this listener into the import function?
|
172
172
|
math.on('config', () => {
|
173
|
-
values(importedFactories).forEach(factory => {
|
173
|
+
Object.values(importedFactories).forEach(factory => {
|
174
174
|
if (factory && factory.meta && factory.meta.recreateOnConfigChange) {
|
175
175
|
// FIXME: only re-create when the current instance is the same as was initially created
|
176
176
|
// FIXME: delete the functions/constants before importing them again?
|
@@ -190,7 +190,7 @@ export function create(factories, config) {
|
|
190
190
|
|
191
191
|
// import the factory functions like createAdd as an array instead of object,
|
192
192
|
// else they will get a different naming (`createAdd` instead of `add`).
|
193
|
-
math.import(values(deepFlatten(factories)));
|
193
|
+
math.import(Object.values(deepFlatten(factories)));
|
194
194
|
math.ArgumentsError = ArgumentsError;
|
195
195
|
math.DimensionError = DimensionError;
|
196
196
|
math.IndexError = IndexError;
|
@@ -142,21 +142,23 @@ export var createConstantNode = /* #__PURE__ */factory(name, dependencies, _ref
|
|
142
142
|
*/
|
143
143
|
_toTex(options) {
|
144
144
|
var value = this._toString(options);
|
145
|
-
|
145
|
+
var type = typeOf(this.value);
|
146
|
+
switch (type) {
|
146
147
|
case 'string':
|
147
148
|
return '\\mathtt{' + escapeLatex(value) + '}';
|
148
149
|
case 'number':
|
149
150
|
case 'BigNumber':
|
150
151
|
{
|
151
|
-
|
152
|
+
var finite = type === 'BigNumber' ? this.value.isFinite() : isFinite(this.value);
|
153
|
+
if (!finite) {
|
152
154
|
return this.value.valueOf() < 0 ? '-\\infty' : '\\infty';
|
153
155
|
}
|
154
156
|
var index = value.toLowerCase().indexOf('e');
|
155
157
|
if (index !== -1) {
|
156
158
|
return value.substring(0, index) + '\\cdot10^{' + value.substring(index + 1) + '}';
|
157
159
|
}
|
160
|
+
return value;
|
158
161
|
}
|
159
|
-
return value;
|
160
162
|
case 'Fraction':
|
161
163
|
return this.value.toLatex();
|
162
164
|
default:
|
@@ -9,7 +9,7 @@ import { defaultTemplate, latexFunctions } from '../../utils/latex.js';
|
|
9
9
|
var name = 'FunctionNode';
|
10
10
|
var dependencies = ['math', 'Node', 'SymbolNode'];
|
11
11
|
export var createFunctionNode = /* #__PURE__ */factory(name, dependencies, _ref => {
|
12
|
-
var
|
12
|
+
var _FunctionNode;
|
13
13
|
var {
|
14
14
|
math,
|
15
15
|
Node,
|
@@ -456,13 +456,13 @@ export var createFunctionNode = /* #__PURE__ */factory(name, dependencies, _ref
|
|
456
456
|
return this.type + ':' + this.name;
|
457
457
|
}
|
458
458
|
}
|
459
|
-
|
459
|
+
_FunctionNode = FunctionNode;
|
460
460
|
_defineProperty(FunctionNode, "name", name);
|
461
461
|
_defineProperty(FunctionNode, "onUndefinedFunction", function (name) {
|
462
462
|
throw new Error('Undefined function ' + name);
|
463
463
|
});
|
464
464
|
_defineProperty(FunctionNode, "fromJSON", function (json) {
|
465
|
-
return new
|
465
|
+
return new _FunctionNode(json.fn, json.args);
|
466
466
|
});
|
467
467
|
return FunctionNode;
|
468
468
|
}, {
|
@@ -229,6 +229,9 @@ export var createSimplifyCore = /* #__PURE__ */factory(name, dependencies, _ref
|
|
229
229
|
if (isConstantNode(_a)) {
|
230
230
|
if (_a.value) {
|
231
231
|
if (isAlwaysBoolean(a1)) return a1;
|
232
|
+
if (isConstantNode(a1)) {
|
233
|
+
return a1.value ? nodeT : nodeF;
|
234
|
+
}
|
232
235
|
} else {
|
233
236
|
return nodeF;
|
234
237
|
}
|
@@ -1,3 +1,6 @@
|
|
1
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
2
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
3
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
1
4
|
import { factory } from '../../../utils/factory.js';
|
2
5
|
import { csFkeep } from './csFkeep.js';
|
3
6
|
import { csFlip } from './csFlip.js';
|
@@ -16,8 +19,6 @@ export var createCsAmd = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
16
19
|
* than A. It is a gready method that selects the sparsest pivot row and column during the course
|
17
20
|
* of a right looking sparse Cholesky factorization.
|
18
21
|
*
|
19
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
20
|
-
*
|
21
22
|
* @param {Number} order 0: Natural, 1: Cholesky, 2: LU, 3: QR
|
22
23
|
* @param {Matrix} m Sparse Matrix
|
23
24
|
*/
|
@@ -1,3 +1,6 @@
|
|
1
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
2
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
3
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
1
4
|
import { factory } from '../../../utils/factory.js';
|
2
5
|
import { csEreach } from './csEreach.js';
|
3
6
|
import { createCsSymperm } from './csSymperm.js';
|
@@ -29,8 +32,6 @@ export var createCsChol = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
29
32
|
* @param {Object} s The symbolic analysis from cs_schol()
|
30
33
|
*
|
31
34
|
* @return {Number} The numeric Cholesky factorization of A or null
|
32
|
-
*
|
33
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
34
35
|
*/
|
35
36
|
return function csChol(m, s) {
|
36
37
|
// validate input
|
@@ -1,3 +1,6 @@
|
|
1
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
2
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
3
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
1
4
|
import { factory } from '../../../utils/factory.js';
|
2
5
|
import { csLeaf } from './csLeaf.js';
|
3
6
|
var name = 'csCounts';
|
@@ -15,8 +18,6 @@ export var createCsCounts = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
15
18
|
* @param {Matrix} ata Count the columns of A'A instead
|
16
19
|
*
|
17
20
|
* @return An array of size n of the column counts or null on error
|
18
|
-
*
|
19
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
20
21
|
*/
|
21
22
|
return function (a, parent, post, ata) {
|
22
23
|
// check inputs
|
@@ -1,11 +1,13 @@
|
|
1
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
2
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
3
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
4
|
+
|
1
5
|
/**
|
2
6
|
* It sets the p[i] equal to the sum of c[0] through c[i-1].
|
3
7
|
*
|
4
8
|
* @param {Array} ptr The Sparse Matrix ptr array
|
5
9
|
* @param {Array} c The Sparse Matrix ptr array
|
6
10
|
* @param {Number} n The number of columns
|
7
|
-
*
|
8
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
9
11
|
*/
|
10
12
|
export function csCumsum(ptr, c, n) {
|
11
13
|
// variables
|
@@ -1,3 +1,6 @@
|
|
1
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
2
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
3
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
1
4
|
import { csMarked } from './csMarked.js';
|
2
5
|
import { csMark } from './csMark.js';
|
3
6
|
import { csUnflip } from './csUnflip.js';
|
@@ -15,8 +18,6 @@ import { csUnflip } from './csUnflip.js';
|
|
15
18
|
* @param {Array} pinv The inverse row permutation vector, must be null for L * x = b
|
16
19
|
*
|
17
20
|
* @return {Number} New value of top
|
18
|
-
*
|
19
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
20
21
|
*/
|
21
22
|
export function csDfs(j, g, top, xi, pinv) {
|
22
23
|
// g arrays
|