mathjs 12.3.2 → 12.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +28 -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/entry/pureFunctionsAny.generated.js +1 -0
- package/lib/cjs/expression/node/ConstantNode.js +5 -3
- package/lib/cjs/expression/parse.js +8 -4
- 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/arithmetic/multiply.js +30 -29
- package/lib/cjs/function/arithmetic/round.js +38 -7
- package/lib/cjs/function/matrix/dot.js +3 -3
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/matrix/utils/matAlgo01xDSid.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo02xDS0.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo03xDSf.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo04xSidSid.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo05xSfSf.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo06xS0S0.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo07xSSf.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo08xS0Sid.js +4 -4
- package/lib/cjs/type/matrix/utils/matAlgo09xS0Sf.js +4 -4
- package/lib/cjs/type/unit/Unit.js +6 -2
- package/lib/cjs/utils/map.js +2 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/pureFunctionsAny.generated.js +1 -0
- package/lib/esm/expression/node/ConstantNode.js +5 -3
- package/lib/esm/expression/parse.js +8 -4
- 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/arithmetic/multiply.js +30 -29
- package/lib/esm/function/arithmetic/round.js +38 -7
- package/lib/esm/function/matrix/dot.js +3 -3
- package/lib/esm/type/matrix/utils/matAlgo01xDSid.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo02xDS0.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo03xDSf.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo04xSidSid.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo05xSfSf.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo06xS0S0.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo07xSSf.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo08xS0Sid.js +4 -4
- package/lib/esm/type/matrix/utils/matAlgo09xS0Sf.js +4 -4
- package/lib/esm/type/unit/Unit.js +6 -2
- package/lib/esm/utils/map.js +2 -0
- package/lib/esm/version.js +1 -1
- package/package.json +16 -16
- package/types/index.d.ts +5 -5
@@ -601,6 +601,7 @@ var rightArithShift = exports.rightArithShift = /* #__PURE__ */(0, _factoriesAny
|
|
601
601
|
var round = exports.round = /* #__PURE__ */(0, _factoriesAny.createRound)({
|
602
602
|
BigNumber: BigNumber,
|
603
603
|
DenseMatrix: DenseMatrix,
|
604
|
+
config: _configReadonly.config,
|
604
605
|
equalScalar: equalScalar,
|
605
606
|
matrix: matrix,
|
606
607
|
typed: typed,
|
@@ -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:
|
@@ -1416,8 +1416,10 @@ var createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(nam
|
|
1416
1416
|
while (state.token === ';') {
|
1417
1417
|
// eslint-disable-line no-unmodified-loop-condition
|
1418
1418
|
getToken(state);
|
1419
|
-
|
1420
|
-
|
1419
|
+
if (state.token !== ']') {
|
1420
|
+
params[rows] = parseRow(state);
|
1421
|
+
rows++;
|
1422
|
+
}
|
1421
1423
|
}
|
1422
1424
|
if (state.token !== ']') {
|
1423
1425
|
throw createSyntaxError(state, 'End of matrix ] expected');
|
@@ -1465,8 +1467,10 @@ var createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(nam
|
|
1465
1467
|
getToken(state);
|
1466
1468
|
|
1467
1469
|
// parse expression
|
1468
|
-
|
1469
|
-
|
1470
|
+
if (state.token !== ']' && state.token !== ';') {
|
1471
|
+
params[len] = parseAssignment(state);
|
1472
|
+
len++;
|
1473
|
+
}
|
1470
1474
|
}
|
1471
1475
|
return new ArrayNode(params);
|
1472
1476
|
}
|
@@ -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
|