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
@@ -27,5 +27,9 @@ const DEFAULT_CONFIG = exports.DEFAULT_CONFIG = {
27
27
  predictable: false,
28
28
  // random seed for seeded pseudo random number generation
29
29
  // null = randomly seed
30
- randomSeed: null
30
+ randomSeed: null,
31
+ // legacy behavior for matrix subset. When true, the subset function
32
+ // returns a matrix or array with the same size as the index (except for scalars).
33
+ // When false, it returns a matrix or array with a size depending on the type of index.
34
+ legacySubset: false
31
35
  };
@@ -66,6 +66,10 @@ function configFactory(config, emit) {
66
66
  delete optionsFix.epsilon;
67
67
  return _config(optionsFix);
68
68
  }
69
+ if (options.legacySubset === true) {
70
+ // this if is only for backwards compatibility, it can be removed in the future.
71
+ console.warn('Warning: The configuration option "legacySubset" is for compatibility only and might be deprecated in the future.');
72
+ }
69
73
  const prev = (0, _object.clone)(config);
70
74
 
71
75
  // validate some of the options
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.sizeDependencies = void 0;
7
- var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
8
7
  var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
9
8
  var _factoriesAny = require("../../factoriesAny.js");
10
9
  /**
@@ -13,7 +12,6 @@ var _factoriesAny = require("../../factoriesAny.js");
13
12
  */
14
13
 
15
14
  const sizeDependencies = exports.sizeDependencies = {
16
- matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
17
15
  typedDependencies: _dependenciesTypedGenerated.typedDependencies,
18
16
  createSize: _factoriesAny.createSize
19
17
  };
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.sizeDependencies = void 0;
7
- var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
8
7
  var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
9
8
  var _factoriesNumber = require("../../factoriesNumber.js");
10
9
  /**
@@ -13,7 +12,6 @@ var _factoriesNumber = require("../../factoriesNumber.js");
13
12
  */
14
13
 
15
14
  const sizeDependencies = exports.sizeDependencies = {
16
- matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
17
15
  typedDependencies: _dependenciesTypedGenerated.typedDependencies,
18
16
  createSize: _factoriesNumber.createSize
19
17
  };
@@ -72,6 +72,10 @@ const chain = exports.chain = (0, _factoriesAny.createChain)({
72
72
  Chain,
73
73
  typed: _pureFunctionsAnyGenerated.typed
74
74
  });
75
+ const IndexNode = exports.IndexNode = (0, _factoriesAny.createIndexNode)({
76
+ Node,
77
+ size: _pureFunctionsAnyGenerated.size
78
+ });
75
79
  const AccessorNode = exports.AccessorNode = (0, _factoriesAny.createAccessorNode)({
76
80
  Node,
77
81
  subset: _pureFunctionsAnyGenerated.subset
@@ -81,10 +85,6 @@ const AssignmentNode = exports.AssignmentNode = (0, _factoriesAny.createAssignme
81
85
  Node,
82
86
  subset: _pureFunctionsAnyGenerated.subset
83
87
  });
84
- const IndexNode = exports.IndexNode = (0, _factoriesAny.createIndexNode)({
85
- Node,
86
- size: _pureFunctionsAnyGenerated.size
87
- });
88
88
  const SymbolNode = exports.SymbolNode = (0, _factoriesAny.createSymbolNode)({
89
89
  Unit: _pureFunctionsAnyGenerated.Unit,
90
90
  Node,
@@ -331,6 +331,7 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
331
331
  sec: _pureFunctionsAnyGenerated.sec,
332
332
  sign: _pureFunctionsAnyGenerated.sign,
333
333
  sin: _pureFunctionsAnyGenerated.sin,
334
+ size: _pureFunctionsAnyGenerated.size,
334
335
  splitUnit: _pureFunctionsAnyGenerated.splitUnit,
335
336
  square: _pureFunctionsAnyGenerated.square,
336
337
  string: _pureFunctionsAnyGenerated.string,
@@ -346,11 +347,13 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
346
347
  combinationsWithRep: _pureFunctionsAnyGenerated.combinationsWithRep,
347
348
  cosh: _pureFunctionsAnyGenerated.cosh,
348
349
  csch: _pureFunctionsAnyGenerated.csch,
350
+ dot: _pureFunctionsAnyGenerated.dot,
349
351
  isNaN: _pureFunctionsAnyGenerated.isNaN,
350
352
  isPrime: _pureFunctionsAnyGenerated.isPrime,
351
353
  mapSlices: _pureFunctionsAnyGenerated.mapSlices,
352
354
  matrix: _pureFunctionsAnyGenerated.matrix,
353
355
  matrixFromFunction: _pureFunctionsAnyGenerated.matrixFromFunction,
356
+ multiply: _pureFunctionsAnyGenerated.multiply,
354
357
  ones: _pureFunctionsAnyGenerated.ones,
355
358
  randomInt: _pureFunctionsAnyGenerated.randomInt,
356
359
  reshape: _pureFunctionsAnyGenerated.reshape,
@@ -378,6 +381,7 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
378
381
  kron: _pureFunctionsAnyGenerated.kron,
379
382
  largerEq: _pureFunctionsAnyGenerated.largerEq,
380
383
  leftShift: _pureFunctionsAnyGenerated.leftShift,
384
+ matrixFromRows: _pureFunctionsAnyGenerated.matrixFromRows,
381
385
  mode: _pureFunctionsAnyGenerated.mode,
382
386
  nthRoot: _pureFunctionsAnyGenerated.nthRoot,
383
387
  numeric: _pureFunctionsAnyGenerated.numeric,
@@ -385,7 +389,6 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
385
389
  resize: _pureFunctionsAnyGenerated.resize,
386
390
  rightArithShift: _pureFunctionsAnyGenerated.rightArithShift,
387
391
  round: _pureFunctionsAnyGenerated.round,
388
- size: _pureFunctionsAnyGenerated.size,
389
392
  smaller: _pureFunctionsAnyGenerated.smaller,
390
393
  to: _pureFunctionsAnyGenerated.to,
391
394
  unaryMinus: _pureFunctionsAnyGenerated.unaryMinus,
@@ -402,7 +405,6 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
402
405
  count: _pureFunctionsAnyGenerated.count,
403
406
  deepEqual: _pureFunctionsAnyGenerated.deepEqual,
404
407
  divideScalar: _pureFunctionsAnyGenerated.divideScalar,
405
- dotDivide: _pureFunctionsAnyGenerated.dotDivide,
406
408
  equalText: _pureFunctionsAnyGenerated.equalText,
407
409
  floor: _pureFunctionsAnyGenerated.floor,
408
410
  gcd: _pureFunctionsAnyGenerated.gcd,
@@ -412,7 +414,6 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
412
414
  log: _pureFunctionsAnyGenerated.log,
413
415
  lsolve: _pureFunctionsAnyGenerated.lsolve,
414
416
  matrixFromColumns: _pureFunctionsAnyGenerated.matrixFromColumns,
415
- max: _pureFunctionsAnyGenerated.max,
416
417
  min: _pureFunctionsAnyGenerated.min,
417
418
  mod: _pureFunctionsAnyGenerated.mod,
418
419
  nthRoots: _pureFunctionsAnyGenerated.nthRoots,
@@ -426,19 +427,22 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
426
427
  subtract: _pureFunctionsAnyGenerated.subtract,
427
428
  trace: _pureFunctionsAnyGenerated.trace,
428
429
  usolve: _pureFunctionsAnyGenerated.usolve,
430
+ zpk2tf: _pureFunctionsAnyGenerated.zpk2tf,
429
431
  catalan: _pureFunctionsAnyGenerated.catalan,
430
432
  compareNatural: _pureFunctionsAnyGenerated.compareNatural,
431
433
  composition: _pureFunctionsAnyGenerated.composition,
434
+ cross: _pureFunctionsAnyGenerated.cross,
435
+ det: _pureFunctionsAnyGenerated.det,
432
436
  diff: _pureFunctionsAnyGenerated.diff,
433
437
  distance: _pureFunctionsAnyGenerated.distance,
434
- dot: _pureFunctionsAnyGenerated.dot,
438
+ dotDivide: _pureFunctionsAnyGenerated.dotDivide,
435
439
  index: _pureFunctionsAnyGenerated.index,
440
+ intersect: _pureFunctionsAnyGenerated.intersect,
436
441
  invmod: _pureFunctionsAnyGenerated.invmod,
437
442
  lcm: _pureFunctionsAnyGenerated.lcm,
438
443
  log1p: _pureFunctionsAnyGenerated.log1p,
439
444
  lsolveAll: _pureFunctionsAnyGenerated.lsolveAll,
440
- matrixFromRows: _pureFunctionsAnyGenerated.matrixFromRows,
441
- multiply: _pureFunctionsAnyGenerated.multiply,
445
+ max: _pureFunctionsAnyGenerated.max,
442
446
  range: _pureFunctionsAnyGenerated.range,
443
447
  row: _pureFunctionsAnyGenerated.row,
444
448
  setCartesian: _pureFunctionsAnyGenerated.setCartesian,
@@ -449,21 +453,22 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
449
453
  sort: _pureFunctionsAnyGenerated.sort,
450
454
  unaryPlus: _pureFunctionsAnyGenerated.unaryPlus,
451
455
  usolveAll: _pureFunctionsAnyGenerated.usolveAll,
452
- zpk2tf: _pureFunctionsAnyGenerated.zpk2tf,
453
456
  and: _pureFunctionsAnyGenerated.and,
454
457
  ceil: _pureFunctionsAnyGenerated.ceil,
455
458
  column: _pureFunctionsAnyGenerated.column,
456
- cross: _pureFunctionsAnyGenerated.cross,
457
- det: _pureFunctionsAnyGenerated.det,
459
+ cumsum: _pureFunctionsAnyGenerated.cumsum,
458
460
  fix: _pureFunctionsAnyGenerated.fix,
459
- inv: _pureFunctionsAnyGenerated.inv,
460
- pinv: _pureFunctionsAnyGenerated.pinv,
461
- pow: _pureFunctionsAnyGenerated.pow,
462
461
  setDifference: _pureFunctionsAnyGenerated.setDifference,
463
462
  setMultiplicity: _pureFunctionsAnyGenerated.setMultiplicity,
464
463
  setSymDifference: _pureFunctionsAnyGenerated.setSymDifference,
465
- sqrtm: _pureFunctionsAnyGenerated.sqrtm,
466
464
  sum: _pureFunctionsAnyGenerated.sum,
465
+ inv: _pureFunctionsAnyGenerated.inv,
466
+ lup: _pureFunctionsAnyGenerated.lup,
467
+ pinv: _pureFunctionsAnyGenerated.pinv,
468
+ pow: _pureFunctionsAnyGenerated.pow,
469
+ setIntersect: _pureFunctionsAnyGenerated.setIntersect,
470
+ setUnion: _pureFunctionsAnyGenerated.setUnion,
471
+ sqrtm: _pureFunctionsAnyGenerated.sqrtm,
467
472
  vacuumImpedance: _pureFunctionsAnyGenerated.vacuumImpedance,
468
473
  wienDisplacement: _pureFunctionsAnyGenerated.wienDisplacement,
469
474
  atomicMass: _pureFunctionsAnyGenerated.atomicMass,
@@ -483,7 +488,6 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
483
488
  gravitationConstant: _pureFunctionsAnyGenerated.gravitationConstant,
484
489
  hartreeEnergy: _pureFunctionsAnyGenerated.hartreeEnergy,
485
490
  ifft: _pureFunctionsAnyGenerated.ifft,
486
- inverseConductanceQuantum: _pureFunctionsAnyGenerated.inverseConductanceQuantum,
487
491
  klitzing: _pureFunctionsAnyGenerated.klitzing,
488
492
  loschmidt: _pureFunctionsAnyGenerated.loschmidt,
489
493
  magneticConstant: _pureFunctionsAnyGenerated.magneticConstant,
@@ -499,7 +503,6 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
499
503
  reducedPlanckConstant: _pureFunctionsAnyGenerated.reducedPlanckConstant,
500
504
  rydberg: _pureFunctionsAnyGenerated.rydberg,
501
505
  secondRadiation: _pureFunctionsAnyGenerated.secondRadiation,
502
- setSize: _pureFunctionsAnyGenerated.setSize,
503
506
  speedOfLight: _pureFunctionsAnyGenerated.speedOfLight,
504
507
  stefanBoltzmann: _pureFunctionsAnyGenerated.stefanBoltzmann,
505
508
  thomsonCrossSection: _pureFunctionsAnyGenerated.thomsonCrossSection,
@@ -511,8 +514,8 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
511
514
  factorial: _pureFunctionsAnyGenerated.factorial,
512
515
  firstRadiation: _pureFunctionsAnyGenerated.firstRadiation,
513
516
  gravity: _pureFunctionsAnyGenerated.gravity,
514
- intersect: _pureFunctionsAnyGenerated.intersect,
515
- lup: _pureFunctionsAnyGenerated.lup,
517
+ inverseConductanceQuantum: _pureFunctionsAnyGenerated.inverseConductanceQuantum,
518
+ lusolve: _pureFunctionsAnyGenerated.lusolve,
516
519
  magneticFluxQuantum: _pureFunctionsAnyGenerated.magneticFluxQuantum,
517
520
  molarMassC12: _pureFunctionsAnyGenerated.molarMassC12,
518
521
  multinomial: _pureFunctionsAnyGenerated.multinomial,
@@ -521,24 +524,21 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
521
524
  planckMass: _pureFunctionsAnyGenerated.planckMass,
522
525
  polynomialRoot: _pureFunctionsAnyGenerated.polynomialRoot,
523
526
  resolve,
524
- setIntersect: _pureFunctionsAnyGenerated.setIntersect,
527
+ setSize: _pureFunctionsAnyGenerated.setSize,
525
528
  simplifyConstant,
526
529
  solveODE: _pureFunctionsAnyGenerated.solveODE,
527
530
  stirlingS2: _pureFunctionsAnyGenerated.stirlingS2,
528
531
  unit: _pureFunctionsAnyGenerated.unit,
529
532
  bellNumbers: _pureFunctionsAnyGenerated.bellNumbers,
530
533
  compile,
531
- cumsum: _pureFunctionsAnyGenerated.cumsum,
532
534
  eigs: _pureFunctionsAnyGenerated.eigs,
533
535
  fermiCoupling: _pureFunctionsAnyGenerated.fermiCoupling,
534
536
  gasConstant: _pureFunctionsAnyGenerated.gasConstant,
535
537
  kldivergence: _pureFunctionsAnyGenerated.kldivergence,
536
- lusolve: _pureFunctionsAnyGenerated.lusolve,
537
538
  mean: _pureFunctionsAnyGenerated.mean,
538
539
  molarVolume: _pureFunctionsAnyGenerated.molarVolume,
539
540
  planckConstant: _pureFunctionsAnyGenerated.planckConstant,
540
541
  quantileSeq: _pureFunctionsAnyGenerated.quantileSeq,
541
- setUnion: _pureFunctionsAnyGenerated.setUnion,
542
542
  simplifyCore,
543
543
  variance: _pureFunctionsAnyGenerated.variance,
544
544
  classicalElectronRadius: _pureFunctionsAnyGenerated.classicalElectronRadius,
@@ -600,9 +600,12 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
600
600
  matrix: _pureFunctionsAnyGenerated.matrix,
601
601
  typed: _pureFunctionsAnyGenerated.typed
602
602
  }),
603
- index: (0, _factoriesAny.createIndexTransform)({
604
- Index: _pureFunctionsAnyGenerated.Index,
605
- getMatrixDataType: _pureFunctionsAnyGenerated.getMatrixDataType
603
+ max: (0, _factoriesAny.createMaxTransform)({
604
+ config: _configReadonly.config,
605
+ isNaN: _pureFunctionsAnyGenerated.isNaN,
606
+ larger: _pureFunctionsAnyGenerated.larger,
607
+ numeric: _pureFunctionsAnyGenerated.numeric,
608
+ typed: _pureFunctionsAnyGenerated.typed
606
609
  }),
607
610
  print: (0, _factoriesAny.createPrintTransform)({
608
611
  add: _pureFunctionsAnyGenerated.add,
@@ -652,11 +655,6 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
652
655
  matrix: _pureFunctionsAnyGenerated.matrix,
653
656
  typed: _pureFunctionsAnyGenerated.typed
654
657
  }),
655
- cumsum: (0, _factoriesAny.createCumSumTransform)({
656
- add: _pureFunctionsAnyGenerated.add,
657
- typed: _pureFunctionsAnyGenerated.typed,
658
- unaryPlus: _pureFunctionsAnyGenerated.unaryPlus
659
- }),
660
658
  diff: (0, _factoriesAny.createDiffTransform)({
661
659
  bignumber: _pureFunctionsAnyGenerated.bignumber,
662
660
  matrix: _pureFunctionsAnyGenerated.matrix,
@@ -664,12 +662,9 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
664
662
  subtract: _pureFunctionsAnyGenerated.subtract,
665
663
  typed: _pureFunctionsAnyGenerated.typed
666
664
  }),
667
- max: (0, _factoriesAny.createMaxTransform)({
668
- config: _configReadonly.config,
669
- isNaN: _pureFunctionsAnyGenerated.isNaN,
670
- larger: _pureFunctionsAnyGenerated.larger,
671
- numeric: _pureFunctionsAnyGenerated.numeric,
672
- typed: _pureFunctionsAnyGenerated.typed
665
+ index: (0, _factoriesAny.createIndexTransform)({
666
+ Index: _pureFunctionsAnyGenerated.Index,
667
+ getMatrixDataType: _pureFunctionsAnyGenerated.getMatrixDataType
673
668
  }),
674
669
  range: (0, _factoriesAny.createRangeTransform)({
675
670
  bignumber: _pureFunctionsAnyGenerated.bignumber,
@@ -697,6 +692,11 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
697
692
  range: _pureFunctionsAnyGenerated.range,
698
693
  typed: _pureFunctionsAnyGenerated.typed
699
694
  }),
695
+ cumsum: (0, _factoriesAny.createCumSumTransform)({
696
+ add: _pureFunctionsAnyGenerated.add,
697
+ typed: _pureFunctionsAnyGenerated.typed,
698
+ unaryPlus: _pureFunctionsAnyGenerated.unaryPlus
699
+ }),
700
700
  mean: (0, _factoriesAny.createMeanTransform)({
701
701
  add: _pureFunctionsAnyGenerated.add,
702
702
  divide: _pureFunctionsAnyGenerated.divide,
@@ -754,12 +754,12 @@ const help = exports.help = (0, _factoriesAny.createHelp)({
754
754
  Chain,
755
755
  FunctionAssignmentNode,
756
756
  SparseMatrix: _pureFunctionsAnyGenerated.SparseMatrix,
757
+ IndexNode,
757
758
  ImmutableDenseMatrix: _pureFunctionsAnyGenerated.ImmutableDenseMatrix,
758
759
  Index: _pureFunctionsAnyGenerated.Index,
759
760
  AccessorNode,
760
761
  AssignmentNode,
761
762
  FibonacciHeap: _pureFunctionsAnyGenerated.FibonacciHeap,
762
- IndexNode,
763
763
  Spa: _pureFunctionsAnyGenerated.Spa,
764
764
  Unit: _pureFunctionsAnyGenerated.Unit,
765
765
  SymbolNode,