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.
Files changed (50) hide show
  1. package/HISTORY.md +19 -0
  2. package/lib/browser/math.js +1 -1
  3. package/lib/browser/math.js.LICENSE.txt +1 -1
  4. package/lib/browser/math.js.map +1 -1
  5. package/lib/cjs/core/config.js +5 -1
  6. package/lib/cjs/core/function/config.js +4 -0
  7. package/lib/cjs/entry/dependenciesAny/dependenciesSize.generated.js +0 -2
  8. package/lib/cjs/entry/dependenciesNumber/dependenciesSize.generated.js +0 -2
  9. package/lib/cjs/entry/impureFunctionsAny.generated.js +40 -40
  10. package/lib/cjs/entry/pureFunctionsAny.generated.js +143 -144
  11. package/lib/cjs/entry/pureFunctionsNumber.generated.js +0 -2
  12. package/lib/cjs/expression/node/IndexNode.js +1 -1
  13. package/lib/cjs/expression/parse.js +38 -34
  14. package/lib/cjs/function/algebra/sylvester.js +6 -5
  15. package/lib/cjs/function/logical/nullish.js +2 -2
  16. package/lib/cjs/function/matrix/column.js +2 -1
  17. package/lib/cjs/function/matrix/dot.js +4 -9
  18. package/lib/cjs/function/matrix/flatten.js +6 -3
  19. package/lib/cjs/function/matrix/kron.js +31 -30
  20. package/lib/cjs/function/matrix/row.js +2 -1
  21. package/lib/cjs/function/matrix/size.js +11 -17
  22. package/lib/cjs/function/matrix/subset.js +21 -11
  23. package/lib/cjs/header.js +1 -1
  24. package/lib/cjs/type/matrix/DenseMatrix.js +52 -41
  25. package/lib/cjs/type/matrix/MatrixIndex.js +19 -20
  26. package/lib/cjs/type/matrix/SparseMatrix.js +13 -7
  27. package/lib/cjs/version.js +1 -1
  28. package/lib/esm/core/config.js +5 -1
  29. package/lib/esm/core/function/config.js +4 -0
  30. package/lib/esm/entry/dependenciesAny/dependenciesSize.generated.js +0 -2
  31. package/lib/esm/entry/dependenciesNumber/dependenciesSize.generated.js +0 -2
  32. package/lib/esm/entry/impureFunctionsAny.generated.js +42 -42
  33. package/lib/esm/entry/pureFunctionsAny.generated.js +144 -145
  34. package/lib/esm/entry/pureFunctionsNumber.generated.js +0 -2
  35. package/lib/esm/expression/node/IndexNode.js +1 -1
  36. package/lib/esm/expression/parse.js +38 -34
  37. package/lib/esm/function/algebra/sylvester.js +6 -5
  38. package/lib/esm/function/logical/nullish.js +2 -2
  39. package/lib/esm/function/matrix/column.js +2 -1
  40. package/lib/esm/function/matrix/dot.js +4 -9
  41. package/lib/esm/function/matrix/flatten.js +6 -3
  42. package/lib/esm/function/matrix/kron.js +31 -30
  43. package/lib/esm/function/matrix/row.js +2 -1
  44. package/lib/esm/function/matrix/size.js +11 -17
  45. package/lib/esm/function/matrix/subset.js +21 -11
  46. package/lib/esm/type/matrix/DenseMatrix.js +52 -41
  47. package/lib/esm/type/matrix/MatrixIndex.js +20 -21
  48. package/lib/esm/type/matrix/SparseMatrix.js +13 -7
  49. package/lib/esm/version.js +1 -1
  50. package/package.json +1 -1
@@ -70,7 +70,8 @@ const tau = exports.tau = /* #__PURE__ */(0, _factoriesAny.createTau)({
70
70
  const _true = exports._true = /* #__PURE__ */(0, _factoriesAny.createTrue)({});
71
71
  const version = exports.version = /* #__PURE__ */(0, _factoriesAny.createVersion)({});
72
72
  const DenseMatrix = exports.DenseMatrix = /* #__PURE__ */(0, _factoriesAny.createDenseMatrixClass)({
73
- Matrix
73
+ Matrix,
74
+ config: _configReadonly.config
74
75
  });
75
76
  const efimovFactor = exports.efimovFactor = /* #__PURE__ */(0, _factoriesAny.createEfimovFactor)({
76
77
  BigNumber,
@@ -288,6 +289,9 @@ const sign = exports.sign = /* #__PURE__ */(0, _factoriesAny.createSign)({
288
289
  const sin = exports.sin = /* #__PURE__ */(0, _factoriesAny.createSin)({
289
290
  typed
290
291
  });
292
+ const size = exports.size = /* #__PURE__ */(0, _factoriesAny.createSize)({
293
+ typed
294
+ });
291
295
  const SparseMatrix = exports.SparseMatrix = /* #__PURE__ */(0, _factoriesAny.createSparseMatrixClass)({
292
296
  Matrix,
293
297
  equalScalar,
@@ -343,6 +347,13 @@ const csch = exports.csch = /* #__PURE__ */(0, _factoriesAny.createCsch)({
343
347
  BigNumber,
344
348
  typed
345
349
  });
350
+ const dot = exports.dot = /* #__PURE__ */(0, _factoriesAny.createDot)({
351
+ addScalar,
352
+ conj,
353
+ multiplyScalar,
354
+ size,
355
+ typed
356
+ });
346
357
  const isNaN = exports.isNaN = /* #__PURE__ */(0, _factoriesAny.createIsNaN)({
347
358
  typed
348
359
  });
@@ -365,6 +376,14 @@ const matrixFromFunction = exports.matrixFromFunction = /* #__PURE__ */(0, _fact
365
376
  matrix,
366
377
  typed
367
378
  });
379
+ const multiply = exports.multiply = /* #__PURE__ */(0, _factoriesAny.createMultiply)({
380
+ addScalar,
381
+ dot,
382
+ equalScalar,
383
+ matrix,
384
+ multiplyScalar,
385
+ typed
386
+ });
368
387
  const ones = exports.ones = /* #__PURE__ */(0, _factoriesAny.createOnes)({
369
388
  BigNumber,
370
389
  config: _configReadonly.config,
@@ -505,6 +524,12 @@ const leftShift = exports.leftShift = /* #__PURE__ */(0, _factoriesAny.createLef
505
524
  typed,
506
525
  zeros
507
526
  });
527
+ const matrixFromRows = exports.matrixFromRows = /* #__PURE__ */(0, _factoriesAny.createMatrixFromRows)({
528
+ flatten,
529
+ matrix,
530
+ size,
531
+ typed
532
+ });
508
533
  const mode = exports.mode = /* #__PURE__ */(0, _factoriesAny.createMode)({
509
534
  isNaN,
510
535
  isNumeric,
@@ -549,11 +574,6 @@ const round = exports.round = /* #__PURE__ */(0, _factoriesAny.createRound)({
549
574
  typed,
550
575
  zeros
551
576
  });
552
- const size = exports.size = /* #__PURE__ */(0, _factoriesAny.createSize)({
553
- matrix,
554
- config: _configReadonly.config,
555
- typed
556
- });
557
577
  const smaller = exports.smaller = /* #__PURE__ */(0, _factoriesAny.createSmaller)({
558
578
  DenseMatrix,
559
579
  SparseMatrix,
@@ -662,15 +682,6 @@ const divideScalar = exports.divideScalar = /* #__PURE__ */(0, _factoriesAny.cre
662
682
  numeric,
663
683
  typed
664
684
  });
665
- const dotDivide = exports.dotDivide = /* #__PURE__ */(0, _factoriesAny.createDotDivide)({
666
- DenseMatrix,
667
- SparseMatrix,
668
- concat,
669
- divideScalar,
670
- equalScalar,
671
- matrix,
672
- typed
673
- });
674
685
  const equalText = exports.equalText = /* #__PURE__ */(0, _factoriesAny.createEqualText)({
675
686
  compareText,
676
687
  isZero,
@@ -749,13 +760,6 @@ const matrixFromColumns = exports.matrixFromColumns = /* #__PURE__ */(0, _factor
749
760
  size,
750
761
  typed
751
762
  });
752
- const max = exports.max = /* #__PURE__ */(0, _factoriesAny.createMax)({
753
- config: _configReadonly.config,
754
- isNaN,
755
- larger,
756
- numeric,
757
- typed
758
- });
759
763
  const min = exports.min = /* #__PURE__ */(0, _factoriesAny.createMin)({
760
764
  config: _configReadonly.config,
761
765
  isNaN,
@@ -861,6 +865,13 @@ const usolve = exports.usolve = /* #__PURE__ */(0, _factoriesAny.createUsolve)({
861
865
  subtractScalar,
862
866
  typed
863
867
  });
868
+ const zpk2tf = exports.zpk2tf = /* #__PURE__ */(0, _factoriesAny.createZpk2tf)({
869
+ Complex,
870
+ add,
871
+ multiply,
872
+ number,
873
+ typed
874
+ });
864
875
  const catalan = exports.catalan = /* #__PURE__ */(0, _factoriesAny.createCatalan)({
865
876
  addScalar,
866
877
  combinations,
@@ -883,6 +894,21 @@ const composition = exports.composition = /* #__PURE__ */(0, _factoriesAny.creat
883
894
  larger,
884
895
  typed
885
896
  });
897
+ const cross = exports.cross = /* #__PURE__ */(0, _factoriesAny.createCross)({
898
+ matrix,
899
+ multiply,
900
+ subtract,
901
+ typed
902
+ });
903
+ const det = exports.det = /* #__PURE__ */(0, _factoriesAny.createDet)({
904
+ divideScalar,
905
+ isZero,
906
+ matrix,
907
+ multiply,
908
+ subtractScalar,
909
+ typed,
910
+ unaryMinus
911
+ });
886
912
  const diff = exports.diff = /* #__PURE__ */(0, _factoriesAny.createDiff)({
887
913
  matrix,
888
914
  number,
@@ -899,11 +925,13 @@ const distance = exports.distance = /* #__PURE__ */(0, _factoriesAny.createDista
899
925
  subtractScalar,
900
926
  typed
901
927
  });
902
- const dot = exports.dot = /* #__PURE__ */(0, _factoriesAny.createDot)({
903
- addScalar,
904
- conj,
905
- multiplyScalar,
906
- size,
928
+ const dotDivide = exports.dotDivide = /* #__PURE__ */(0, _factoriesAny.createDotDivide)({
929
+ DenseMatrix,
930
+ SparseMatrix,
931
+ concat,
932
+ divideScalar,
933
+ equalScalar,
934
+ matrix,
907
935
  typed
908
936
  });
909
937
  const FibonacciHeap = exports.FibonacciHeap = /* #__PURE__ */(0, _factoriesAny.createFibonacciHeapClass)({
@@ -914,6 +942,23 @@ const index = exports.index = /* #__PURE__ */(0, _factoriesAny.createIndex)({
914
942
  Index,
915
943
  typed
916
944
  });
945
+ const intersect = exports.intersect = /* #__PURE__ */(0, _factoriesAny.createIntersect)({
946
+ abs,
947
+ add,
948
+ addScalar,
949
+ config: _configReadonly.config,
950
+ divideScalar,
951
+ equalScalar,
952
+ flatten,
953
+ isNumeric,
954
+ isZero,
955
+ matrix,
956
+ multiply,
957
+ multiplyScalar,
958
+ smaller,
959
+ subtract,
960
+ typed
961
+ });
917
962
  const invmod = exports.invmod = /* #__PURE__ */(0, _factoriesAny.createInvmod)({
918
963
  BigNumber,
919
964
  add,
@@ -947,18 +992,11 @@ const lsolveAll = exports.lsolveAll = /* #__PURE__ */(0, _factoriesAny.createLso
947
992
  subtractScalar,
948
993
  typed
949
994
  });
950
- const matrixFromRows = exports.matrixFromRows = /* #__PURE__ */(0, _factoriesAny.createMatrixFromRows)({
951
- flatten,
952
- matrix,
953
- size,
954
- typed
955
- });
956
- const multiply = exports.multiply = /* #__PURE__ */(0, _factoriesAny.createMultiply)({
957
- addScalar,
958
- dot,
959
- equalScalar,
960
- matrix,
961
- multiplyScalar,
995
+ const max = exports.max = /* #__PURE__ */(0, _factoriesAny.createMax)({
996
+ config: _configReadonly.config,
997
+ isNaN,
998
+ larger,
999
+ numeric,
962
1000
  typed
963
1001
  });
964
1002
  const range = exports.range = /* #__PURE__ */(0, _factoriesAny.createRange)({
@@ -1043,13 +1081,6 @@ const usolveAll = exports.usolveAll = /* #__PURE__ */(0, _factoriesAny.createUso
1043
1081
  subtractScalar,
1044
1082
  typed
1045
1083
  });
1046
- const zpk2tf = exports.zpk2tf = /* #__PURE__ */(0, _factoriesAny.createZpk2tf)({
1047
- Complex,
1048
- add,
1049
- multiply,
1050
- number,
1051
- typed
1052
- });
1053
1084
  const and = exports.and = /* #__PURE__ */(0, _factoriesAny.createAnd)({
1054
1085
  concat,
1055
1086
  equalScalar,
@@ -1073,20 +1104,10 @@ const column = exports.column = /* #__PURE__ */(0, _factoriesAny.createColumn)({
1073
1104
  range,
1074
1105
  typed
1075
1106
  });
1076
- const cross = exports.cross = /* #__PURE__ */(0, _factoriesAny.createCross)({
1077
- matrix,
1078
- multiply,
1079
- subtract,
1080
- typed
1081
- });
1082
- const det = exports.det = /* #__PURE__ */(0, _factoriesAny.createDet)({
1083
- divideScalar,
1084
- isZero,
1085
- matrix,
1086
- multiply,
1087
- subtractScalar,
1107
+ const cumsum = exports.cumsum = /* #__PURE__ */(0, _factoriesAny.createCumSum)({
1108
+ add,
1088
1109
  typed,
1089
- unaryMinus
1110
+ unaryPlus
1090
1111
  });
1091
1112
  const fix = exports.fix = /* #__PURE__ */(0, _factoriesAny.createFix)({
1092
1113
  Complex,
@@ -1098,6 +1119,40 @@ const fix = exports.fix = /* #__PURE__ */(0, _factoriesAny.createFix)({
1098
1119
  typed,
1099
1120
  zeros
1100
1121
  });
1122
+ const setDifference = exports.setDifference = /* #__PURE__ */(0, _factoriesAny.createSetDifference)({
1123
+ DenseMatrix,
1124
+ Index,
1125
+ compareNatural,
1126
+ size,
1127
+ subset,
1128
+ typed
1129
+ });
1130
+ const setMultiplicity = exports.setMultiplicity = /* #__PURE__ */(0, _factoriesAny.createSetMultiplicity)({
1131
+ Index,
1132
+ compareNatural,
1133
+ size,
1134
+ subset,
1135
+ typed
1136
+ });
1137
+ const setSymDifference = exports.setSymDifference = /* #__PURE__ */(0, _factoriesAny.createSetSymDifference)({
1138
+ Index,
1139
+ concat,
1140
+ setDifference,
1141
+ size,
1142
+ subset,
1143
+ typed
1144
+ });
1145
+ const Spa = exports.Spa = /* #__PURE__ */(0, _factoriesAny.createSpaClass)({
1146
+ FibonacciHeap,
1147
+ addScalar,
1148
+ equalScalar
1149
+ });
1150
+ const sum = exports.sum = /* #__PURE__ */(0, _factoriesAny.createSum)({
1151
+ add,
1152
+ config: _configReadonly.config,
1153
+ numeric,
1154
+ typed
1155
+ });
1101
1156
  const inv = exports.inv = /* #__PURE__ */(0, _factoriesAny.createInv)({
1102
1157
  abs,
1103
1158
  addScalar,
@@ -1109,6 +1164,21 @@ const inv = exports.inv = /* #__PURE__ */(0, _factoriesAny.createInv)({
1109
1164
  typed,
1110
1165
  unaryMinus
1111
1166
  });
1167
+ const lup = exports.lup = /* #__PURE__ */(0, _factoriesAny.createLup)({
1168
+ DenseMatrix,
1169
+ Spa,
1170
+ SparseMatrix,
1171
+ abs,
1172
+ addScalar,
1173
+ divideScalar,
1174
+ equalScalar,
1175
+ larger,
1176
+ matrix,
1177
+ multiplyScalar,
1178
+ subtractScalar,
1179
+ typed,
1180
+ unaryMinus
1181
+ });
1112
1182
  const pinv = exports.pinv = /* #__PURE__ */(0, _factoriesAny.createPinv)({
1113
1183
  Complex,
1114
1184
  add,
@@ -1134,7 +1204,7 @@ const pow = exports.pow = /* #__PURE__ */(0, _factoriesAny.createPow)({
1134
1204
  number,
1135
1205
  typed
1136
1206
  });
1137
- const setDifference = exports.setDifference = /* #__PURE__ */(0, _factoriesAny.createSetDifference)({
1207
+ const setIntersect = exports.setIntersect = /* #__PURE__ */(0, _factoriesAny.createSetIntersect)({
1138
1208
  DenseMatrix,
1139
1209
  Index,
1140
1210
  compareNatural,
@@ -1142,26 +1212,15 @@ const setDifference = exports.setDifference = /* #__PURE__ */(0, _factoriesAny.c
1142
1212
  subset,
1143
1213
  typed
1144
1214
  });
1145
- const setMultiplicity = exports.setMultiplicity = /* #__PURE__ */(0, _factoriesAny.createSetMultiplicity)({
1146
- Index,
1147
- compareNatural,
1148
- size,
1149
- subset,
1150
- typed
1151
- });
1152
- const setSymDifference = exports.setSymDifference = /* #__PURE__ */(0, _factoriesAny.createSetSymDifference)({
1215
+ const setUnion = exports.setUnion = /* #__PURE__ */(0, _factoriesAny.createSetUnion)({
1153
1216
  Index,
1154
1217
  concat,
1155
- setDifference,
1218
+ setIntersect,
1219
+ setSymDifference,
1156
1220
  size,
1157
1221
  subset,
1158
1222
  typed
1159
1223
  });
1160
- const Spa = exports.Spa = /* #__PURE__ */(0, _factoriesAny.createSpaClass)({
1161
- FibonacciHeap,
1162
- addScalar,
1163
- equalScalar
1164
- });
1165
1224
  const sqrtm = exports.sqrtm = /* #__PURE__ */(0, _factoriesAny.createSqrtm)({
1166
1225
  abs,
1167
1226
  add,
@@ -1175,12 +1234,6 @@ const sqrtm = exports.sqrtm = /* #__PURE__ */(0, _factoriesAny.createSqrtm)({
1175
1234
  subtract,
1176
1235
  typed
1177
1236
  });
1178
- const sum = exports.sum = /* #__PURE__ */(0, _factoriesAny.createSum)({
1179
- add,
1180
- config: _configReadonly.config,
1181
- numeric,
1182
- typed
1183
- });
1184
1237
  const Unit = exports.Unit = /* #__PURE__ */(0, _factoriesAny.createUnitClass)({
1185
1238
  BigNumber,
1186
1239
  Complex,
@@ -1315,11 +1368,6 @@ const ifft = exports.ifft = /* #__PURE__ */(0, _factoriesAny.createIfft)({
1315
1368
  fft,
1316
1369
  typed
1317
1370
  });
1318
- const inverseConductanceQuantum = exports.inverseConductanceQuantum = /* #__PURE__ */(0, _factoriesAny.createInverseConductanceQuantum)({
1319
- BigNumber,
1320
- Unit,
1321
- config: _configReadonly.config
1322
- });
1323
1371
  const klitzing = exports.klitzing = /* #__PURE__ */(0, _factoriesAny.createKlitzing)({
1324
1372
  BigNumber,
1325
1373
  Unit,
@@ -1395,10 +1443,6 @@ const secondRadiation = exports.secondRadiation = /* #__PURE__ */(0, _factoriesA
1395
1443
  Unit,
1396
1444
  config: _configReadonly.config
1397
1445
  });
1398
- const setSize = exports.setSize = /* #__PURE__ */(0, _factoriesAny.createSetSize)({
1399
- compareNatural,
1400
- typed
1401
- });
1402
1446
  const speedOfLight = exports.speedOfLight = /* #__PURE__ */(0, _factoriesAny.createSpeedOfLight)({
1403
1447
  BigNumber,
1404
1448
  Unit,
@@ -1456,37 +1500,19 @@ const gravity = exports.gravity = /* #__PURE__ */(0, _factoriesAny.createGravity
1456
1500
  Unit,
1457
1501
  config: _configReadonly.config
1458
1502
  });
1459
- const intersect = exports.intersect = /* #__PURE__ */(0, _factoriesAny.createIntersect)({
1460
- abs,
1461
- add,
1462
- addScalar,
1463
- config: _configReadonly.config,
1464
- divideScalar,
1465
- equalScalar,
1466
- flatten,
1467
- isNumeric,
1468
- isZero,
1469
- matrix,
1470
- multiply,
1471
- multiplyScalar,
1472
- smaller,
1473
- subtract,
1474
- typed
1503
+ const inverseConductanceQuantum = exports.inverseConductanceQuantum = /* #__PURE__ */(0, _factoriesAny.createInverseConductanceQuantum)({
1504
+ BigNumber,
1505
+ Unit,
1506
+ config: _configReadonly.config
1475
1507
  });
1476
- const lup = exports.lup = /* #__PURE__ */(0, _factoriesAny.createLup)({
1508
+ const lusolve = exports.lusolve = /* #__PURE__ */(0, _factoriesAny.createLusolve)({
1477
1509
  DenseMatrix,
1478
- Spa,
1479
- SparseMatrix,
1480
- abs,
1481
- addScalar,
1482
- divideScalar,
1483
- equalScalar,
1484
- larger,
1510
+ lsolve,
1511
+ lup,
1485
1512
  matrix,
1486
- multiplyScalar,
1487
- subtractScalar,
1513
+ slu,
1488
1514
  typed,
1489
- unaryMinus
1515
+ usolve
1490
1516
  });
1491
1517
  const magneticFluxQuantum = exports.magneticFluxQuantum = /* #__PURE__ */(0, _factoriesAny.createMagneticFluxQuantum)({
1492
1518
  BigNumber,
@@ -1531,12 +1557,8 @@ const polynomialRoot = exports.polynomialRoot = /* #__PURE__ */(0, _factoriesAny
1531
1557
  typed,
1532
1558
  unaryMinus
1533
1559
  });
1534
- const setIntersect = exports.setIntersect = /* #__PURE__ */(0, _factoriesAny.createSetIntersect)({
1535
- DenseMatrix,
1536
- Index,
1560
+ const setSize = exports.setSize = /* #__PURE__ */(0, _factoriesAny.createSetSize)({
1537
1561
  compareNatural,
1538
- size,
1539
- subset,
1540
1562
  typed
1541
1563
  });
1542
1564
  const solveODE = exports.solveODE = /* #__PURE__ */(0, _factoriesAny.createSolveODE)({
@@ -1582,11 +1604,6 @@ const bellNumbers = exports.bellNumbers = /* #__PURE__ */(0, _factoriesAny.creat
1582
1604
  stirlingS2,
1583
1605
  typed
1584
1606
  });
1585
- const cumsum = exports.cumsum = /* #__PURE__ */(0, _factoriesAny.createCumSum)({
1586
- add,
1587
- typed,
1588
- unaryPlus
1589
- });
1590
1607
  const eigs = exports.eigs = /* #__PURE__ */(0, _factoriesAny.createEigs)({
1591
1608
  abs,
1592
1609
  add,
@@ -1643,15 +1660,6 @@ const kldivergence = exports.kldivergence = /* #__PURE__ */(0, _factoriesAny.cre
1643
1660
  sum,
1644
1661
  typed
1645
1662
  });
1646
- const lusolve = exports.lusolve = /* #__PURE__ */(0, _factoriesAny.createLusolve)({
1647
- DenseMatrix,
1648
- lsolve,
1649
- lup,
1650
- matrix,
1651
- slu,
1652
- typed,
1653
- usolve
1654
- });
1655
1663
  const mean = exports.mean = /* #__PURE__ */(0, _factoriesAny.createMean)({
1656
1664
  add,
1657
1665
  divide,
@@ -1682,15 +1690,6 @@ const quantileSeq = exports.quantileSeq = /* #__PURE__ */(0, _factoriesAny.creat
1682
1690
  subtract,
1683
1691
  typed
1684
1692
  });
1685
- const setUnion = exports.setUnion = /* #__PURE__ */(0, _factoriesAny.createSetUnion)({
1686
- Index,
1687
- concat,
1688
- setIntersect,
1689
- setSymDifference,
1690
- size,
1691
- subset,
1692
- typed
1693
- });
1694
1693
  const variance = exports.variance = /* #__PURE__ */(0, _factoriesAny.createVariance)({
1695
1694
  add,
1696
1695
  divide,
@@ -218,8 +218,6 @@ const sin = exports.sin = /* #__PURE__ */(0, _factoriesNumber.createSin)({
218
218
  typed
219
219
  });
220
220
  const size = exports.size = /* #__PURE__ */(0, _factoriesNumber.createSize)({
221
- matrix,
222
- config: _configReadonly.config,
223
221
  typed
224
222
  });
225
223
  const smallerEq = exports.smallerEq = /* #__PURE__ */(0, _factoriesNumber.createSmallerEq)({
@@ -86,7 +86,7 @@ const createIndexNode = exports.createIndexNode = /* #__PURE__ */(0, _factory.fa
86
86
  if (!(0, _is.isMatrix)(context) && !(0, _is.isArray)(context) && !(0, _is.isString)(context)) {
87
87
  throw new TypeError('Cannot resolve "end": ' + 'context must be a Matrix, Array, or string but is ' + (0, _is.typeOf)(context));
88
88
  }
89
- const s = size(context).valueOf();
89
+ const s = size(context);
90
90
  const childArgs = Object.create(args);
91
91
  childArgs.end = s[i];
92
92
  return _evalDimension(scope, childArgs, context);
@@ -329,7 +329,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
329
329
  next(state);
330
330
  state.token += currentCharacter(state);
331
331
  next(state);
332
- while (parse.isHexDigit(currentCharacter(state))) {
332
+ while (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse.isDigit(currentCharacter(state))) {
333
333
  state.token += currentCharacter(state);
334
334
  next(state);
335
335
  }
@@ -338,7 +338,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
338
338
  state.token += '.';
339
339
  next(state);
340
340
  // get the digits after the radix
341
- while (parse.isHexDigit(currentCharacter(state))) {
341
+ while (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse.isDigit(currentCharacter(state))) {
342
342
  state.token += currentCharacter(state);
343
343
  next(state);
344
344
  }
@@ -544,15 +544,6 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
544
544
  return c >= '0' && c <= '9';
545
545
  };
546
546
 
547
- /**
548
- * checks if the given char c is a hex digit
549
- * @param {string} c a string with one character
550
- * @return {boolean}
551
- */
552
- parse.isHexDigit = function isHexDigit(c) {
553
- return c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F';
554
- };
555
-
556
547
  /**
557
548
  * Start of the parse levels below, in order of precedence
558
549
  * @return {Node} node
@@ -941,7 +932,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
941
932
  */
942
933
  function parseAddSubtract(state) {
943
934
  let node, name, fn, params;
944
- node = parseMultiplyDivideModulusPercentage(state);
935
+ node = parseMultiplyDivideModulus(state);
945
936
  const operators = {
946
937
  '+': 'add',
947
938
  '-': 'subtract'
@@ -950,7 +941,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
950
941
  name = state.token;
951
942
  fn = operators[name];
952
943
  getTokenSkipNewline(state);
953
- const rightNode = parseMultiplyDivideModulusPercentage(state);
944
+ const rightNode = parseMultiplyDivideModulus(state);
954
945
  if (rightNode.isPercentage) {
955
946
  params = [node, new OperatorNode('*', 'multiply', [node, rightNode])];
956
947
  } else {
@@ -962,11 +953,11 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
962
953
  }
963
954
 
964
955
  /**
965
- * multiply, divide, modulus, percentage
956
+ * multiply, divide, modulus
966
957
  * @return {Node} node
967
958
  * @private
968
959
  */
969
- function parseMultiplyDivideModulusPercentage(state) {
960
+ function parseMultiplyDivideModulus(state) {
970
961
  let node, last, name, fn;
971
962
  node = parseImplicitMultiplication(state);
972
963
  last = node;
@@ -984,23 +975,8 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
984
975
  name = state.token;
985
976
  fn = operators[name];
986
977
  getTokenSkipNewline(state);
987
- if (name === '%' && state.tokenType === TOKENTYPE.DELIMITER && state.token !== '(') {
988
- // If the expression contains only %, then treat that as /100
989
- if (state.token !== '' && operators[state.token]) {
990
- const left = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true);
991
- name = state.token;
992
- fn = operators[name];
993
- getTokenSkipNewline(state);
994
- last = parseImplicitMultiplication(state);
995
- node = new OperatorNode(name, fn, [left, last]);
996
- } else {
997
- node = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true);
998
- }
999
- // return node
1000
- } else {
1001
- last = parseImplicitMultiplication(state);
1002
- node = new OperatorNode(name, fn, [node, last]);
1003
- }
978
+ last = parseImplicitMultiplication(state);
979
+ node = new OperatorNode(name, fn, [node, last]);
1004
980
  } else {
1005
981
  break;
1006
982
  }
@@ -1043,7 +1019,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
1043
1019
  * @private
1044
1020
  */
1045
1021
  function parseRule2(state) {
1046
- let node = parseUnary(state);
1022
+ let node = parseUnaryPercentage(state);
1047
1023
  let last = node;
1048
1024
  const tokenStates = [];
1049
1025
  while (true) {
@@ -1065,7 +1041,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
1065
1041
  // Rewind once and build the "number / number" node; the symbol will be consumed later
1066
1042
  (0, _extends2.default)(state, tokenStates.pop());
1067
1043
  tokenStates.pop();
1068
- last = parseUnary(state);
1044
+ last = parseUnaryPercentage(state);
1069
1045
  node = new OperatorNode('/', 'divide', [node, last]);
1070
1046
  } else {
1071
1047
  // Not a match, so rewind
@@ -1085,6 +1061,34 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
1085
1061
  return node;
1086
1062
  }
1087
1063
 
1064
+ /**
1065
+ * Unary percentage operator (treated as `value / 100`)
1066
+ * @return {Node} node
1067
+ * @private
1068
+ */
1069
+ function parseUnaryPercentage(state) {
1070
+ let node = parseUnary(state);
1071
+ if (state.token === '%') {
1072
+ const previousState = (0, _extends2.default)({}, state);
1073
+ getTokenSkipNewline(state);
1074
+ // We need to decide if this is a unary percentage % or binary modulo %
1075
+ // So we attempt to parse a unary expression at this point.
1076
+ // If it fails, then the only possibility is that this is a unary percentage.
1077
+ // If it succeeds, then we presume that this must be binary modulo, since the
1078
+ // only things that parseUnary can handle are _higher_ precedence than unary %.
1079
+ try {
1080
+ parseUnary(state);
1081
+ // Not sure if we could somehow use the result of that parseUnary? Without
1082
+ // further analysis/testing, safer just to discard and let the parse proceed
1083
+ (0, _extends2.default)(state, previousState);
1084
+ } catch (_unused) {
1085
+ // Not seeing a term at this point, so was a unary %
1086
+ node = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true);
1087
+ }
1088
+ }
1089
+ return node;
1090
+ }
1091
+
1088
1092
  /**
1089
1093
  * Unary plus and minus, and logical and bitwise not
1090
1094
  * @return {Node} node
@@ -23,7 +23,8 @@ const createSylvester = exports.createSylvester = /* #__PURE__ */(0, _factory.fa
23
23
  subtract,
24
24
  identity,
25
25
  lusolve,
26
- abs
26
+ abs,
27
+ config
27
28
  } = _ref;
28
29
  /**
29
30
  *
@@ -94,7 +95,7 @@ const createSylvester = exports.createSylvester = /* #__PURE__ */(0, _factory.fa
94
95
  const vc = (a, b) => concat(a, b, 0);
95
96
  for (let k = 0; k < n; k++) {
96
97
  if (k < n - 1 && abs(subset(G, index(k + 1, k))) > 1e-5) {
97
- let RHS = vc(subset(D, index(all, k)), subset(D, index(all, k + 1)));
98
+ let RHS = vc(subset(D, index(all, [k])), subset(D, index(all, [k + 1])));
98
99
  for (let j = 0; j < k; j++) {
99
100
  RHS = add(RHS, vc(multiply(y[j], subset(G, index(j, k))), multiply(y[j], subset(G, index(j, k + 1)))));
100
101
  }
@@ -104,11 +105,11 @@ const createSylvester = exports.createSylvester = /* #__PURE__ */(0, _factory.fa
104
105
  const gmm = multiply(identity(m), multiply(-1, subset(G, index(k + 1, k + 1))));
105
106
  const LHS = vc(hc(add(F, gkk), gmk), hc(gkm, add(F, gmm)));
106
107
  const yAux = lusolve(LHS, RHS);
107
- y[k] = yAux.subset(index(range(0, m), 0));
108
- y[k + 1] = yAux.subset(index(range(m, 2 * m), 0));
108
+ y[k] = yAux.subset(index(range(0, m), [0]));
109
+ y[k + 1] = yAux.subset(index(range(m, 2 * m), [0]));
109
110
  k++;
110
111
  } else {
111
- let RHS = subset(D, index(all, k));
112
+ let RHS = subset(D, index(all, [k]));
112
113
  for (let j = 0; j < k; j++) {
113
114
  RHS = add(RHS, multiply(y[j], subset(G, index(j, k))));
114
115
  }
@@ -68,8 +68,8 @@ const createNullish = exports.createNullish = /* #__PURE__ */(0, _factory.factor
68
68
  'undefined, any': (_x, y) => y,
69
69
  // SparseMatrix-first with collection RHS: enforce exact shape match
70
70
  'SparseMatrix, Array | Matrix': (x, y) => {
71
- const sx = flatten(size(x).valueOf()); // work around #3529/#3530
72
- const sy = flatten(size(y).valueOf());
71
+ const sx = size(x);
72
+ const sy = size(y);
73
73
  if (deepEqual(sx, sy)) return x;
74
74
  throw new _DimensionError.DimensionError(sx, sy);
75
75
  },
@@ -58,8 +58,9 @@ const createColumn = exports.createColumn = /* #__PURE__ */(0, _factory.factory)
58
58
  }
59
59
  (0, _array.validateIndex)(column, value.size()[1]);
60
60
  const rowRange = range(0, value.size()[0]);
61
- const index = new Index(rowRange, column);
61
+ const index = new Index(rowRange, [column]);
62
62
  const result = value.subset(index);
63
+ // once config.legacySubset just return result
63
64
  return (0, _is.isMatrix)(result) ? result : matrix([[result]]);
64
65
  }
65
66
  });