mathjs 14.9.0 → 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 +29 -3
- 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
package/lib/esm/core/config.js
CHANGED
@@ -21,5 +21,9 @@ export var DEFAULT_CONFIG = {
|
|
21
21
|
predictable: false,
|
22
22
|
// random seed for seeded pseudo random number generation
|
23
23
|
// null = randomly seed
|
24
|
-
randomSeed: null
|
24
|
+
randomSeed: null,
|
25
|
+
// legacy behavior for matrix subset. When true, the subset function
|
26
|
+
// returns a matrix or array with the same size as the index (except for scalars).
|
27
|
+
// When false, it returns a matrix or array with a size depending on the type of index.
|
28
|
+
legacySubset: false
|
25
29
|
};
|
@@ -59,6 +59,10 @@ export function configFactory(config, emit) {
|
|
59
59
|
delete optionsFix.epsilon;
|
60
60
|
return _config(optionsFix);
|
61
61
|
}
|
62
|
+
if (options.legacySubset === true) {
|
63
|
+
// this if is only for backwards compatibility, it can be removed in the future.
|
64
|
+
console.warn('Warning: The configuration option "legacySubset" is for compatibility only and might be deprecated in the future.');
|
65
|
+
}
|
62
66
|
var prev = clone(config);
|
63
67
|
|
64
68
|
// validate some of the options
|
@@ -2,11 +2,9 @@
|
|
2
2
|
* THIS FILE IS AUTO-GENERATED
|
3
3
|
* DON'T MAKE CHANGES HERE
|
4
4
|
*/
|
5
|
-
import { matrixDependencies } from './dependenciesMatrix.generated.js';
|
6
5
|
import { typedDependencies } from './dependenciesTyped.generated.js';
|
7
6
|
import { createSize } from '../../factoriesAny.js';
|
8
7
|
export var sizeDependencies = {
|
9
|
-
matrixDependencies,
|
10
8
|
typedDependencies,
|
11
9
|
createSize
|
12
10
|
};
|
@@ -2,11 +2,9 @@
|
|
2
2
|
* THIS FILE IS AUTO-GENERATED
|
3
3
|
* DON'T MAKE CHANGES HERE
|
4
4
|
*/
|
5
|
-
import { matrixDependencies } from './dependenciesMatrix.generated.js';
|
6
5
|
import { typedDependencies } from './dependenciesTyped.generated.js';
|
7
6
|
import { createSize } from '../../factoriesNumber.js';
|
8
7
|
export var sizeDependencies = {
|
9
|
-
matrixDependencies,
|
10
8
|
typedDependencies,
|
11
9
|
createSize
|
12
10
|
};
|
@@ -4,10 +4,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
* DON'T MAKE CHANGES HERE
|
5
5
|
*/
|
6
6
|
import { config } from './configReadonly.js';
|
7
|
-
import { createNode, createObjectNode, createOperatorNode, createParenthesisNode, createRelationalNode, createArrayNode, createBlockNode, createConditionalNode, createConstantNode, createRangeNode, createReviver, createChainClass, createFunctionAssignmentNode, createChain, createAccessorNode, createAssignmentNode,
|
7
|
+
import { createNode, createObjectNode, createOperatorNode, createParenthesisNode, createRelationalNode, createArrayNode, createBlockNode, createConditionalNode, createConstantNode, createRangeNode, createReviver, createChainClass, createFunctionAssignmentNode, createChain, createIndexNode, createAccessorNode, createAssignmentNode, createSymbolNode, createFunctionNode, createParse, createResolve, createSimplifyConstant, createCompile, createSimplifyCore, createEvaluate, createHelpClass, createParserClass, createSimplify, createSymbolicEqual, createLeafCount, createParser, createRationalize, createDerivative, createHelp, createMapSlicesTransform, createFilterTransform, createForEachTransform, createMapTransform, createOrTransform, createAndTransform, createConcatTransform, createMaxTransform, createPrintTransform, createSumTransform, createBitAndTransform, createMinTransform, createNullishTransform, createSubsetTransform, createBitOrTransform, createDiffTransform, createIndexTransform, createRangeTransform, createRowTransform, createColumnTransform, createCumSumTransform, createMeanTransform, createQuantileSeqTransform, createVarianceTransform, createStdTransform } from '../factoriesAny.js';
|
8
8
|
import { BigNumber, Complex, e, _false, fineStructure, Fraction, i, _Infinity, LN10, LOG10E, Matrix, _NaN, _null, phi, Range, ResultSet, SQRT1_2,
|
9
9
|
// eslint-disable-line camelcase
|
10
|
-
sackurTetrode, tau, _true, version, DenseMatrix, efimovFactor, LN2, pi, replacer, SQRT2, typed, weakMixingAngle, abs, acos, acot, acsc, addScalar, arg, asech, asinh, atan, atanh, bigint, bitNot, boolean, clone, combinations, complex, conj, cos, cot, csc, cube, equalScalar, erf, exp, expm1, filter, flatten, forEach, format, getMatrixDataType, hex, im, isInteger, isNegative, isPositive, isZero, LOG2E, lgamma, log10, log2, map, multiplyScalar, not, number, oct, pickRandom, print, random, re, sec, sign, sin, SparseMatrix, splitUnit, square, string, subtractScalar, tan, toBest, typeOf, acosh, acsch, asec, bignumber, combinationsWithRep, cosh, csch, isNaN, isPrime, mapSlices, matrix, matrixFromFunction, ones, randomInt, reshape, sech, sinh, sparse, sqrt, squeeze, tanh, transpose, xgcd, zeros, acoth, asin, bin, concat, coth, ctranspose, diag, dotMultiply, equal, fraction, identity, isNumeric, kron, largerEq, leftShift, mode, nthRoot, numeric, prod, resize, rightArithShift, round,
|
10
|
+
sackurTetrode, tau, _true, version, DenseMatrix, efimovFactor, LN2, pi, replacer, SQRT2, typed, weakMixingAngle, abs, acos, acot, acsc, addScalar, arg, asech, asinh, atan, atanh, bigint, bitNot, boolean, clone, combinations, complex, conj, cos, cot, csc, cube, equalScalar, erf, exp, expm1, filter, flatten, forEach, format, getMatrixDataType, hex, im, isInteger, isNegative, isPositive, isZero, LOG2E, lgamma, log10, log2, map, multiplyScalar, not, number, oct, pickRandom, print, random, re, sec, sign, sin, size, SparseMatrix, splitUnit, square, string, subtractScalar, tan, toBest, typeOf, acosh, acsch, asec, bignumber, combinationsWithRep, cosh, csch, dot, isNaN, isPrime, mapSlices, matrix, matrixFromFunction, multiply, ones, randomInt, reshape, sech, sinh, sparse, sqrt, squeeze, tanh, transpose, xgcd, zeros, acoth, asin, bin, concat, coth, ctranspose, diag, dotMultiply, equal, fraction, identity, isNumeric, kron, largerEq, leftShift, matrixFromRows, mode, nthRoot, numeric, prod, resize, rightArithShift, round, smaller, to, unaryMinus, unequal, xor, add, atan2, bitAnd, bitOr, bitXor, cbrt, compare, compareText, count, deepEqual, divideScalar, equalText, floor, gcd, hasNumericValue, hypot, ImmutableDenseMatrix, Index, larger, log, lsolve, matrixFromColumns, min, mod, nthRoots, nullish, or, partitionSelect, qr, rightLogShift, smallerEq, subset, subtract, trace, usolve, zpk2tf, catalan, compareNatural, composition, cross, det, diff, distance, dotDivide, FibonacciHeap, index, intersect, invmod, lcm, log1p, lsolveAll, max, range, row, setCartesian, setDistinct, setIsSubset, setPowerset, slu, sort, unaryPlus, usolveAll, and, ceil, column, cumsum, fix, setDifference, setMultiplicity, setSymDifference, Spa, sum, inv, lup, pinv, pow, setIntersect, setUnion, sqrtm, Unit, vacuumImpedance, wienDisplacement, atomicMass, bohrMagneton, boltzmann, conductanceQuantum, coulomb, createUnit, deuteronMass, dotPow, electricConstant, elementaryCharge, expm, faraday, fft, gamma, gravitationConstant, hartreeEnergy, ifft, klitzing, loschmidt, magneticConstant, molarMass, molarPlanckConstant, neutronMass, nuclearMagneton, planckCharge, planckLength, planckTemperature, protonMass, quantumOfCirculation, reducedPlanckConstant, rydberg, secondRadiation, speedOfLight, stefanBoltzmann, thomsonCrossSection, avogadro, bohrRadius, coulombConstant, divide, electronMass, factorial, firstRadiation, gravity, inverseConductanceQuantum, lusolve, magneticFluxQuantum, molarMassC12, multinomial, permutations, planckMass, polynomialRoot, setSize, solveODE, stirlingS2, unit, bellNumbers, eigs, fermiCoupling, gasConstant, kldivergence, mean, molarVolume, planckConstant, quantileSeq, variance, classicalElectronRadius, median, corr, freqz, mad, std, zeta, norm, rotationMatrix, planckTime, schur, rotate, sylvester, lyap } from './pureFunctionsAny.generated.js';
|
11
11
|
var math = {}; // NOT pure!
|
12
12
|
var mathWithTransform = {}; // NOT pure!
|
13
13
|
var classes = {}; // NOT pure!
|
@@ -58,6 +58,10 @@ export var chain = createChain({
|
|
58
58
|
Chain,
|
59
59
|
typed
|
60
60
|
});
|
61
|
+
export var IndexNode = createIndexNode({
|
62
|
+
Node,
|
63
|
+
size
|
64
|
+
});
|
61
65
|
export var AccessorNode = createAccessorNode({
|
62
66
|
Node,
|
63
67
|
subset
|
@@ -67,10 +71,6 @@ export var AssignmentNode = createAssignmentNode({
|
|
67
71
|
Node,
|
68
72
|
subset
|
69
73
|
});
|
70
|
-
export var IndexNode = createIndexNode({
|
71
|
-
Node,
|
72
|
-
size
|
73
|
-
});
|
74
74
|
export var SymbolNode = createSymbolNode({
|
75
75
|
Unit,
|
76
76
|
Node,
|
@@ -317,6 +317,7 @@ _extends(math, {
|
|
317
317
|
sec,
|
318
318
|
sign,
|
319
319
|
sin,
|
320
|
+
size,
|
320
321
|
splitUnit,
|
321
322
|
square,
|
322
323
|
string,
|
@@ -332,11 +333,13 @@ _extends(math, {
|
|
332
333
|
combinationsWithRep,
|
333
334
|
cosh,
|
334
335
|
csch,
|
336
|
+
dot,
|
335
337
|
isNaN,
|
336
338
|
isPrime,
|
337
339
|
mapSlices,
|
338
340
|
matrix,
|
339
341
|
matrixFromFunction,
|
342
|
+
multiply,
|
340
343
|
ones,
|
341
344
|
randomInt,
|
342
345
|
reshape,
|
@@ -364,6 +367,7 @@ _extends(math, {
|
|
364
367
|
kron,
|
365
368
|
largerEq,
|
366
369
|
leftShift,
|
370
|
+
matrixFromRows,
|
367
371
|
mode,
|
368
372
|
nthRoot,
|
369
373
|
numeric,
|
@@ -371,7 +375,6 @@ _extends(math, {
|
|
371
375
|
resize,
|
372
376
|
rightArithShift,
|
373
377
|
round,
|
374
|
-
size,
|
375
378
|
smaller,
|
376
379
|
to,
|
377
380
|
unaryMinus,
|
@@ -388,7 +391,6 @@ _extends(math, {
|
|
388
391
|
count,
|
389
392
|
deepEqual,
|
390
393
|
divideScalar,
|
391
|
-
dotDivide,
|
392
394
|
equalText,
|
393
395
|
floor,
|
394
396
|
gcd,
|
@@ -398,7 +400,6 @@ _extends(math, {
|
|
398
400
|
log,
|
399
401
|
lsolve,
|
400
402
|
matrixFromColumns,
|
401
|
-
max,
|
402
403
|
min,
|
403
404
|
mod,
|
404
405
|
nthRoots,
|
@@ -412,19 +413,22 @@ _extends(math, {
|
|
412
413
|
subtract,
|
413
414
|
trace,
|
414
415
|
usolve,
|
416
|
+
zpk2tf,
|
415
417
|
catalan,
|
416
418
|
compareNatural,
|
417
419
|
composition,
|
420
|
+
cross,
|
421
|
+
det,
|
418
422
|
diff,
|
419
423
|
distance,
|
420
|
-
|
424
|
+
dotDivide,
|
421
425
|
index,
|
426
|
+
intersect,
|
422
427
|
invmod,
|
423
428
|
lcm,
|
424
429
|
log1p,
|
425
430
|
lsolveAll,
|
426
|
-
|
427
|
-
multiply,
|
431
|
+
max,
|
428
432
|
range,
|
429
433
|
row,
|
430
434
|
setCartesian,
|
@@ -435,21 +439,22 @@ _extends(math, {
|
|
435
439
|
sort,
|
436
440
|
unaryPlus,
|
437
441
|
usolveAll,
|
438
|
-
zpk2tf,
|
439
442
|
and,
|
440
443
|
ceil,
|
441
444
|
column,
|
442
|
-
|
443
|
-
det,
|
445
|
+
cumsum,
|
444
446
|
fix,
|
445
|
-
inv,
|
446
|
-
pinv,
|
447
|
-
pow,
|
448
447
|
setDifference,
|
449
448
|
setMultiplicity,
|
450
449
|
setSymDifference,
|
451
|
-
sqrtm,
|
452
450
|
sum,
|
451
|
+
inv,
|
452
|
+
lup,
|
453
|
+
pinv,
|
454
|
+
pow,
|
455
|
+
setIntersect,
|
456
|
+
setUnion,
|
457
|
+
sqrtm,
|
453
458
|
vacuumImpedance,
|
454
459
|
wienDisplacement,
|
455
460
|
atomicMass,
|
@@ -469,7 +474,6 @@ _extends(math, {
|
|
469
474
|
gravitationConstant,
|
470
475
|
hartreeEnergy,
|
471
476
|
ifft,
|
472
|
-
inverseConductanceQuantum,
|
473
477
|
klitzing,
|
474
478
|
loschmidt,
|
475
479
|
magneticConstant,
|
@@ -485,7 +489,6 @@ _extends(math, {
|
|
485
489
|
reducedPlanckConstant,
|
486
490
|
rydberg,
|
487
491
|
secondRadiation,
|
488
|
-
setSize,
|
489
492
|
speedOfLight,
|
490
493
|
stefanBoltzmann,
|
491
494
|
thomsonCrossSection,
|
@@ -497,8 +500,8 @@ _extends(math, {
|
|
497
500
|
factorial,
|
498
501
|
firstRadiation,
|
499
502
|
gravity,
|
500
|
-
|
501
|
-
|
503
|
+
inverseConductanceQuantum,
|
504
|
+
lusolve,
|
502
505
|
magneticFluxQuantum,
|
503
506
|
molarMassC12,
|
504
507
|
multinomial,
|
@@ -507,24 +510,21 @@ _extends(math, {
|
|
507
510
|
planckMass,
|
508
511
|
polynomialRoot,
|
509
512
|
resolve,
|
510
|
-
|
513
|
+
setSize,
|
511
514
|
simplifyConstant,
|
512
515
|
solveODE,
|
513
516
|
stirlingS2,
|
514
517
|
unit,
|
515
518
|
bellNumbers,
|
516
519
|
compile,
|
517
|
-
cumsum,
|
518
520
|
eigs,
|
519
521
|
fermiCoupling,
|
520
522
|
gasConstant,
|
521
523
|
kldivergence,
|
522
|
-
lusolve,
|
523
524
|
mean,
|
524
525
|
molarVolume,
|
525
526
|
planckConstant,
|
526
527
|
quantileSeq,
|
527
|
-
setUnion,
|
528
528
|
simplifyCore,
|
529
529
|
variance,
|
530
530
|
classicalElectronRadius,
|
@@ -586,9 +586,12 @@ _extends(mathWithTransform, math, {
|
|
586
586
|
matrix,
|
587
587
|
typed
|
588
588
|
}),
|
589
|
-
|
590
|
-
|
591
|
-
|
589
|
+
max: createMaxTransform({
|
590
|
+
config,
|
591
|
+
isNaN,
|
592
|
+
larger,
|
593
|
+
numeric,
|
594
|
+
typed
|
592
595
|
}),
|
593
596
|
print: createPrintTransform({
|
594
597
|
add,
|
@@ -638,11 +641,6 @@ _extends(mathWithTransform, math, {
|
|
638
641
|
matrix,
|
639
642
|
typed
|
640
643
|
}),
|
641
|
-
cumsum: createCumSumTransform({
|
642
|
-
add,
|
643
|
-
typed,
|
644
|
-
unaryPlus
|
645
|
-
}),
|
646
644
|
diff: createDiffTransform({
|
647
645
|
bignumber,
|
648
646
|
matrix,
|
@@ -650,12 +648,9 @@ _extends(mathWithTransform, math, {
|
|
650
648
|
subtract,
|
651
649
|
typed
|
652
650
|
}),
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
larger,
|
657
|
-
numeric,
|
658
|
-
typed
|
651
|
+
index: createIndexTransform({
|
652
|
+
Index,
|
653
|
+
getMatrixDataType
|
659
654
|
}),
|
660
655
|
range: createRangeTransform({
|
661
656
|
bignumber,
|
@@ -683,6 +678,11 @@ _extends(mathWithTransform, math, {
|
|
683
678
|
range,
|
684
679
|
typed
|
685
680
|
}),
|
681
|
+
cumsum: createCumSumTransform({
|
682
|
+
add,
|
683
|
+
typed,
|
684
|
+
unaryPlus
|
685
|
+
}),
|
686
686
|
mean: createMeanTransform({
|
687
687
|
add,
|
688
688
|
divide,
|
@@ -740,12 +740,12 @@ _extends(classes, {
|
|
740
740
|
Chain,
|
741
741
|
FunctionAssignmentNode,
|
742
742
|
SparseMatrix,
|
743
|
+
IndexNode,
|
743
744
|
ImmutableDenseMatrix,
|
744
745
|
Index,
|
745
746
|
AccessorNode,
|
746
747
|
AssignmentNode,
|
747
748
|
FibonacciHeap,
|
748
|
-
IndexNode,
|
749
749
|
Spa,
|
750
750
|
Unit,
|
751
751
|
SymbolNode,
|