mathjs 14.9.1 → 15.0.0
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 +19 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +1 -1
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/core/config.js +5 -1
- package/lib/cjs/core/function/config.js +4 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSize.generated.js +0 -2
- package/lib/cjs/entry/dependenciesNumber/dependenciesSize.generated.js +0 -2
- package/lib/cjs/entry/impureFunctionsAny.generated.js +40 -40
- package/lib/cjs/entry/pureFunctionsAny.generated.js +143 -144
- package/lib/cjs/entry/pureFunctionsNumber.generated.js +0 -2
- package/lib/cjs/expression/node/IndexNode.js +1 -1
- package/lib/cjs/expression/parse.js +38 -34
- package/lib/cjs/function/algebra/sylvester.js +6 -5
- package/lib/cjs/function/logical/nullish.js +2 -2
- package/lib/cjs/function/matrix/column.js +2 -1
- package/lib/cjs/function/matrix/dot.js +4 -9
- package/lib/cjs/function/matrix/flatten.js +6 -3
- package/lib/cjs/function/matrix/kron.js +31 -30
- package/lib/cjs/function/matrix/row.js +2 -1
- package/lib/cjs/function/matrix/size.js +11 -17
- package/lib/cjs/function/matrix/subset.js +21 -11
- package/lib/cjs/header.js +1 -1
- package/lib/cjs/type/matrix/DenseMatrix.js +52 -41
- package/lib/cjs/type/matrix/MatrixIndex.js +19 -20
- package/lib/cjs/type/matrix/SparseMatrix.js +13 -7
- package/lib/cjs/version.js +1 -1
- package/lib/esm/core/config.js +5 -1
- package/lib/esm/core/function/config.js +4 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSize.generated.js +0 -2
- package/lib/esm/entry/dependenciesNumber/dependenciesSize.generated.js +0 -2
- package/lib/esm/entry/impureFunctionsAny.generated.js +42 -42
- package/lib/esm/entry/pureFunctionsAny.generated.js +144 -145
- package/lib/esm/entry/pureFunctionsNumber.generated.js +0 -2
- package/lib/esm/expression/node/IndexNode.js +1 -1
- package/lib/esm/expression/parse.js +38 -34
- package/lib/esm/function/algebra/sylvester.js +6 -5
- package/lib/esm/function/logical/nullish.js +2 -2
- package/lib/esm/function/matrix/column.js +2 -1
- package/lib/esm/function/matrix/dot.js +4 -9
- package/lib/esm/function/matrix/flatten.js +6 -3
- package/lib/esm/function/matrix/kron.js +31 -30
- package/lib/esm/function/matrix/row.js +2 -1
- package/lib/esm/function/matrix/size.js +11 -17
- package/lib/esm/function/matrix/subset.js +21 -11
- package/lib/esm/type/matrix/DenseMatrix.js +52 -41
- package/lib/esm/type/matrix/MatrixIndex.js +20 -21
- package/lib/esm/type/matrix/SparseMatrix.js +13 -7
- package/lib/esm/version.js +1 -1
- package/package.json +1 -1
@@ -298,12 +298,13 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies,
|
|
298
298
|
var pv = [];
|
299
299
|
|
300
300
|
// loop rows in resulting matrix
|
301
|
-
|
301
|
+
function rowsCallback(i, r) {
|
302
302
|
// update permutation vector
|
303
303
|
pv[i] = r[0];
|
304
304
|
// mark i in workspace
|
305
305
|
w[i] = true;
|
306
|
-
}
|
306
|
+
}
|
307
|
+
if (Number.isInteger(rows)) rowsCallback(rows, [0]);else rows.forEach(rowsCallback);
|
307
308
|
|
308
309
|
// result matrix arrays
|
309
310
|
var values = mvalues ? [] : undefined;
|
@@ -311,7 +312,7 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies,
|
|
311
312
|
var ptr = [];
|
312
313
|
|
313
314
|
// loop columns in result matrix
|
314
|
-
|
315
|
+
function columnsCallback(j) {
|
315
316
|
// update ptr
|
316
317
|
ptr.push(index.length);
|
317
318
|
// loop values in column j
|
@@ -328,7 +329,8 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies,
|
|
328
329
|
}
|
329
330
|
}
|
330
331
|
}
|
331
|
-
}
|
332
|
+
}
|
333
|
+
if (Number.isInteger(columns)) columnsCallback(columns);else columns.forEach(columnsCallback);
|
332
334
|
// update ptr
|
333
335
|
ptr.push(index.length);
|
334
336
|
|
@@ -402,7 +404,7 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies,
|
|
402
404
|
if (iSize.length === 1) {
|
403
405
|
// if the replacement index only has 1 dimension, go trough each one and set its value
|
404
406
|
var range = index.dimension(0);
|
405
|
-
range
|
407
|
+
_forEachIndex(range, (dataIndex, subIndex) => {
|
406
408
|
validateIndex(dataIndex);
|
407
409
|
matrix.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue);
|
408
410
|
});
|
@@ -410,9 +412,9 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies,
|
|
410
412
|
// if the replacement index has 2 dimensions, go through each one and set the value in the correct index
|
411
413
|
var firstDimensionRange = index.dimension(0);
|
412
414
|
var secondDimensionRange = index.dimension(1);
|
413
|
-
firstDimensionRange
|
415
|
+
_forEachIndex(firstDimensionRange, (firstDataIndex, firstSubIndex) => {
|
414
416
|
validateIndex(firstDataIndex);
|
415
|
-
secondDimensionRange
|
417
|
+
_forEachIndex(secondDimensionRange, (secondDataIndex, secondSubIndex) => {
|
416
418
|
validateIndex(secondDataIndex);
|
417
419
|
matrix.set([firstDataIndex, secondDataIndex], submatrix[firstSubIndex[0]][secondSubIndex[0]], defaultValue);
|
418
420
|
});
|
@@ -420,6 +422,10 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies,
|
|
420
422
|
}
|
421
423
|
}
|
422
424
|
return matrix;
|
425
|
+
function _forEachIndex(index, callback) {
|
426
|
+
// iterate cases where index is a Matrix or a Number
|
427
|
+
if (isNumber(index)) callback(index, [0]);else index.forEach(callback);
|
428
|
+
}
|
423
429
|
}
|
424
430
|
|
425
431
|
/**
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "
|
3
|
+
"version": "15.0.0",
|
4
4
|
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
|
5
5
|
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
|
6
6
|
"homepage": "https://mathjs.org",
|