mathjs 12.3.2 → 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 +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
|
@@ -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
|
@@ -30,6 +30,7 @@ var ObjectWrappingMap = exports.ObjectWrappingMap = /*#__PURE__*/function () {
|
|
|
30
30
|
function ObjectWrappingMap(object) {
|
|
31
31
|
(0, _classCallCheck2["default"])(this, ObjectWrappingMap);
|
|
32
32
|
this.wrappedObject = object;
|
|
33
|
+
this[Symbol.iterator] = this.entries;
|
|
33
34
|
}
|
|
34
35
|
(0, _createClass2["default"])(ObjectWrappingMap, [{
|
|
35
36
|
key: "keys",
|
|
@@ -130,6 +131,7 @@ var PartitionedMap = exports.PartitionedMap = /*#__PURE__*/function () {
|
|
|
130
131
|
this.a = a;
|
|
131
132
|
this.b = b;
|
|
132
133
|
this.bKeys = bKeys;
|
|
134
|
+
this[Symbol.iterator] = this.entries;
|
|
133
135
|
}
|
|
134
136
|
(0, _createClass2["default"])(PartitionedMap, [{
|
|
135
137
|
key: "get",
|
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.
|
|
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:
|
|
@@ -1409,8 +1409,10 @@ export var createParse = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
1409
1409
|
while (state.token === ';') {
|
|
1410
1410
|
// eslint-disable-line no-unmodified-loop-condition
|
|
1411
1411
|
getToken(state);
|
|
1412
|
-
|
|
1413
|
-
|
|
1412
|
+
if (state.token !== ']') {
|
|
1413
|
+
params[rows] = parseRow(state);
|
|
1414
|
+
rows++;
|
|
1415
|
+
}
|
|
1414
1416
|
}
|
|
1415
1417
|
if (state.token !== ']') {
|
|
1416
1418
|
throw createSyntaxError(state, 'End of matrix ] expected');
|
|
@@ -1458,8 +1460,10 @@ export var createParse = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
1458
1460
|
getToken(state);
|
|
1459
1461
|
|
|
1460
1462
|
// parse expression
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
+
if (state.token !== ']' && state.token !== ';') {
|
|
1464
|
+
params[len] = parseAssignment(state);
|
|
1465
|
+
len++;
|
|
1466
|
+
}
|
|
1463
1467
|
}
|
|
1464
1468
|
return new ArrayNode(params);
|
|
1465
1469
|
}
|
|
@@ -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
|
|
@@ -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 { csMark } from './csMark.js';
|
|
2
5
|
import { csMarked } from './csMarked.js';
|
|
3
6
|
|
|
@@ -11,8 +14,6 @@ import { csMarked } from './csMarked.js';
|
|
|
11
14
|
* The first n entries is the nonzero pattern, the last n entries is the stack
|
|
12
15
|
*
|
|
13
16
|
* @return {Number} The index for the nonzero pattern
|
|
14
|
-
*
|
|
15
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
16
17
|
*/
|
|
17
18
|
export function csEreach(a, k, parent, w) {
|
|
18
19
|
// a arrays
|
|
@@ -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
|
* Computes the elimination tree of Matrix A (using triu(A)) or the
|
|
3
7
|
* elimination tree of A'A without forming A'A.
|
|
4
8
|
*
|
|
5
9
|
* @param {Matrix} a The A Matrix
|
|
6
10
|
* @param {boolean} ata A value of true the function computes the etree of A'A
|
|
7
|
-
*
|
|
8
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
9
11
|
*/
|
|
10
12
|
export function csEtree(a, ata) {
|
|
11
13
|
// check inputs
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
* Keeps entries in the matrix when the callback function returns true, removes the entry otherwise
|
|
3
7
|
*
|
|
@@ -10,8 +14,6 @@
|
|
|
10
14
|
* @param {any} other The state
|
|
11
15
|
*
|
|
12
16
|
* @return The number of nonzero elements in the matrix
|
|
13
|
-
*
|
|
14
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
15
17
|
*/
|
|
16
18
|
export function csFkeep(a, callback, other) {
|
|
17
19
|
// a arrays
|
|
@@ -1,9 +1,11 @@
|
|
|
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
|
* This function "flips" its input about the integer -1.
|
|
3
7
|
*
|
|
4
8
|
* @param {Number} i The value to flip
|
|
5
|
-
*
|
|
6
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
7
9
|
*/
|
|
8
10
|
export function csFlip(i) {
|
|
9
11
|
// flip the value
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
* This function determines if j is a leaf of the ith row subtree.
|
|
3
7
|
* Consider A(i,j), node j in ith row subtree and return lca(jprev,j)
|
|
@@ -11,8 +15,6 @@
|
|
|
11
15
|
* @param {Number} ancestor The index offset within the workspace for the ancestor array
|
|
12
16
|
*
|
|
13
17
|
* @return {Object}
|
|
14
|
-
*
|
|
15
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
16
18
|
*/
|
|
17
19
|
export function csLeaf(i, j, w, first, maxfirst, prevleaf, ancestor) {
|
|
18
20
|
var s, sparent;
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
import { factory } from '../../../utils/factory.js';
|
|
2
6
|
import { createCsSpsolve } from './csSpsolve.js';
|
|
3
7
|
var name = 'csLu';
|
|
@@ -30,8 +34,6 @@ export var createCsLu = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
30
34
|
* @param {Number} tol Partial pivoting threshold (1 for partial pivoting)
|
|
31
35
|
*
|
|
32
36
|
* @return {Number} The numeric LU factorization of A or null
|
|
33
|
-
*
|
|
34
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
35
37
|
*/
|
|
36
38
|
return function csLu(m, s, tol) {
|
|
37
39
|
// validate input
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
import { csFlip } from './csFlip.js';
|
|
2
6
|
|
|
3
7
|
/**
|
|
@@ -5,8 +9,6 @@ import { csFlip } from './csFlip.js';
|
|
|
5
9
|
*
|
|
6
10
|
* @param {Array} w The array
|
|
7
11
|
* @param {Number} j The array index
|
|
8
|
-
*
|
|
9
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
10
12
|
*/
|
|
11
13
|
export function csMark(w, j) {
|
|
12
14
|
// mark w[j]
|
|
@@ -1,10 +1,12 @@
|
|
|
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
|
* Checks if the node at w[j] is marked
|
|
3
7
|
*
|
|
4
8
|
* @param {Array} w The array
|
|
5
9
|
* @param {Number} j The array index
|
|
6
|
-
*
|
|
7
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
8
10
|
*/
|
|
9
11
|
export function csMarked(w, j) {
|
|
10
12
|
// check node is marked
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
* Permutes a sparse matrix C = P * A * Q
|
|
3
7
|
*
|
|
@@ -7,8 +11,6 @@
|
|
|
7
11
|
* @param {boolean} values Create a pattern matrix (false), values and pattern otherwise
|
|
8
12
|
*
|
|
9
13
|
* @return {Matrix} C = P * A * Q, null on error
|
|
10
|
-
*
|
|
11
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
12
14
|
*/
|
|
13
15
|
export function csPermute(a, pinv, q, values) {
|
|
14
16
|
// a arrays
|
|
@@ -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 { csTdfs } from './csTdfs.js';
|
|
2
5
|
|
|
3
6
|
/**
|
|
@@ -5,8 +8,6 @@ import { csTdfs } from './csTdfs.js';
|
|
|
5
8
|
*
|
|
6
9
|
* @param {Array} parent The tree or forest
|
|
7
10
|
* @param {Number} n Number of columns
|
|
8
|
-
*
|
|
9
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
10
11
|
*/
|
|
11
12
|
export function csPost(parent, n) {
|
|
12
13
|
// check inputs
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
import { csMarked } from './csMarked.js';
|
|
2
6
|
import { csMark } from './csMark.js';
|
|
3
7
|
import { csDfs } from './csDfs.js';
|
|
@@ -15,8 +19,6 @@ import { csDfs } from './csDfs.js';
|
|
|
15
19
|
* @param {Array} pinv The inverse row permutation vector
|
|
16
20
|
*
|
|
17
21
|
* @return {Number} The index for the nonzero pattern
|
|
18
|
-
*
|
|
19
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
20
22
|
*/
|
|
21
23
|
export function csReach(g, b, k, xi, pinv) {
|
|
22
24
|
// g arrays
|
|
@@ -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 { csReach } from './csReach.js';
|
|
2
5
|
import { factory } from '../../../utils/factory.js';
|
|
3
6
|
var name = 'csSpsolve';
|
|
@@ -24,8 +27,6 @@ export var createCsSpsolve = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
|
24
27
|
* @param {boolean} lo The lower (true) upper triangular (false) flag
|
|
25
28
|
*
|
|
26
29
|
* @return {Number} The index for the nonzero pattern
|
|
27
|
-
*
|
|
28
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
29
30
|
*/
|
|
30
31
|
return function csSpsolve(g, b, k, xi, x, pinv, lo) {
|
|
31
32
|
// g arrays
|
|
@@ -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 { csPermute } from './csPermute.js';
|
|
2
5
|
import { csPost } from './csPost.js';
|
|
3
6
|
import { csEtree } from './csEtree.js';
|
|
@@ -30,8 +33,6 @@ export var createCsSqr = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
30
33
|
* symbolic ordering and analysis for LU decomposition (false)
|
|
31
34
|
*
|
|
32
35
|
* @return {Object} The Symbolic ordering and analysis for matrix A
|
|
33
|
-
*
|
|
34
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
35
36
|
*/
|
|
36
37
|
return function csSqr(order, a, qr) {
|
|
37
38
|
// a arrays
|
|
@@ -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 { csCumsum } from './csCumsum.js';
|
|
2
5
|
import { factory } from '../../../utils/factory.js';
|
|
3
6
|
var name = 'csSymperm';
|
|
@@ -18,8 +21,6 @@ export var createCsSymperm = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
|
18
21
|
* @param {boolean} values Process matrix values (true)
|
|
19
22
|
*
|
|
20
23
|
* @return {Matrix} The C matrix, C = P * A * P'
|
|
21
|
-
*
|
|
22
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
23
24
|
*/
|
|
24
25
|
return function csSymperm(a, pinv, values) {
|
|
25
26
|
// A matrix arrays
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
* Depth-first search and postorder of a tree rooted at node j
|
|
3
7
|
*
|
|
@@ -8,8 +12,6 @@
|
|
|
8
12
|
* @param {Number} next The index offset within the workspace for the next array
|
|
9
13
|
* @param {Array} post The post ordering array
|
|
10
14
|
* @param {Number} stack The index offset within the workspace for the stack array
|
|
11
|
-
*
|
|
12
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
13
15
|
*/
|
|
14
16
|
export function csTdfs(j, k, w, head, next, post, stack) {
|
|
15
17
|
// variables
|
|
@@ -1,11 +1,12 @@
|
|
|
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 { csFlip } from './csFlip.js';
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Flips the value if it is negative of returns the same value otherwise.
|
|
5
8
|
*
|
|
6
9
|
* @param {Number} i The value to flip
|
|
7
|
-
*
|
|
8
|
-
* Reference: http://faculty.cse.tamu.edu/davis/publications.html
|
|
9
10
|
*/
|
|
10
11
|
export function csUnflip(i) {
|
|
11
12
|
// flip the value if it is negative
|