mathjs 11.12.0 → 12.1.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 +54 -2
- package/README.md +1 -1
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesEigs.generated.js +4 -0
- package/lib/cjs/entry/pureFunctionsAny.generated.js +2 -0
- package/lib/cjs/expression/embeddedDocs/function/arithmetic/round.js +2 -2
- package/lib/cjs/expression/embeddedDocs/function/matrix/eigs.js +2 -2
- package/lib/cjs/expression/node/AssignmentNode.js +1 -1
- package/lib/cjs/expression/node/FunctionAssignmentNode.js +1 -1
- package/lib/cjs/function/algebra/derivative.js +8 -31
- package/lib/cjs/function/arithmetic/gcd.js +4 -5
- package/lib/cjs/function/arithmetic/mod.js +2 -9
- package/lib/cjs/function/arithmetic/round.js +59 -16
- package/lib/cjs/function/matrix/eigs/complexEigs.js +73 -68
- package/lib/cjs/function/matrix/eigs/{realSymetric.js → realSymmetric.js} +57 -51
- package/lib/cjs/function/matrix/eigs.js +118 -45
- package/lib/cjs/function/probability/pickRandom.js +2 -2
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/number.js +2 -2
- package/lib/cjs/utils/number.js +1 -1
- package/lib/cjs/utils/snapshot.js +6 -6
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesEigs.generated.js +4 -0
- package/lib/esm/entry/pureFunctionsAny.generated.js +2 -0
- package/lib/esm/expression/embeddedDocs/function/arithmetic/round.js +2 -2
- package/lib/esm/expression/embeddedDocs/function/matrix/eigs.js +2 -2
- package/lib/esm/expression/node/AssignmentNode.js +1 -1
- package/lib/esm/expression/node/FunctionAssignmentNode.js +1 -1
- package/lib/esm/function/algebra/derivative.js +8 -31
- package/lib/esm/function/arithmetic/mod.js +2 -9
- package/lib/esm/function/arithmetic/round.js +40 -17
- package/lib/esm/function/matrix/eigs/complexEigs.js +73 -68
- package/lib/esm/function/matrix/eigs/{realSymetric.js → realSymmetric.js} +55 -51
- package/lib/esm/function/matrix/eigs.js +119 -47
- package/lib/esm/function/probability/pickRandom.js +2 -2
- package/lib/esm/type/number.js +2 -2
- package/lib/esm/utils/number.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +14 -14
- package/types/EXPLANATION.md +54 -0
- package/types/index.d.ts +6825 -6483
| @@ -27,7 +27,9 @@ var _dependenciesMultiplyScalarGenerated = require("./dependenciesMultiplyScalar | |
| 27 27 | 
             
            var _dependenciesNumberGenerated = require("./dependenciesNumber.generated.js");
         | 
| 28 28 | 
             
            var _dependenciesQrGenerated = require("./dependenciesQr.generated.js");
         | 
| 29 29 | 
             
            var _dependenciesReGenerated = require("./dependenciesRe.generated.js");
         | 
| 30 | 
            +
            var _dependenciesReshapeGenerated = require("./dependenciesReshape.generated.js");
         | 
| 30 31 | 
             
            var _dependenciesSinGenerated = require("./dependenciesSin.generated.js");
         | 
| 32 | 
            +
            var _dependenciesSizeGenerated = require("./dependenciesSize.generated.js");
         | 
| 31 33 | 
             
            var _dependenciesSmallerGenerated = require("./dependenciesSmaller.generated.js");
         | 
| 32 34 | 
             
            var _dependenciesSqrtGenerated = require("./dependenciesSqrt.generated.js");
         | 
| 33 35 | 
             
            var _dependenciesSubtractGenerated = require("./dependenciesSubtract.generated.js");
         | 
| @@ -64,7 +66,9 @@ var eigsDependencies = exports.eigsDependencies = { | |
| 64 66 | 
             
              numberDependencies: _dependenciesNumberGenerated.numberDependencies,
         | 
| 65 67 | 
             
              qrDependencies: _dependenciesQrGenerated.qrDependencies,
         | 
| 66 68 | 
             
              reDependencies: _dependenciesReGenerated.reDependencies,
         | 
| 69 | 
            +
              reshapeDependencies: _dependenciesReshapeGenerated.reshapeDependencies,
         | 
| 67 70 | 
             
              sinDependencies: _dependenciesSinGenerated.sinDependencies,
         | 
| 71 | 
            +
              sizeDependencies: _dependenciesSizeGenerated.sizeDependencies,
         | 
| 68 72 | 
             
              smallerDependencies: _dependenciesSmallerGenerated.smallerDependencies,
         | 
| 69 73 | 
             
              sqrtDependencies: _dependenciesSqrtGenerated.sqrtDependencies,
         | 
| 70 74 | 
             
              subtractDependencies: _dependenciesSubtractGenerated.subtractDependencies,
         | 
| @@ -1590,7 +1590,9 @@ var eigs = exports.eigs = /* #__PURE__ */(0, _factoriesAny.createEigs)({ | |
| 1590 1590 | 
             
              number: number,
         | 
| 1591 1591 | 
             
              qr: qr,
         | 
| 1592 1592 | 
             
              re: re,
         | 
| 1593 | 
            +
              reshape: reshape,
         | 
| 1593 1594 | 
             
              sin: sin,
         | 
| 1595 | 
            +
              size: size,
         | 
| 1594 1596 | 
             
              smaller: smaller,
         | 
| 1595 1597 | 
             
              sqrt: sqrt,
         | 
| 1596 1598 | 
             
              subtract: subtract,
         | 
| @@ -7,8 +7,8 @@ exports.roundDocs = void 0; | |
| 7 7 | 
             
            var roundDocs = exports.roundDocs = {
         | 
| 8 8 | 
             
              name: 'round',
         | 
| 9 9 | 
             
              category: 'Arithmetic',
         | 
| 10 | 
            -
              syntax: ['round(x)', 'round(x, n)'],
         | 
| 10 | 
            +
              syntax: ['round(x)', 'round(x, n)', 'round(unit, valuelessUnit)', 'round(unit, n, valuelessUnit)'],
         | 
| 11 11 | 
             
              description: 'round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.',
         | 
| 12 | 
            -
              examples: ['round(3.2)', 'round(3.8)', 'round(-4.2)', 'round(-4.8)', 'round(pi, 3)', 'round(123.45678, 2)'],
         | 
| 12 | 
            +
              examples: ['round(3.2)', 'round(3.8)', 'round(-4.2)', 'round(-4.8)', 'round(pi, 3)', 'round(123.45678, 2)', 'round(3.241cm, 2, cm)', 'round([3.2, 3.8, -4.7])'],
         | 
| 13 13 | 
             
              seealso: ['ceil', 'floor', 'fix']
         | 
| 14 14 | 
             
            };
         | 
| @@ -8,7 +8,7 @@ var eigsDocs = exports.eigsDocs = { | |
| 8 8 | 
             
              name: 'eigs',
         | 
| 9 9 | 
             
              category: 'Matrix',
         | 
| 10 10 | 
             
              syntax: ['eigs(x)'],
         | 
| 11 | 
            -
              description: 'Calculate the eigenvalues and eigenvectors of a  | 
| 12 | 
            -
              examples: ['eigs([[5, 2.3], [2.3, 1]])'],
         | 
| 11 | 
            +
              description: 'Calculate the eigenvalues and optionally eigenvectors of a square matrix',
         | 
| 12 | 
            +
              examples: ['eigs([[5, 2.3], [2.3, 1]])', 'eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false }'],
         | 
| 13 13 | 
             
              seealso: ['inv']
         | 
| 14 14 | 
             
            };
         | 
| @@ -331,7 +331,7 @@ var createAssignmentNode = exports.createAssignmentNode = /* #__PURE__ */(0, _fa | |
| 331 331 | 
             
                    if (needParenthesis(this, options && options.parenthesis, options && options.implicit)) {
         | 
| 332 332 | 
             
                      value = "\\left(".concat(value, "\\right)");
         | 
| 333 333 | 
             
                    }
         | 
| 334 | 
            -
                    return object + index + ' | 
| 334 | 
            +
                    return object + index + '=' + value;
         | 
| 335 335 | 
             
                  }
         | 
| 336 336 | 
             
                }], [{
         | 
| 337 337 | 
             
                  key: "fromJSON",
         | 
| @@ -270,7 +270,7 @@ var createFunctionAssignmentNode = exports.createFunctionAssignmentNode = /* #__ | |
| 270 270 | 
             
                    if (needParenthesis(this, parenthesis, options && options.implicit)) {
         | 
| 271 271 | 
             
                      expr = "\\left(".concat(expr, "\\right)");
         | 
| 272 272 | 
             
                    }
         | 
| 273 | 
            -
                    return '\\mathrm{' + this.name + '}\\left(' + this.params.map(_latex.toSymbol).join(',') + '\\right) | 
| 273 | 
            +
                    return '\\mathrm{' + this.name + '}\\left(' + this.params.map(_latex.toSymbol).join(',') + '\\right)=' + expr;
         | 
| 274 274 | 
             
                  }
         | 
| 275 275 | 
             
                }], [{
         | 
| 276 276 | 
             
                  key: "fromJSON",
         | 
| @@ -212,9 +212,6 @@ var createDerivative = exports.createDerivative = /* #__PURE__ */(0, _factory.fa | |
| 212 212 | 
             
                  return _derivative(node.expr, constNodes);
         | 
| 213 213 | 
             
                },
         | 
| 214 214 | 
             
                'FunctionNode, Object': function FunctionNodeObject(node, constNodes) {
         | 
| 215 | 
            -
                  if (node.args.length !== 1) {
         | 
| 216 | 
            -
                    funcArgsCheck(node);
         | 
| 217 | 
            -
                  }
         | 
| 218 215 | 
             
                  if (constNodes[node] !== undefined) {
         | 
| 219 216 | 
             
                    return createConstantNode(0);
         | 
| 220 217 | 
             
                  }
         | 
| @@ -263,9 +260,12 @@ var createDerivative = exports.createDerivative = /* #__PURE__ */(0, _factory.fa | |
| 263 260 | 
             
                      }
         | 
| 264 261 | 
             
                      break;
         | 
| 265 262 | 
             
                    case 'pow':
         | 
| 266 | 
            -
                       | 
| 267 | 
            -
             | 
| 268 | 
            -
             | 
| 263 | 
            +
                      if (node.args.length === 2) {
         | 
| 264 | 
            +
                        constNodes[arg1] = constNodes[node.args[1]];
         | 
| 265 | 
            +
                        // Pass to pow operator node parser
         | 
| 266 | 
            +
                        return _derivative(new OperatorNode('^', 'pow', [arg0, node.args[1]]), constNodes);
         | 
| 267 | 
            +
                      }
         | 
| 268 | 
            +
                      break;
         | 
| 269 269 | 
             
                    case 'exp':
         | 
| 270 270 | 
             
                      // d/dx(e^x) = e^x
         | 
| 271 271 | 
             
                      funcDerivative = new FunctionNode('exp', [arg0.clone()]);
         | 
| @@ -395,7 +395,7 @@ var createDerivative = exports.createDerivative = /* #__PURE__ */(0, _factory.fa | |
| 395 395 | 
             
                      break;
         | 
| 396 396 | 
             
                    case 'gamma': // Needs digamma function, d/dx(gamma(x)) = gamma(x)digamma(x)
         | 
| 397 397 | 
             
                    default:
         | 
| 398 | 
            -
                      throw new Error(' | 
| 398 | 
            +
                      throw new Error('Cannot process function "' + node.name + '" in derivative: ' + 'the function is not supported, undefined, or the number of arguments passed to it are not supported');
         | 
| 399 399 | 
             
                  }
         | 
| 400 400 | 
             
                  var op, func;
         | 
| 401 401 | 
             
                  if (div) {
         | 
| @@ -506,33 +506,10 @@ var createDerivative = exports.createDerivative = /* #__PURE__ */(0, _factory.fa | |
| 506 506 | 
             
                    // Functional Power Rule, d/dx(f^g) = f^g*[f'*(g/f) + g'ln(f)]
         | 
| 507 507 | 
             
                    return new OperatorNode('*', 'multiply', [new OperatorNode('^', 'pow', [_arg.clone(), _arg2.clone()]), new OperatorNode('+', 'add', [new OperatorNode('*', 'multiply', [_derivative(_arg, constNodes), new OperatorNode('/', 'divide', [_arg2.clone(), _arg.clone()])]), new OperatorNode('*', 'multiply', [_derivative(_arg2, constNodes), new FunctionNode('log', [_arg.clone()])])])]);
         | 
| 508 508 | 
             
                  }
         | 
| 509 | 
            -
                  throw new Error(' | 
| 509 | 
            +
                  throw new Error('Cannot process operator "' + node.op + '" in derivative: ' + 'the operator is not supported, undefined, or the number of arguments passed to it are not supported');
         | 
| 510 510 | 
             
                }
         | 
| 511 511 | 
             
              });
         | 
| 512 512 |  | 
| 513 | 
            -
              /**
         | 
| 514 | 
            -
               * Ensures the number of arguments for a function are correct,
         | 
| 515 | 
            -
               * and will throw an error otherwise.
         | 
| 516 | 
            -
               *
         | 
| 517 | 
            -
               * @param {FunctionNode} node
         | 
| 518 | 
            -
               */
         | 
| 519 | 
            -
              function funcArgsCheck(node) {
         | 
| 520 | 
            -
                // TODO add min, max etc
         | 
| 521 | 
            -
                if ((node.name === 'log' || node.name === 'nthRoot' || node.name === 'pow') && node.args.length === 2) {
         | 
| 522 | 
            -
                  return;
         | 
| 523 | 
            -
                }
         | 
| 524 | 
            -
             | 
| 525 | 
            -
                // There should be an incorrect number of arguments if we reach here
         | 
| 526 | 
            -
             | 
| 527 | 
            -
                // Change all args to constants to avoid unidentified
         | 
| 528 | 
            -
                // symbol error when compiling function
         | 
| 529 | 
            -
                for (var i = 0; i < node.args.length; ++i) {
         | 
| 530 | 
            -
                  node.args[i] = createConstantNode(0);
         | 
| 531 | 
            -
                }
         | 
| 532 | 
            -
                node.compile().evaluate();
         | 
| 533 | 
            -
                throw new Error('Function "' + node.name + '" is not supported by derivative, or a wrong number of arguments is passed');
         | 
| 534 | 
            -
              }
         | 
| 535 | 
            -
             | 
| 536 513 | 
             
              /**
         | 
| 537 514 | 
             
               * Helper function to create a constant node with a specific type
         | 
| 538 515 | 
             
               * (number, BigNumber, Fraction)
         | 
| @@ -25,7 +25,6 @@ function is1d(array) { | |
| 25 25 | 
             
              });
         | 
| 26 26 | 
             
            }
         | 
| 27 27 | 
             
            var createGcd = exports.createGcd = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
         | 
| 28 | 
            -
              var _typed;
         | 
| 29 28 | 
             
              var typed = _ref.typed,
         | 
| 30 29 | 
             
                matrix = _ref.matrix,
         | 
| 31 30 | 
             
                config = _ref.config,
         | 
| @@ -97,7 +96,7 @@ var createGcd = exports.createGcd = /* #__PURE__ */(0, _factory.factory)(name, d | |
| 97 96 | 
             
                SS: matAlgo04xSidSid,
         | 
| 98 97 | 
             
                DS: matAlgo01xDSid,
         | 
| 99 98 | 
             
                Ss: matAlgo10xSids
         | 
| 100 | 
            -
              }), ( | 
| 99 | 
            +
              }), (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, gcdManyTypesSignature, typed.referToSelf(function (self) {
         | 
| 101 100 | 
             
                return function (a, b, args) {
         | 
| 102 101 | 
             
                  var res = self(a, b);
         | 
| 103 102 | 
             
                  for (var i = 0; i < args.length; i++) {
         | 
| @@ -105,7 +104,7 @@ var createGcd = exports.createGcd = /* #__PURE__ */(0, _factory.factory)(name, d | |
| 105 104 | 
             
                  }
         | 
| 106 105 | 
             
                  return res;
         | 
| 107 106 | 
             
                };
         | 
| 108 | 
            -
              })),  | 
| 107 | 
            +
              })), "Array", typed.referToSelf(function (self) {
         | 
| 109 108 | 
             
                return function (array) {
         | 
| 110 109 | 
             
                  if (array.length === 1 && Array.isArray(array[0]) && is1d(array[0])) {
         | 
| 111 110 | 
             
                    return self.apply(void 0, (0, _toConsumableArray2["default"])(array[0]));
         | 
| @@ -115,11 +114,11 @@ var createGcd = exports.createGcd = /* #__PURE__ */(0, _factory.factory)(name, d | |
| 115 114 | 
             
                  }
         | 
| 116 115 | 
             
                  throw new _ArgumentsError.ArgumentsError('gcd() supports only 1d matrices!');
         | 
| 117 116 | 
             
                };
         | 
| 118 | 
            -
              })),  | 
| 117 | 
            +
              })), "Matrix", typed.referToSelf(function (self) {
         | 
| 119 118 | 
             
                return function (matrix) {
         | 
| 120 119 | 
             
                  return self(matrix.toArray());
         | 
| 121 120 | 
             
                };
         | 
| 122 | 
            -
              })) | 
| 121 | 
            +
              })));
         | 
| 123 122 |  | 
| 124 123 | 
             
              /**
         | 
| 125 124 | 
             
              * Calculate gcd for numbers
         | 
| @@ -95,17 +95,10 @@ var createMod = exports.createMod = /* #__PURE__ */(0, _factory.factory)(name, d | |
| 95 95 | 
             
              return typed(name, {
         | 
| 96 96 | 
             
                'number, number': _modNumber,
         | 
| 97 97 | 
             
                'BigNumber, BigNumber': function BigNumberBigNumber(x, y) {
         | 
| 98 | 
            -
                   | 
| 99 | 
            -
                    throw new Error('Cannot calculate mod for a negative divisor');
         | 
| 100 | 
            -
                  }
         | 
| 101 | 
            -
                  return y.isZero() ? x : x.mod(y);
         | 
| 98 | 
            +
                  return y.isZero() ? x : x.sub(y.mul(floor(x.div(y))));
         | 
| 102 99 | 
             
                },
         | 
| 103 100 | 
             
                'Fraction, Fraction': function FractionFraction(x, y) {
         | 
| 104 | 
            -
                   | 
| 105 | 
            -
                    throw new Error('Cannot calculate mod for a negative divisor');
         | 
| 106 | 
            -
                  }
         | 
| 107 | 
            -
                  // Workaround suggested in Fraction.js library to calculate correct modulo for negative dividend
         | 
| 108 | 
            -
                  return x.compare(0) >= 0 ? x.mod(y) : x.mod(y).add(y).mod(y);
         | 
| 101 | 
            +
                  return y.equals(0) ? x : x.sub(y.mul(floor(x.div(y))));
         | 
| 109 102 | 
             
                }
         | 
| 110 103 | 
             
              }, matrixAlgorithmSuite({
         | 
| 111 104 | 
             
                SS: matAlgo05xSfSf,
         | 
| @@ -40,6 +40,8 @@ var createRound = exports.createRound = /* #__PURE__ */(0, _factory.factory)(nam | |
| 40 40 | 
             
               *
         | 
| 41 41 | 
             
               *    math.round(x)
         | 
| 42 42 | 
             
               *    math.round(x, n)
         | 
| 43 | 
            +
               *    math.round(unit, valuelessUnit)
         | 
| 44 | 
            +
               *    math.round(unit, n, valuelessUnit)
         | 
| 43 45 | 
             
               *
         | 
| 44 46 | 
             
               * Examples:
         | 
| 45 47 | 
             
               *
         | 
| @@ -57,14 +59,21 @@ var createRound = exports.createRound = /* #__PURE__ */(0, _factory.factory)(nam | |
| 57 59 | 
             
               *    const c = math.complex(3.2, -2.7)
         | 
| 58 60 | 
             
               *    math.round(c)                // returns Complex 3 - 3i
         | 
| 59 61 | 
             
               *
         | 
| 62 | 
            +
               *    const unit = math.unit('3.241 cm')
         | 
| 63 | 
            +
               *    const cm = math.unit('cm')
         | 
| 64 | 
            +
               *    const mm = math.unit('mm')
         | 
| 65 | 
            +
               *    math.round(unit, 1, cm)      // returns Unit 3.2 cm
         | 
| 66 | 
            +
               *    math.round(unit, 1, mm)      // returns Unit 32.4 mm
         | 
| 67 | 
            +
               *
         | 
| 60 68 | 
             
               *    math.round([3.2, 3.8, -4.7]) // returns Array [3, 4, -5]
         | 
| 61 69 | 
             
               *
         | 
| 62 70 | 
             
               * See also:
         | 
| 63 71 | 
             
               *
         | 
| 64 72 | 
             
               *    ceil, fix, floor
         | 
| 65 73 | 
             
               *
         | 
| 66 | 
            -
               * @param  {number | BigNumber | Fraction | Complex | Array | Matrix} x   | 
| 74 | 
            +
               * @param  {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x  Value to be rounded
         | 
| 67 75 | 
             
               * @param  {number | BigNumber | Array} [n=0]                            Number of decimals
         | 
| 76 | 
            +
               * @param  {Unit} [valuelessUnit]                                        A valueless unit
         | 
| 68 77 | 
             
               * @return {number | BigNumber | Fraction | Complex | Array | Matrix} Rounded value
         | 
| 69 78 | 
             
               */
         | 
| 70 79 | 
             
              return typed(name, {
         | 
| @@ -116,52 +125,86 @@ var createRound = exports.createRound = /* #__PURE__ */(0, _factory.factory)(nam | |
| 116 125 | 
             
                  }
         | 
| 117 126 | 
             
                  return x.round(n.toNumber());
         | 
| 118 127 | 
             
                },
         | 
| 119 | 
            -
                 | 
| 128 | 
            +
                'Unit, number, Unit': typed.referToSelf(function (self) {
         | 
| 129 | 
            +
                  return function (x, n, unit) {
         | 
| 130 | 
            +
                    var valueless = x.toNumeric(unit);
         | 
| 131 | 
            +
                    return unit.multiply(self(valueless, n));
         | 
| 132 | 
            +
                  };
         | 
| 133 | 
            +
                }),
         | 
| 134 | 
            +
                'Unit, BigNumber, Unit': typed.referToSelf(function (self) {
         | 
| 135 | 
            +
                  return function (x, n, unit) {
         | 
| 136 | 
            +
                    return self(x, n.toNumber(), unit);
         | 
| 137 | 
            +
                  };
         | 
| 138 | 
            +
                }),
         | 
| 139 | 
            +
                'Unit, Unit': typed.referToSelf(function (self) {
         | 
| 140 | 
            +
                  return function (x, unit) {
         | 
| 141 | 
            +
                    return self(x, 0, unit);
         | 
| 142 | 
            +
                  };
         | 
| 143 | 
            +
                }),
         | 
| 144 | 
            +
                'Array | Matrix, number, Unit': typed.referToSelf(function (self) {
         | 
| 145 | 
            +
                  return function (x, n, unit) {
         | 
| 146 | 
            +
                    // deep map collection, skip zeros since round(0) = 0
         | 
| 147 | 
            +
                    return (0, _collection.deepMap)(x, function (value) {
         | 
| 148 | 
            +
                      return self(value, n, unit);
         | 
| 149 | 
            +
                    }, true);
         | 
| 150 | 
            +
                  };
         | 
| 151 | 
            +
                }),
         | 
| 152 | 
            +
                'Array | Matrix, BigNumber, Unit': typed.referToSelf(function (self) {
         | 
| 153 | 
            +
                  return function (x, n, unit) {
         | 
| 154 | 
            +
                    return self(x, n.toNumber(), unit);
         | 
| 155 | 
            +
                  };
         | 
| 156 | 
            +
                }),
         | 
| 157 | 
            +
                'Array | Matrix, Unit': typed.referToSelf(function (self) {
         | 
| 158 | 
            +
                  return function (x, unit) {
         | 
| 159 | 
            +
                    return self(x, 0, unit);
         | 
| 160 | 
            +
                  };
         | 
| 161 | 
            +
                }),
         | 
| 120 162 | 
             
                'Array | Matrix': typed.referToSelf(function (self) {
         | 
| 121 163 | 
             
                  return function (x) {
         | 
| 164 | 
            +
                    // deep map collection, skip zeros since round(0) = 0
         | 
| 122 165 | 
             
                    return (0, _collection.deepMap)(x, self, true);
         | 
| 123 166 | 
             
                  };
         | 
| 124 167 | 
             
                }),
         | 
| 125 168 | 
             
                'SparseMatrix, number | BigNumber': typed.referToSelf(function (self) {
         | 
| 126 | 
            -
                  return function (x,  | 
| 127 | 
            -
                    return matAlgo11xS0s(x,  | 
| 169 | 
            +
                  return function (x, n) {
         | 
| 170 | 
            +
                    return matAlgo11xS0s(x, n, self, false);
         | 
| 128 171 | 
             
                  };
         | 
| 129 172 | 
             
                }),
         | 
| 130 173 | 
             
                'DenseMatrix, number | BigNumber': typed.referToSelf(function (self) {
         | 
| 131 | 
            -
                  return function (x,  | 
| 132 | 
            -
                    return matAlgo14xDs(x,  | 
| 174 | 
            +
                  return function (x, n) {
         | 
| 175 | 
            +
                    return matAlgo14xDs(x, n, self, false);
         | 
| 133 176 | 
             
                  };
         | 
| 134 177 | 
             
                }),
         | 
| 135 178 | 
             
                'Array, number | BigNumber': typed.referToSelf(function (self) {
         | 
| 136 | 
            -
                  return function (x,  | 
| 179 | 
            +
                  return function (x, n) {
         | 
| 137 180 | 
             
                    // use matrix implementation
         | 
| 138 | 
            -
                    return matAlgo14xDs(matrix(x),  | 
| 181 | 
            +
                    return matAlgo14xDs(matrix(x), n, self, false).valueOf();
         | 
| 139 182 | 
             
                  };
         | 
| 140 183 | 
             
                }),
         | 
| 141 184 | 
             
                'number | Complex | BigNumber | Fraction, SparseMatrix': typed.referToSelf(function (self) {
         | 
| 142 | 
            -
                  return function (x,  | 
| 185 | 
            +
                  return function (x, n) {
         | 
| 143 186 | 
             
                    // check scalar is zero
         | 
| 144 187 | 
             
                    if (equalScalar(x, 0)) {
         | 
| 145 188 | 
             
                      // do not execute algorithm, result will be a zero matrix
         | 
| 146 | 
            -
                      return zeros( | 
| 189 | 
            +
                      return zeros(n.size(), n.storage());
         | 
| 147 190 | 
             
                    }
         | 
| 148 | 
            -
                    return matAlgo12xSfs( | 
| 191 | 
            +
                    return matAlgo12xSfs(n, x, self, true);
         | 
| 149 192 | 
             
                  };
         | 
| 150 193 | 
             
                }),
         | 
| 151 194 | 
             
                'number | Complex | BigNumber | Fraction, DenseMatrix': typed.referToSelf(function (self) {
         | 
| 152 | 
            -
                  return function (x,  | 
| 195 | 
            +
                  return function (x, n) {
         | 
| 153 196 | 
             
                    // check scalar is zero
         | 
| 154 197 | 
             
                    if (equalScalar(x, 0)) {
         | 
| 155 198 | 
             
                      // do not execute algorithm, result will be a zero matrix
         | 
| 156 | 
            -
                      return zeros( | 
| 199 | 
            +
                      return zeros(n.size(), n.storage());
         | 
| 157 200 | 
             
                    }
         | 
| 158 | 
            -
                    return matAlgo14xDs( | 
| 201 | 
            +
                    return matAlgo14xDs(n, x, self, true);
         | 
| 159 202 | 
             
                  };
         | 
| 160 203 | 
             
                }),
         | 
| 161 204 | 
             
                'number | Complex | BigNumber | Fraction, Array': typed.referToSelf(function (self) {
         | 
| 162 | 
            -
                  return function (x,  | 
| 205 | 
            +
                  return function (x, n) {
         | 
| 163 206 | 
             
                    // use matrix implementation
         | 
| 164 | 
            -
                    return matAlgo14xDs(matrix( | 
| 207 | 
            +
                    return matAlgo14xDs(matrix(n), x, self, true).valueOf();
         | 
| 165 208 | 
             
                  };
         | 
| 166 209 | 
             
                })
         | 
| 167 210 | 
             
              });
         |