mathjs 12.4.0 → 12.4.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 +13 -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/expression/node/ConstantNode.js +5 -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/header.js +2 -2
- package/lib/cjs/type/unit/Unit.js +6 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/expression/node/ConstantNode.js +5 -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/type/unit/Unit.js +6 -2
- package/lib/esm/version.js +1 -1
- package/package.json +13 -13
@@ -175,21 +175,23 @@ var createConstantNode = exports.createConstantNode = /* #__PURE__ */(0, _factor
|
|
175
175
|
*/
|
176
176
|
function _toTex(options) {
|
177
177
|
var value = this._toString(options);
|
178
|
-
|
178
|
+
var type = (0, _is.typeOf)(this.value);
|
179
|
+
switch (type) {
|
179
180
|
case 'string':
|
180
181
|
return '\\mathtt{' + (0, _latex.escapeLatex)(value) + '}';
|
181
182
|
case 'number':
|
182
183
|
case 'BigNumber':
|
183
184
|
{
|
184
|
-
|
185
|
+
var finite = type === 'BigNumber' ? this.value.isFinite() : isFinite(this.value);
|
186
|
+
if (!finite) {
|
185
187
|
return this.value.valueOf() < 0 ? '-\\infty' : '\\infty';
|
186
188
|
}
|
187
189
|
var index = value.toLowerCase().indexOf('e');
|
188
190
|
if (index !== -1) {
|
189
191
|
return value.substring(0, index) + '\\cdot10^{' + value.substring(index + 1) + '}';
|
190
192
|
}
|
193
|
+
return value;
|
191
194
|
}
|
192
|
-
return value;
|
193
195
|
case 'Fraction':
|
194
196
|
return this.value.toLatex();
|
195
197
|
default:
|
@@ -234,6 +234,9 @@ var createSimplifyCore = exports.createSimplifyCore = /* #__PURE__ */(0, _factor
|
|
234
234
|
if ((0, _is.isConstantNode)(_a)) {
|
235
235
|
if (_a.value) {
|
236
236
|
if (isAlwaysBoolean(a1)) return a1;
|
237
|
+
if ((0, _is.isConstantNode)(a1)) {
|
238
|
+
return a1.value ? nodeT : nodeF;
|
239
|
+
}
|
237
240
|
} else {
|
238
241
|
return nodeF;
|
239
242
|
}
|
@@ -8,6 +8,10 @@ var _factory = require("../../../utils/factory.js");
|
|
8
8
|
var _csFkeep = require("./csFkeep.js");
|
9
9
|
var _csFlip = require("./csFlip.js");
|
10
10
|
var _csTdfs = require("./csTdfs.js");
|
11
|
+
// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
|
12
|
+
// SPDX-License-Identifier: LGPL-2.1+
|
13
|
+
// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
|
14
|
+
|
11
15
|
var name = 'csAmd';
|
12
16
|
var dependencies = ['add', 'multiply', 'transpose'];
|
13
17
|
var createCsAmd = exports.createCsAmd = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -20,8 +24,6 @@ var createCsAmd = exports.createCsAmd = /* #__PURE__ */(0, _factory.factory)(nam
|
|
20
24
|
* than A. It is a gready method that selects the sparsest pivot row and column during the course
|
21
25
|
* of a right looking sparse Cholesky factorization.
|
22
26
|
*
|
23
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
24
|
-
*
|
25
27
|
* @param {Number} order 0: Natural, 1: Cholesky, 2: LU, 3: QR
|
26
28
|
* @param {Matrix} m Sparse Matrix
|
27
29
|
*/
|
@@ -7,6 +7,10 @@ exports.createCsChol = void 0;
|
|
7
7
|
var _factory = require("../../../utils/factory.js");
|
8
8
|
var _csEreach = require("./csEreach.js");
|
9
9
|
var _csSymperm = require("./csSymperm.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
|
var name = 'csChol';
|
11
15
|
var dependencies = ['divideScalar', 'sqrt', 'subtract', 'multiply', 'im', 're', 'conj', 'equal', 'smallerEq', 'SparseMatrix'];
|
12
16
|
var createCsChol = exports.createCsChol = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -33,8 +37,6 @@ var createCsChol = exports.createCsChol = /* #__PURE__ */(0, _factory.factory)(n
|
|
33
37
|
* @param {Object} s The symbolic analysis from cs_schol()
|
34
38
|
*
|
35
39
|
* @return {Number} The numeric Cholesky factorization of A or null
|
36
|
-
*
|
37
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
38
40
|
*/
|
39
41
|
return function csChol(m, s) {
|
40
42
|
// validate input
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.createCsCounts = void 0;
|
7
7
|
var _factory = require("../../../utils/factory.js");
|
8
8
|
var _csLeaf = require("./csLeaf.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 = 'csCounts';
|
10
14
|
var dependencies = ['transpose'];
|
11
15
|
var createCsCounts = exports.createCsCounts = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
@@ -19,8 +23,6 @@ var createCsCounts = exports.createCsCounts = /* #__PURE__ */(0, _factory.factor
|
|
19
23
|
* @param {Matrix} ata Count the columns of A'A instead
|
20
24
|
*
|
21
25
|
* @return An array of size n of the column counts or null on error
|
22
|
-
*
|
23
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
24
26
|
*/
|
25
27
|
return function (a, parent, post, ata) {
|
26
28
|
// check inputs
|
@@ -4,14 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.csCumsum = csCumsum;
|
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
|
* It sets the p[i] equal to the sum of c[0] through c[i-1].
|
9
13
|
*
|
10
14
|
* @param {Array} ptr The Sparse Matrix ptr array
|
11
15
|
* @param {Array} c The Sparse Matrix ptr array
|
12
16
|
* @param {Number} n The number of columns
|
13
|
-
*
|
14
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
15
17
|
*/
|
16
18
|
function csCumsum(ptr, c, n) {
|
17
19
|
// variables
|
@@ -7,6 +7,10 @@ exports.csDfs = csDfs;
|
|
7
7
|
var _csMarked = require("./csMarked.js");
|
8
8
|
var _csMark = require("./csMark.js");
|
9
9
|
var _csUnflip = require("./csUnflip.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
|
* Depth-first search computes the nonzero pattern xi of the directed graph G (Matrix) starting
|
12
16
|
* at nodes in B (see csReach()).
|
@@ -20,8 +24,6 @@ var _csUnflip = require("./csUnflip.js");
|
|
20
24
|
* @param {Array} pinv The inverse row permutation vector, must be null for L * x = b
|
21
25
|
*
|
22
26
|
* @return {Number} New value of top
|
23
|
-
*
|
24
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
25
27
|
*/
|
26
28
|
function csDfs(j, g, top, xi, pinv) {
|
27
29
|
// g arrays
|
@@ -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
|
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.1
|
10
|
+
* @date 2024-03-13
|
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/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.1';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
@@ -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:
|
@@ -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
|