mathjs 14.2.0 → 14.3.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 (73) hide show
  1. package/HISTORY.md +20 -0
  2. package/lib/browser/math.js +1 -1
  3. package/lib/browser/math.js.LICENSE.txt +2 -2
  4. package/lib/browser/math.js.map +1 -1
  5. package/lib/cjs/entry/dependenciesAny/dependenciesMax.generated.js +2 -0
  6. package/lib/cjs/entry/dependenciesAny/dependenciesMaxTransform.generated.js +2 -0
  7. package/lib/cjs/entry/dependenciesAny/dependenciesMin.generated.js +2 -0
  8. package/lib/cjs/entry/dependenciesAny/dependenciesMinTransform.generated.js +2 -0
  9. package/lib/cjs/entry/dependenciesNumber/dependenciesMax.generated.js +2 -0
  10. package/lib/cjs/entry/dependenciesNumber/dependenciesMaxTransform.generated.js +2 -0
  11. package/lib/cjs/entry/dependenciesNumber/dependenciesMin.generated.js +2 -0
  12. package/lib/cjs/entry/dependenciesNumber/dependenciesMinTransform.generated.js +2 -0
  13. package/lib/cjs/entry/impureFunctionsAny.generated.js +2 -0
  14. package/lib/cjs/entry/impureFunctionsNumber.generated.js +2 -0
  15. package/lib/cjs/entry/pureFunctionsAny.generated.js +2 -0
  16. package/lib/cjs/entry/pureFunctionsNumber.generated.js +2 -0
  17. package/lib/cjs/expression/embeddedDocs/function/matrix/mapSlices.js +1 -1
  18. package/lib/cjs/expression/embeddedDocs/function/relational/larger.js +1 -1
  19. package/lib/cjs/expression/embeddedDocs/function/relational/smaller.js +1 -1
  20. package/lib/cjs/expression/embeddedDocs/function/statistics/max.js +1 -1
  21. package/lib/cjs/expression/embeddedDocs/function/statistics/min.js +1 -1
  22. package/lib/cjs/expression/transform/max.transform.js +5 -3
  23. package/lib/cjs/expression/transform/min.transform.js +5 -3
  24. package/lib/cjs/expression/transform/variance.transform.js +2 -2
  25. package/lib/cjs/function/matrix/flatten.js +1 -1
  26. package/lib/cjs/function/matrix/forEach.js +1 -1
  27. package/lib/cjs/function/matrix/map.js +1 -1
  28. package/lib/cjs/function/matrix/partitionSelect.js +2 -2
  29. package/lib/cjs/function/statistics/max.js +5 -4
  30. package/lib/cjs/function/statistics/min.js +5 -4
  31. package/lib/cjs/function/statistics/mode.js +2 -2
  32. package/lib/cjs/function/statistics/variance.js +2 -2
  33. package/lib/cjs/header.js +2 -2
  34. package/lib/cjs/type/matrix/DenseMatrix.js +45 -48
  35. package/lib/cjs/utils/array.js +120 -48
  36. package/lib/cjs/utils/collection.js +14 -15
  37. package/lib/cjs/utils/optimizeCallback.js +19 -2
  38. package/lib/cjs/version.js +1 -1
  39. package/lib/esm/entry/dependenciesAny/dependenciesMax.generated.js +2 -0
  40. package/lib/esm/entry/dependenciesAny/dependenciesMaxTransform.generated.js +2 -0
  41. package/lib/esm/entry/dependenciesAny/dependenciesMin.generated.js +2 -0
  42. package/lib/esm/entry/dependenciesAny/dependenciesMinTransform.generated.js +2 -0
  43. package/lib/esm/entry/dependenciesNumber/dependenciesMax.generated.js +2 -0
  44. package/lib/esm/entry/dependenciesNumber/dependenciesMaxTransform.generated.js +2 -0
  45. package/lib/esm/entry/dependenciesNumber/dependenciesMin.generated.js +2 -0
  46. package/lib/esm/entry/dependenciesNumber/dependenciesMinTransform.generated.js +2 -0
  47. package/lib/esm/entry/impureFunctionsAny.generated.js +2 -0
  48. package/lib/esm/entry/impureFunctionsNumber.generated.js +2 -0
  49. package/lib/esm/entry/pureFunctionsAny.generated.js +2 -0
  50. package/lib/esm/entry/pureFunctionsNumber.generated.js +2 -0
  51. package/lib/esm/expression/embeddedDocs/function/matrix/mapSlices.js +1 -1
  52. package/lib/esm/expression/embeddedDocs/function/relational/larger.js +1 -1
  53. package/lib/esm/expression/embeddedDocs/function/relational/smaller.js +1 -1
  54. package/lib/esm/expression/embeddedDocs/function/statistics/max.js +1 -1
  55. package/lib/esm/expression/embeddedDocs/function/statistics/min.js +1 -1
  56. package/lib/esm/expression/transform/max.transform.js +5 -3
  57. package/lib/esm/expression/transform/min.transform.js +5 -3
  58. package/lib/esm/expression/transform/variance.transform.js +2 -2
  59. package/lib/esm/function/matrix/flatten.js +1 -1
  60. package/lib/esm/function/matrix/forEach.js +2 -2
  61. package/lib/esm/function/matrix/map.js +2 -2
  62. package/lib/esm/function/matrix/partitionSelect.js +2 -2
  63. package/lib/esm/function/statistics/max.js +5 -4
  64. package/lib/esm/function/statistics/min.js +5 -4
  65. package/lib/esm/function/statistics/mode.js +2 -2
  66. package/lib/esm/function/statistics/variance.js +2 -2
  67. package/lib/esm/type/matrix/DenseMatrix.js +46 -49
  68. package/lib/esm/utils/array.js +118 -47
  69. package/lib/esm/utils/collection.js +15 -16
  70. package/lib/esm/utils/optimizeCallback.js +19 -2
  71. package/lib/esm/version.js +1 -1
  72. package/package.json +10 -11
  73. package/types/index.d.ts +2 -1
@@ -11,7 +11,7 @@ import { deepStrictEqual } from './object.js';
11
11
  * This function checks the size of the first entry, it does not validate
12
12
  * whether all dimensions match. (use function `validate` for that)
13
13
  * @param {Array} x
14
- * @Return {Number[]} size
14
+ * @return {number[]} size
15
15
  */
16
16
  export function arraySize(x) {
17
17
  var s = [];
@@ -27,7 +27,7 @@ export function arraySize(x) {
27
27
  * has a size corresponding to the provided size array.
28
28
  * @param {Array} array Array to be validated
29
29
  * @param {number[]} size Array with the size of each dimension
30
- * @param {number} dim Current dimension
30
+ * @param {number} dim Current dimension
31
31
  * @throws DimensionError
32
32
  * @private
33
33
  */
@@ -48,7 +48,7 @@ function _validate(array, size, dim) {
48
48
  _validate(array[i], size, dimNext);
49
49
  }
50
50
  } else {
51
- // last dimension. none of the childs may be an array
51
+ // last dimension. none of the children may be an array
52
52
  for (i = 0; i < len; i++) {
53
53
  if (Array.isArray(array[i])) {
54
54
  throw new DimensionError(size.length + 1, size.length, '>');
@@ -79,7 +79,7 @@ export function validate(array, size) {
79
79
 
80
80
  /**
81
81
  * Validate whether the source of the index matches the size of the Array
82
- * @param {Array | Matrix} array Array to be validated
82
+ * @param {Array | Matrix} value Array to be validated
83
83
  * @param {Index} index Index with the source information to validate
84
84
  * @throws DimensionError
85
85
  */
@@ -112,8 +112,8 @@ export function validateIndex(index, length) {
112
112
  }
113
113
 
114
114
  /**
115
- * Test if and index has empty values
116
- * @param {number} index Zero-based index
115
+ * Test if an index has empty values
116
+ * @param {Index} index Zero-based index
117
117
  */
118
118
  export function isEmptyIndex(index) {
119
119
  for (var i = 0; i < index._dimensions.length; ++i) {
@@ -139,7 +139,7 @@ export function isEmptyIndex(index) {
139
139
  * Resize a multi dimensional array. The resized array is returned.
140
140
  * @param {Array | number} array Array to be resized
141
141
  * @param {number[]} size Array with the size of each dimension
142
- * @param {*} [defaultValue=0] Value to be filled in in new entries,
142
+ * @param {*} [defaultValue=0] Value to be filled in new entries,
143
143
  * zero by default. Specify for example `null`,
144
144
  * to clearly see entries that are not explicitly
145
145
  * set.
@@ -177,7 +177,7 @@ export function resize(array, size, defaultValue) {
177
177
  * @param {Array} array Array to be resized
178
178
  * @param {number[]} size Array with the size of each dimension
179
179
  * @param {number} dim Current dimension
180
- * @param {*} [defaultValue] Value to be filled in in new entries,
180
+ * @param {*} [defaultValue] Value to be filled in new entries,
181
181
  * undefined by default.
182
182
  * @private
183
183
  */
@@ -267,7 +267,7 @@ export function reshape(array, sizes) {
267
267
 
268
268
  /**
269
269
  * Replaces the wildcard -1 in the sizes array.
270
- * @param {number[]} sizes List of sizes for each dimension. At most on wildcard.
270
+ * @param {number[]} sizes List of sizes for each dimension. At most one wildcard.
271
271
  * @param {number} currentLength Number of elements in the array.
272
272
  * @throws {Error} If more than one wildcard or unable to replace it.
273
273
  * @returns {number[]} The sizes array with wildcard replaced.
@@ -314,7 +314,7 @@ function _reshape(array, sizes) {
314
314
  // testing if there are enough elements for the requested shape
315
315
  var tmpArray = array;
316
316
  var tmpArray2;
317
- // for each dimensions starting by the last one and ignoring the first one
317
+ // for each dimension starting by the last one and ignoring the first one
318
318
  for (var sizeIndex = sizes.length - 1; sizeIndex > 0; sizeIndex--) {
319
319
  var size = sizes[sizeIndex];
320
320
  tmpArray2 = [];
@@ -385,7 +385,7 @@ function _squeeze(array, dims, dim) {
385
385
  /**
386
386
  * Unsqueeze a multi dimensional array: add dimensions when missing
387
387
  *
388
- * Paramter `size` will be mutated to match the new, unqueezed matrix size.
388
+ * Parameter `size` will be mutated to match the new, unsqueezed matrix size.
389
389
  *
390
390
  * @param {Array} array
391
391
  * @param {number} dims Desired number of dimensions of the array
@@ -418,7 +418,7 @@ export function unsqueeze(array, dims, outer, size) {
418
418
  * @param {Array} array
419
419
  * @param {number} dims Required number of dimensions
420
420
  * @param {number} dim Current dimension
421
- * @returns {Array | *} Returns the squeezed array
421
+ * @returns {Array | *} Returns the unsqueezed array
422
422
  * @private
423
423
  */
424
424
  function _unsqueeze(array, dims, dim) {
@@ -488,7 +488,7 @@ export function filter(array, callback) {
488
488
  }
489
489
 
490
490
  /**
491
- * Filter values in a callback given a regular expression
491
+ * Filter values in an array given a regular expression
492
492
  * @param {Array} array
493
493
  * @param {RegExp} regexp
494
494
  * @return {Array} Returns the filtered array
@@ -602,7 +602,7 @@ export function getArrayDataType(array, typeOf) {
602
602
 
603
603
  /**
604
604
  * Return the last item from an array
605
- * @param {array}
605
+ * @param {Array} array
606
606
  * @returns {*}
607
607
  */
608
608
  export function last(array) {
@@ -611,8 +611,8 @@ export function last(array) {
611
611
 
612
612
  /**
613
613
  * Get all but the last element of array.
614
- * @param {array}
615
- * @returns {*}
614
+ * @param {Array} array
615
+ * @returns {Array}
616
616
  */
617
617
  export function initial(array) {
618
618
  return array.slice(0, array.length - 1);
@@ -620,7 +620,7 @@ export function initial(array) {
620
620
 
621
621
  /**
622
622
  * Recursively concatenate two matrices.
623
- * The contents of the matrices is not cloned.
623
+ * The contents of the matrices are not cloned.
624
624
  * @param {Array} a Multi dimensional array
625
625
  * @param {Array} b Multi dimensional array
626
626
  * @param {number} concatDim The dimension on which to concatenate (zero-based)
@@ -649,8 +649,8 @@ function concatRecursive(a, b, concatDim, dim) {
649
649
  * Concatenates many arrays in the specified direction
650
650
  * @param {...Array} arrays All the arrays to concatenate
651
651
  * @param {number} concatDim The dimension on which to concatenate (zero-based)
652
- * @returns
653
- */
652
+ * @returns {Array}
653
+ */
654
654
  export function concat() {
655
655
  var arrays = Array.prototype.slice.call(arguments, 0, -1);
656
656
  var concatDim = Array.prototype.slice.call(arguments, -1);
@@ -667,9 +667,9 @@ export function concat() {
667
667
  }
668
668
 
669
669
  /**
670
- * Receives two or more sizes and get's the broadcasted size for both.
670
+ * Receives two or more sizes and gets the broadcasted size for both.
671
671
  * @param {...number[]} sizes Sizes to broadcast together
672
- * @returns
672
+ * @returns {number[]} The broadcasted size
673
673
  */
674
674
  export function broadcastSizes() {
675
675
  for (var _len = arguments.length, sizes = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -706,16 +706,16 @@ export function checkBroadcastingRules(size, toSize) {
706
706
  for (var j = 0; j < dim; j++) {
707
707
  var n = N - dim + j;
708
708
  if (size[j] < toSize[n] && size[j] > 1 || size[j] > toSize[n]) {
709
- throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(size, ") not possible to broadcast dimension ").concat(dim, " with size ").concat(size[j], " to size ").concat(toSize[n]));
709
+ throw new Error("shape mismatch: mismatch is found in arg with shape (".concat(size, ") not possible to broadcast dimension ").concat(dim, " with size ").concat(size[j], " to size ").concat(toSize[n]));
710
710
  }
711
711
  }
712
712
  }
713
713
 
714
714
  /**
715
715
  * Broadcasts a single array to a certain size
716
- * @param {array} array Array to be broadcasted
716
+ * @param {Array} array Array to be broadcasted
717
717
  * @param {number[]} toSize Size to broadcast the array
718
- * @returns The broadcasted array
718
+ * @returns {Array} The broadcasted array
719
719
  */
720
720
  export function broadcastTo(array, toSize) {
721
721
  var Asize = arraySize(array);
@@ -746,14 +746,14 @@ export function broadcastTo(array, toSize) {
746
746
  /**
747
747
  * Broadcasts arrays and returns the broadcasted arrays in an array
748
748
  * @param {...Array | any} arrays
749
- * @returns
749
+ * @returns {Array[]} The broadcasted arrays
750
750
  */
751
751
  export function broadcastArrays() {
752
752
  for (var _len2 = arguments.length, arrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
753
753
  arrays[_key2] = arguments[_key2];
754
754
  }
755
755
  if (arrays.length === 0) {
756
- throw new Error('Insuficient number of argumnets in function broadcastArrays');
756
+ throw new Error('Insufficient number of arguments in function broadcastArrays');
757
757
  }
758
758
  if (arrays.length === 1) {
759
759
  return arrays[0];
@@ -770,11 +770,11 @@ export function broadcastArrays() {
770
770
  }
771
771
 
772
772
  /**
773
- * stretches a matrix up to a certain size in a certain dimension
773
+ * Stretches a matrix up to a certain size in a certain dimension
774
774
  * @param {Array} arrayToStretch
775
775
  * @param {number[]} sizeToStretch
776
776
  * @param {number} dimToStretch
777
- * @returns
777
+ * @returns {Array} The stretched array
778
778
  */
779
779
  export function stretch(arrayToStretch, sizeToStretch, dimToStretch) {
780
780
  return concat(...Array(sizeToStretch).fill(arrayToStretch), dimToStretch);
@@ -784,13 +784,13 @@ export function stretch(arrayToStretch, sizeToStretch, dimToStretch) {
784
784
  * Retrieves a single element from an array given an index.
785
785
  *
786
786
  * @param {Array} array - The array from which to retrieve the value.
787
- * @param {Array<number>} idx - An array of indices specifying the position of the desired element in each dimension.
787
+ * @param {Array<number>} index - An array of indices specifying the position of the desired element in each dimension.
788
788
  * @returns {*} - The value at the specified position in the array.
789
789
  *
790
790
  * @example
791
791
  * const arr = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];
792
792
  * const index = [1, 0, 1];
793
- * console.log(getValue(arr, index)); // 6
793
+ * console.log(get(arr, index)); // 6
794
794
  */
795
795
  export function get(array, index) {
796
796
  if (!Array.isArray(array)) {
@@ -807,30 +807,101 @@ export function get(array, index) {
807
807
  }
808
808
 
809
809
  /**
810
- * Recursive function to map a multi-dimensional array.
810
+ * Recursively maps over each element of nested array using a provided callback function.
811
811
  *
812
- * @param {*} value - The current value being processed in the array.
813
- * @param {Array} index - The index of the current value being processed in the array.
814
- * @param {Array} array - The array being processed.
815
- * @param {Function} callback - Function that produces the element of the new Array, taking three arguments: the value of the element, the index of the element, and the Array being processed.
816
- * @returns {*} The new array with each element being the result of the callback function.
817
- */
818
- export function recurse(value, index, array, callback) {
819
- if (Array.isArray(value)) {
820
- return value.map(function (child, i) {
821
- // we create a copy of the index array and append the new index value
822
- return recurse(child, index.concat(i), array, callback);
823
- });
824
- } else {
825
- // invoke the callback function with the right number of arguments
826
- return callback(value, index, array);
812
+ * @param {Array} array - The array to be mapped.
813
+ * @param {Function} callback - The function to execute on each element, taking three arguments:
814
+ * - `value` (any): The current element being processed in the array.
815
+ * - `index` (Array<number>): The index of the current element being processed in the array.
816
+ * - `array` (Array): The array `deepMap` was called upon.
817
+ * @param {boolean} [skipIndex=false] - If true, the callback function is called with only the value.
818
+ * @returns {Array} A new array with each element being the result of the callback function.
819
+ */
820
+ export function deepMap(array, callback) {
821
+ var skipIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
822
+ if (array.length === 0) {
823
+ return [];
824
+ }
825
+ if (skipIndex) {
826
+ return recursiveMap(array);
827
+ }
828
+ var index = [];
829
+ return recursiveMapWithIndex(array, 0);
830
+ function recursiveMapWithIndex(value, depth) {
831
+ if (Array.isArray(value)) {
832
+ var N = value.length;
833
+ var result = Array(N);
834
+ for (var i = 0; i < N; i++) {
835
+ index[depth] = i;
836
+ result[i] = recursiveMapWithIndex(value[i], depth + 1);
837
+ }
838
+ return result;
839
+ } else {
840
+ return callback(value, index.slice(0, depth), array);
841
+ }
842
+ }
843
+ function recursiveMap(value) {
844
+ if (Array.isArray(value)) {
845
+ var N = value.length;
846
+ var result = Array(N);
847
+ for (var i = 0; i < N; i++) {
848
+ result[i] = recursiveMap(value[i]);
849
+ }
850
+ return result;
851
+ } else {
852
+ return callback(value);
853
+ }
854
+ }
855
+ }
856
+
857
+ /**
858
+ * Recursively iterates over each element in a multi-dimensional array and applies a callback function.
859
+ *
860
+ * @param {Array} array - The multi-dimensional array to iterate over.
861
+ * @param {Function} callback - The function to execute for each element. It receives three arguments:
862
+ * - {any} value: The current element being processed in the array.
863
+ * - {Array<number>} index: The index of the current element in each dimension.
864
+ * - {Array} array: The original array being processed.
865
+ * @param {boolean} [skipIndex=false] - If true, the callback function is called with only the value.
866
+ */
867
+ export function deepForEach(array, callback) {
868
+ var skipIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
869
+ if (array.length === 0) {
870
+ return;
871
+ }
872
+ if (skipIndex) {
873
+ recursiveForEach(array);
874
+ return;
875
+ }
876
+ var index = [];
877
+ recursiveForEachWithIndex(array, 0);
878
+ function recursiveForEachWithIndex(value, depth) {
879
+ if (Array.isArray(value)) {
880
+ var N = value.length;
881
+ for (var i = 0; i < N; i++) {
882
+ index[depth] = i;
883
+ recursiveForEachWithIndex(value[i], depth + 1);
884
+ }
885
+ } else {
886
+ callback(value, index.slice(0, depth), array);
887
+ }
888
+ }
889
+ function recursiveForEach(value) {
890
+ if (Array.isArray(value)) {
891
+ var N = value.length;
892
+ for (var i = 0; i < N; i++) {
893
+ recursiveForEach(value[i]);
894
+ }
895
+ } else {
896
+ callback(value);
897
+ }
827
898
  }
828
899
  }
829
900
 
830
901
  /**
831
902
  * Deep clones a multidimensional array
832
903
  * @param {Array} array
833
- * @returns cloned array
904
+ * @returns {Array} cloned array
834
905
  */
835
906
  export function clone(array) {
836
907
  return _extends([], array);
@@ -1,6 +1,6 @@
1
1
  import { isCollection, isMatrix } from './is.js';
2
2
  import { IndexError } from '../error/IndexError.js';
3
- import { arraySize } from './array.js';
3
+ import { arraySize, deepMap as arrayDeepMap, deepForEach as arrayDeepForEach } from './array.js';
4
4
  import { _switch } from './switch.js';
5
5
 
6
6
  /**
@@ -27,15 +27,9 @@ export function containsCollections(array) {
27
27
  */
28
28
  export function deepForEach(array, callback) {
29
29
  if (isMatrix(array)) {
30
- array = array.valueOf();
31
- }
32
- for (var i = 0, ii = array.length; i < ii; i++) {
33
- var value = array[i];
34
- if (Array.isArray(value)) {
35
- deepForEach(value, callback);
36
- } else {
37
- callback(value);
38
- }
30
+ array.forEach(x => callback(x));
31
+ } else {
32
+ arrayDeepForEach(array, callback, true);
39
33
  }
40
34
  }
41
35
 
@@ -52,13 +46,18 @@ export function deepForEach(array, callback) {
52
46
  * @return {Array | Matrix} res
53
47
  */
54
48
  export function deepMap(array, callback, skipZeros) {
55
- if (array && typeof array.map === 'function') {
56
- // TODO: replace array.map with a for loop to improve performance
57
- return array.map(function (x) {
58
- return deepMap(x, callback, skipZeros);
59
- });
49
+ if (!skipZeros) {
50
+ if (isMatrix(array)) {
51
+ return array.map(x => callback(x));
52
+ } else {
53
+ return arrayDeepMap(array, callback, true);
54
+ }
55
+ }
56
+ var skipZerosCallback = x => x === 0 ? x : callback(x);
57
+ if (isMatrix(array)) {
58
+ return array.map(x => skipZerosCallback(x));
60
59
  } else {
61
- return callback(array);
60
+ return arrayDeepMap(array, skipZerosCallback, true);
62
61
  }
63
62
  }
64
63
 
@@ -14,9 +14,14 @@ export function optimizeCallback(callback, array, name) {
14
14
  if (typed.isTypedFunction(callback)) {
15
15
  var firstIndex = (array.isMatrix ? array.size() : arraySize(array)).map(() => 0);
16
16
  var firstValue = array.isMatrix ? array.get(firstIndex) : get(array, firstIndex);
17
- var hasSingleSignature = Object.keys(callback.signatures).length === 1;
18
17
  var numberOfArguments = _findNumberOfArguments(callback, firstValue, firstIndex, array);
19
- var fastCallback = hasSingleSignature ? Object.values(callback.signatures)[0] : callback;
18
+ var fastCallback;
19
+ if (array.isMatrix && array.dataType !== 'mixed' && array.dataType !== undefined) {
20
+ var singleSignature = _findSingleSignatureWithArity(callback, numberOfArguments);
21
+ fastCallback = singleSignature !== undefined ? singleSignature : callback;
22
+ } else {
23
+ fastCallback = callback;
24
+ }
20
25
  if (numberOfArguments >= 1 && numberOfArguments <= 3) {
21
26
  return function () {
22
27
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -34,6 +39,18 @@ export function optimizeCallback(callback, array, name) {
34
39
  }
35
40
  return callback;
36
41
  }
42
+ function _findSingleSignatureWithArity(callback, arity) {
43
+ var matchingFunctions = [];
44
+ Object.entries(callback.signatures).forEach(_ref => {
45
+ var [signature, func] = _ref;
46
+ if (signature.split(',').length === arity) {
47
+ matchingFunctions.push(func);
48
+ }
49
+ });
50
+ if (matchingFunctions.length === 1) {
51
+ return matchingFunctions[0];
52
+ }
53
+ }
37
54
  function _findNumberOfArguments(callback, value, index, array) {
38
55
  var testArgs = [value, index, array];
39
56
  for (var i = 3; i > 0; i--) {
@@ -1,3 +1,3 @@
1
- export var version = '14.2.0';
1
+ export var version = '14.3.0';
2
2
  // Note: This file is automatically generated when building math.js.
3
3
  // Changes made in this file will be overwritten.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mathjs",
3
- "version": "14.2.0",
3
+ "version": "14.3.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",
@@ -26,7 +26,6 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@babel/runtime": "^7.25.7",
29
- "@lambdatest/node-tunnel": "^4.0.8",
30
29
  "complex.js": "^2.2.5",
31
30
  "decimal.js": "^10.4.3",
32
31
  "escape-latex": "^1.2.0",
@@ -37,18 +36,18 @@
37
36
  "typed-function": "^4.2.1"
38
37
  },
39
38
  "devDependencies": {
40
- "@babel/core": "7.26.0",
39
+ "@babel/core": "7.26.9",
41
40
  "@babel/plugin-transform-object-assign": "7.25.9",
42
41
  "@babel/plugin-transform-optional-catch-binding": "7.25.9",
43
- "@babel/plugin-transform-runtime": "7.25.9",
44
- "@babel/preset-env": "7.26.0",
42
+ "@babel/plugin-transform-runtime": "7.26.9",
43
+ "@babel/preset-env": "7.26.9",
45
44
  "@babel/register": "7.25.9",
46
45
  "@types/assert": "1.5.11",
47
46
  "@types/mocha": "10.0.10",
48
- "@typescript-eslint/eslint-plugin": "8.21.0",
49
- "@typescript-eslint/parser": "8.21.0",
47
+ "@typescript-eslint/eslint-plugin": "8.25.0",
48
+ "@typescript-eslint/parser": "8.25.0",
50
49
  "assert": "2.1.0",
51
- "babel-loader": "9.2.1",
50
+ "babel-loader": "10.0.0",
52
51
  "c8": "10.1.3",
53
52
  "codecov": "3.8.3",
54
53
  "core-js": "3.40.0",
@@ -87,14 +86,14 @@
87
86
  "ndarray-ops": "1.2.2",
88
87
  "ndarray-pack": "1.2.1",
89
88
  "numericjs": "1.2.6",
90
- "prettier": "3.4.2",
89
+ "prettier": "3.5.2",
91
90
  "process": "0.11.10",
92
91
  "sinon": "19.0.2",
93
92
  "sylvester": "0.0.21",
94
- "tinybench": "3.1.0",
93
+ "tinybench": "3.1.1",
95
94
  "ts-node": "10.9.2",
96
95
  "typescript": "5.7.3",
97
- "webpack": "5.97.1",
96
+ "webpack": "5.98.0",
98
97
  "zeros": "1.0.0"
99
98
  },
100
99
  "type": "module",
package/types/index.d.ts CHANGED
@@ -1456,7 +1456,7 @@ export interface MathJsInstance extends MathJsFactory {
1456
1456
 
1457
1457
  multiply<T extends MathArray>(x: T, y: T[]): T
1458
1458
  multiply<T extends MathArray>(x: T[], y: T): T
1459
- multiply<T extends MathArray>(x: T[], y: T[]): T
1459
+ multiply<T extends MathArray>(x: T[], y: T[]): T[]
1460
1460
  multiply<T extends MathArray>(x: T, y: T): MathScalarType
1461
1461
  multiply(x: Unit, y: Unit): Unit
1462
1462
  multiply(x: number, y: number): number
@@ -4006,6 +4006,7 @@ export const {
4006
4006
  coulombDependencies,
4007
4007
  deuteronMassDependencies,
4008
4008
  efimovFactorDependencies,
4009
+ eigsDependencies,
4009
4010
  electricConstantDependencies,
4010
4011
  electronMassDependencies,
4011
4012
  elementaryChargeDependencies,