mathjs 13.2.3 → 14.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +18 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +1 -9
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/core/function/import.js +4 -1
- package/lib/cjs/core/function/typed.js +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesBitXor.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesDotDivide.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesDotPow.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesEqual.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesLarger.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesLargerEq.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesLog.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSimplify.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSmaller.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSmallerEq.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesUnequal.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesXor.generated.js +2 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesSimplify.generated.js +2 -0
- package/lib/cjs/entry/impureFunctionsAny.generated.js +1 -0
- package/lib/cjs/entry/impureFunctionsNumber.generated.js +1 -0
- package/lib/cjs/entry/pureFunctionsAny.generated.js +11 -0
- package/lib/cjs/expression/embeddedDocs/function/arithmetic/ceil.js +2 -2
- package/lib/cjs/expression/embeddedDocs/function/arithmetic/fix.js +2 -2
- package/lib/cjs/expression/embeddedDocs/function/arithmetic/floor.js +2 -2
- package/lib/cjs/expression/parse.js +26 -36
- package/lib/cjs/function/algebra/simplify.js +4 -3
- package/lib/cjs/function/algebra/simplifyConstant.js +5 -11
- package/lib/cjs/function/arithmetic/ceil.js +21 -2
- package/lib/cjs/function/arithmetic/dotDivide.js +4 -3
- package/lib/cjs/function/arithmetic/dotPow.js +4 -3
- package/lib/cjs/function/arithmetic/fix.js +24 -5
- package/lib/cjs/function/arithmetic/floor.js +21 -2
- package/lib/cjs/function/arithmetic/log.js +12 -4
- package/lib/cjs/function/arithmetic/pow.js +2 -2
- package/lib/cjs/function/arithmetic/round.js +3 -5
- package/lib/cjs/function/arithmetic/sign.js +1 -1
- package/lib/cjs/function/bitwise/bitXor.js +4 -3
- package/lib/cjs/function/logical/xor.js +4 -3
- package/lib/cjs/function/relational/equal.js +4 -3
- package/lib/cjs/function/relational/larger.js +4 -3
- package/lib/cjs/function/relational/largerEq.js +4 -3
- package/lib/cjs/function/relational/smaller.js +4 -3
- package/lib/cjs/function/relational/smallerEq.js +4 -3
- package/lib/cjs/function/relational/unequal.js +4 -3
- package/lib/cjs/function/utils/isInteger.js +1 -1
- package/lib/cjs/function/utils/isNegative.js +1 -1
- package/lib/cjs/function/utils/isPositive.js +1 -1
- package/lib/cjs/header.js +1 -1
- package/lib/cjs/type/bignumber/function/bignumber.js +2 -2
- package/lib/cjs/type/fraction/Fraction.js +4 -4
- package/lib/cjs/type/fraction/function/fraction.js +3 -0
- package/lib/cjs/type/matrix/utils/matAlgo07xSSf.js +39 -43
- package/lib/cjs/type/unit/Unit.js +1 -1
- package/lib/cjs/utils/string.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/core/function/import.js +4 -1
- package/lib/esm/core/function/typed.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesBitXor.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesDotDivide.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesDotPow.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesEqual.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesLarger.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesLargerEq.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesLog.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSimplify.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSmaller.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSmallerEq.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesUnequal.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesXor.generated.js +2 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesSimplify.generated.js +2 -0
- package/lib/esm/entry/impureFunctionsAny.generated.js +1 -0
- package/lib/esm/entry/impureFunctionsNumber.generated.js +1 -0
- package/lib/esm/entry/pureFunctionsAny.generated.js +11 -0
- package/lib/esm/expression/embeddedDocs/function/arithmetic/ceil.js +2 -2
- package/lib/esm/expression/embeddedDocs/function/arithmetic/fix.js +2 -2
- package/lib/esm/expression/embeddedDocs/function/arithmetic/floor.js +2 -2
- package/lib/esm/expression/parse.js +26 -36
- package/lib/esm/function/algebra/simplify.js +4 -3
- package/lib/esm/function/algebra/simplifyConstant.js +5 -11
- package/lib/esm/function/arithmetic/ceil.js +21 -2
- package/lib/esm/function/arithmetic/dotDivide.js +4 -3
- package/lib/esm/function/arithmetic/dotPow.js +4 -3
- package/lib/esm/function/arithmetic/fix.js +24 -5
- package/lib/esm/function/arithmetic/floor.js +21 -2
- package/lib/esm/function/arithmetic/log.js +12 -4
- package/lib/esm/function/arithmetic/pow.js +2 -2
- package/lib/esm/function/arithmetic/round.js +3 -5
- package/lib/esm/function/arithmetic/sign.js +1 -1
- package/lib/esm/function/bitwise/bitXor.js +4 -3
- package/lib/esm/function/logical/xor.js +4 -3
- package/lib/esm/function/relational/equal.js +4 -3
- package/lib/esm/function/relational/larger.js +4 -3
- package/lib/esm/function/relational/largerEq.js +4 -3
- package/lib/esm/function/relational/smaller.js +4 -3
- package/lib/esm/function/relational/smallerEq.js +4 -3
- package/lib/esm/function/relational/unequal.js +4 -3
- package/lib/esm/function/utils/isInteger.js +1 -1
- package/lib/esm/function/utils/isNegative.js +1 -1
- package/lib/esm/function/utils/isPositive.js +1 -1
- package/lib/esm/type/bignumber/function/bignumber.js +2 -2
- package/lib/esm/type/fraction/Fraction.js +4 -4
- package/lib/esm/type/fraction/function/fraction.js +3 -0
- package/lib/esm/type/matrix/utils/matAlgo07xSSf.js +39 -43
- package/lib/esm/type/unit/Unit.js +1 -1
- package/lib/esm/utils/string.js +2 -2
- package/lib/esm/version.js +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +110 -18
@@ -126,6 +126,7 @@ function importFactory(typed, load, math, importedFactories) {
|
|
126
126
|
* @private
|
127
127
|
*/
|
128
128
|
function _import(name, value, options) {
|
129
|
+
var _math$Unit;
|
129
130
|
// TODO: refactor this function, it's to complicated and contains duplicate code
|
130
131
|
if (options.wrap && typeof value === 'function') {
|
131
132
|
// create a wrapper around the function
|
@@ -154,7 +155,9 @@ function importFactory(typed, load, math, importedFactories) {
|
|
154
155
|
});
|
155
156
|
return;
|
156
157
|
}
|
157
|
-
|
158
|
+
const isDefined = math[name] !== undefined;
|
159
|
+
const isValuelessUnit = (_math$Unit = math.Unit) === null || _math$Unit === void 0 ? void 0 : _math$Unit.isValuelessUnit(name);
|
160
|
+
if (!isDefined && !isValuelessUnit || options.override) {
|
158
161
|
math[name] = value;
|
159
162
|
delete importedFactories[name];
|
160
163
|
_importTransform(name, value);
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.bitXorDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
10
11
|
var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
|
@@ -16,6 +17,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
16
17
|
|
17
18
|
const bitXorDependencies = exports.bitXorDependencies = {
|
18
19
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
20
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
19
21
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
20
22
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
21
23
|
typedDependencies: _dependenciesTypedGenerated.typedDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.dotDivideDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesDivideScalarGenerated = require("./dependenciesDivideScalar.generated.js");
|
10
11
|
var _dependenciesEqualScalarGenerated = require("./dependenciesEqualScalar.generated.js");
|
@@ -18,6 +19,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
18
19
|
|
19
20
|
const dotDivideDependencies = exports.dotDivideDependencies = {
|
20
21
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
22
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
21
23
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
22
24
|
divideScalarDependencies: _dependenciesDivideScalarGenerated.divideScalarDependencies,
|
23
25
|
equalScalarDependencies: _dependenciesEqualScalarGenerated.equalScalarDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.dotPowDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesEqualScalarGenerated = require("./dependenciesEqualScalar.generated.js");
|
10
11
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
@@ -18,6 +19,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
18
19
|
|
19
20
|
const dotPowDependencies = exports.dotPowDependencies = {
|
20
21
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
22
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
21
23
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
22
24
|
equalScalarDependencies: _dependenciesEqualScalarGenerated.equalScalarDependencies,
|
23
25
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.equalDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesEqualScalarGenerated = require("./dependenciesEqualScalar.generated.js");
|
10
11
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
@@ -17,6 +18,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
17
18
|
|
18
19
|
const equalDependencies = exports.equalDependencies = {
|
19
20
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
21
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
20
22
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
21
23
|
equalScalarDependencies: _dependenciesEqualScalarGenerated.equalScalarDependencies,
|
22
24
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.largerDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
10
11
|
var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
|
@@ -16,6 +17,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
16
17
|
|
17
18
|
const largerDependencies = exports.largerDependencies = {
|
18
19
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
20
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
19
21
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
20
22
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
21
23
|
typedDependencies: _dependenciesTypedGenerated.typedDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.largerEqDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
10
11
|
var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
|
@@ -16,6 +17,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
16
17
|
|
17
18
|
const largerEqDependencies = exports.largerEqDependencies = {
|
18
19
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
20
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
19
21
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
20
22
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
21
23
|
typedDependencies: _dependenciesTypedGenerated.typedDependencies,
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.logDependencies = void 0;
|
7
7
|
var _dependenciesComplexClassGenerated = require("./dependenciesComplexClass.generated.js");
|
8
8
|
var _dependenciesDivideScalarGenerated = require("./dependenciesDivideScalar.generated.js");
|
9
|
+
var _dependenciesTypeOfGenerated = require("./dependenciesTypeOf.generated.js");
|
9
10
|
var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
|
10
11
|
var _factoriesAny = require("../../factoriesAny.js");
|
11
12
|
/**
|
@@ -16,6 +17,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
16
17
|
const logDependencies = exports.logDependencies = {
|
17
18
|
ComplexDependencies: _dependenciesComplexClassGenerated.ComplexDependencies,
|
18
19
|
divideScalarDependencies: _dependenciesDivideScalarGenerated.divideScalarDependencies,
|
20
|
+
typeOfDependencies: _dependenciesTypeOfGenerated.typeOfDependencies,
|
19
21
|
typedDependencies: _dependenciesTypedGenerated.typedDependencies,
|
20
22
|
createLog: _factoriesAny.createLog
|
21
23
|
};
|
@@ -15,6 +15,7 @@ var _dependenciesParenthesisNodeGenerated = require("./dependenciesParenthesisNo
|
|
15
15
|
var _dependenciesSymbolNodeGenerated = require("./dependenciesSymbolNode.generated.js");
|
16
16
|
var _dependenciesEqualGenerated = require("./dependenciesEqual.generated.js");
|
17
17
|
var _dependenciesParseGenerated = require("./dependenciesParse.generated.js");
|
18
|
+
var _dependenciesReplacerGenerated = require("./dependenciesReplacer.generated.js");
|
18
19
|
var _dependenciesResolveGenerated = require("./dependenciesResolve.generated.js");
|
19
20
|
var _dependenciesSimplifyConstantGenerated = require("./dependenciesSimplifyConstant.generated.js");
|
20
21
|
var _dependenciesSimplifyCoreGenerated = require("./dependenciesSimplifyCore.generated.js");
|
@@ -37,6 +38,7 @@ const simplifyDependencies = exports.simplifyDependencies = {
|
|
37
38
|
SymbolNodeDependencies: _dependenciesSymbolNodeGenerated.SymbolNodeDependencies,
|
38
39
|
equalDependencies: _dependenciesEqualGenerated.equalDependencies,
|
39
40
|
parseDependencies: _dependenciesParseGenerated.parseDependencies,
|
41
|
+
replacerDependencies: _dependenciesReplacerGenerated.replacerDependencies,
|
40
42
|
resolveDependencies: _dependenciesResolveGenerated.resolveDependencies,
|
41
43
|
simplifyConstantDependencies: _dependenciesSimplifyConstantGenerated.simplifyConstantDependencies,
|
42
44
|
simplifyCoreDependencies: _dependenciesSimplifyCoreGenerated.simplifyCoreDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.smallerDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
10
11
|
var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
|
@@ -16,6 +17,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
16
17
|
|
17
18
|
const smallerDependencies = exports.smallerDependencies = {
|
18
19
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
20
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
19
21
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
20
22
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
21
23
|
typedDependencies: _dependenciesTypedGenerated.typedDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.smallerEqDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
10
11
|
var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
|
@@ -16,6 +17,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
16
17
|
|
17
18
|
const smallerEqDependencies = exports.smallerEqDependencies = {
|
18
19
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
20
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
19
21
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
20
22
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
21
23
|
typedDependencies: _dependenciesTypedGenerated.typedDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.unequalDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesEqualScalarGenerated = require("./dependenciesEqualScalar.generated.js");
|
10
11
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
@@ -17,6 +18,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
17
18
|
|
18
19
|
const unequalDependencies = exports.unequalDependencies = {
|
19
20
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
21
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
20
22
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
21
23
|
equalScalarDependencies: _dependenciesEqualScalarGenerated.equalScalarDependencies,
|
22
24
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.xorDependencies = void 0;
|
7
7
|
var _dependenciesDenseMatrixClassGenerated = require("./dependenciesDenseMatrixClass.generated.js");
|
8
|
+
var _dependenciesSparseMatrixClassGenerated = require("./dependenciesSparseMatrixClass.generated.js");
|
8
9
|
var _dependenciesConcatGenerated = require("./dependenciesConcat.generated.js");
|
9
10
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
10
11
|
var _dependenciesTypedGenerated = require("./dependenciesTyped.generated.js");
|
@@ -16,6 +17,7 @@ var _factoriesAny = require("../../factoriesAny.js");
|
|
16
17
|
|
17
18
|
const xorDependencies = exports.xorDependencies = {
|
18
19
|
DenseMatrixDependencies: _dependenciesDenseMatrixClassGenerated.DenseMatrixDependencies,
|
20
|
+
SparseMatrixDependencies: _dependenciesSparseMatrixClassGenerated.SparseMatrixDependencies,
|
19
21
|
concatDependencies: _dependenciesConcatGenerated.concatDependencies,
|
20
22
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
21
23
|
typedDependencies: _dependenciesTypedGenerated.typedDependencies,
|
@@ -15,6 +15,7 @@ var _dependenciesParenthesisNodeGenerated = require("./dependenciesParenthesisNo
|
|
15
15
|
var _dependenciesSymbolNodeGenerated = require("./dependenciesSymbolNode.generated.js");
|
16
16
|
var _dependenciesEqualGenerated = require("./dependenciesEqual.generated.js");
|
17
17
|
var _dependenciesParseGenerated = require("./dependenciesParse.generated.js");
|
18
|
+
var _dependenciesReplacerGenerated = require("./dependenciesReplacer.generated.js");
|
18
19
|
var _dependenciesResolveGenerated = require("./dependenciesResolve.generated.js");
|
19
20
|
var _dependenciesSimplifyConstantGenerated = require("./dependenciesSimplifyConstant.generated.js");
|
20
21
|
var _dependenciesSimplifyCoreGenerated = require("./dependenciesSimplifyCore.generated.js");
|
@@ -37,6 +38,7 @@ const simplifyDependencies = exports.simplifyDependencies = {
|
|
37
38
|
SymbolNodeDependencies: _dependenciesSymbolNodeGenerated.SymbolNodeDependencies,
|
38
39
|
equalDependencies: _dependenciesEqualGenerated.equalDependencies,
|
39
40
|
parseDependencies: _dependenciesParseGenerated.parseDependencies,
|
41
|
+
replacerDependencies: _dependenciesReplacerGenerated.replacerDependencies,
|
40
42
|
resolveDependencies: _dependenciesResolveGenerated.resolveDependencies,
|
41
43
|
simplifyConstantDependencies: _dependenciesSimplifyConstantGenerated.simplifyConstantDependencies,
|
42
44
|
simplifyCoreDependencies: _dependenciesSimplifyCoreGenerated.simplifyCoreDependencies,
|
@@ -183,6 +183,7 @@ const simplify = exports.simplify = (0, _factoriesNumber.createSimplify)({
|
|
183
183
|
SymbolNode,
|
184
184
|
equal: _pureFunctionsNumberGenerated.equal,
|
185
185
|
parse,
|
186
|
+
replacer: _pureFunctionsNumberGenerated.replacer,
|
186
187
|
resolve,
|
187
188
|
simplifyConstant,
|
188
189
|
simplifyCore,
|
@@ -495,6 +495,7 @@ const divideScalar = exports.divideScalar = /* #__PURE__ */(0, _factoriesAny.cre
|
|
495
495
|
});
|
496
496
|
const dotDivide = exports.dotDivide = /* #__PURE__ */(0, _factoriesAny.createDotDivide)({
|
497
497
|
DenseMatrix,
|
498
|
+
SparseMatrix,
|
498
499
|
concat,
|
499
500
|
divideScalar,
|
500
501
|
equalScalar,
|
@@ -503,6 +504,7 @@ const dotDivide = exports.dotDivide = /* #__PURE__ */(0, _factoriesAny.createDot
|
|
503
504
|
});
|
504
505
|
const equal = exports.equal = /* #__PURE__ */(0, _factoriesAny.createEqual)({
|
505
506
|
DenseMatrix,
|
507
|
+
SparseMatrix,
|
506
508
|
concat,
|
507
509
|
equalScalar,
|
508
510
|
matrix,
|
@@ -527,6 +529,7 @@ const kron = exports.kron = /* #__PURE__ */(0, _factoriesAny.createKron)({
|
|
527
529
|
});
|
528
530
|
const largerEq = exports.largerEq = /* #__PURE__ */(0, _factoriesAny.createLargerEq)({
|
529
531
|
DenseMatrix,
|
532
|
+
SparseMatrix,
|
530
533
|
concat,
|
531
534
|
config: _configReadonly.config,
|
532
535
|
matrix,
|
@@ -608,6 +611,7 @@ const round = exports.round = /* #__PURE__ */(0, _factoriesAny.createRound)({
|
|
608
611
|
});
|
609
612
|
const smaller = exports.smaller = /* #__PURE__ */(0, _factoriesAny.createSmaller)({
|
610
613
|
DenseMatrix,
|
614
|
+
SparseMatrix,
|
611
615
|
concat,
|
612
616
|
config: _configReadonly.config,
|
613
617
|
matrix,
|
@@ -643,6 +647,7 @@ const usolve = exports.usolve = /* #__PURE__ */(0, _factoriesAny.createUsolve)({
|
|
643
647
|
});
|
644
648
|
const xor = exports.xor = /* #__PURE__ */(0, _factoriesAny.createXor)({
|
645
649
|
DenseMatrix,
|
650
|
+
SparseMatrix,
|
646
651
|
concat,
|
647
652
|
matrix,
|
648
653
|
typed
|
@@ -679,6 +684,7 @@ const bitOr = exports.bitOr = /* #__PURE__ */(0, _factoriesAny.createBitOr)({
|
|
679
684
|
});
|
680
685
|
const bitXor = exports.bitXor = /* #__PURE__ */(0, _factoriesAny.createBitXor)({
|
681
686
|
DenseMatrix,
|
687
|
+
SparseMatrix,
|
682
688
|
concat,
|
683
689
|
matrix,
|
684
690
|
typed
|
@@ -784,6 +790,7 @@ const Index = exports.Index = /* #__PURE__ */(0, _factoriesAny.createIndexClass)
|
|
784
790
|
});
|
785
791
|
const larger = exports.larger = /* #__PURE__ */(0, _factoriesAny.createLarger)({
|
786
792
|
DenseMatrix,
|
793
|
+
SparseMatrix,
|
787
794
|
concat,
|
788
795
|
config: _configReadonly.config,
|
789
796
|
matrix,
|
@@ -793,6 +800,7 @@ const log = exports.log = /* #__PURE__ */(0, _factoriesAny.createLog)({
|
|
793
800
|
Complex,
|
794
801
|
config: _configReadonly.config,
|
795
802
|
divideScalar,
|
803
|
+
typeOf,
|
796
804
|
typed
|
797
805
|
});
|
798
806
|
const lsolveAll = exports.lsolveAll = /* #__PURE__ */(0, _factoriesAny.createLsolveAll)({
|
@@ -1047,6 +1055,7 @@ const setPowerset = exports.setPowerset = /* #__PURE__ */(0, _factoriesAny.creat
|
|
1047
1055
|
});
|
1048
1056
|
const smallerEq = exports.smallerEq = /* #__PURE__ */(0, _factoriesAny.createSmallerEq)({
|
1049
1057
|
DenseMatrix,
|
1058
|
+
SparseMatrix,
|
1050
1059
|
concat,
|
1051
1060
|
config: _configReadonly.config,
|
1052
1061
|
matrix,
|
@@ -1060,6 +1069,7 @@ const sort = exports.sort = /* #__PURE__ */(0, _factoriesAny.createSort)({
|
|
1060
1069
|
});
|
1061
1070
|
const unequal = exports.unequal = /* #__PURE__ */(0, _factoriesAny.createUnequal)({
|
1062
1071
|
DenseMatrix,
|
1072
|
+
SparseMatrix,
|
1063
1073
|
concat,
|
1064
1074
|
config: _configReadonly.config,
|
1065
1075
|
equalScalar,
|
@@ -1267,6 +1277,7 @@ const deuteronMass = exports.deuteronMass = /* #__PURE__ */(0, _factoriesAny.cre
|
|
1267
1277
|
});
|
1268
1278
|
const dotPow = exports.dotPow = /* #__PURE__ */(0, _factoriesAny.createDotPow)({
|
1269
1279
|
DenseMatrix,
|
1280
|
+
SparseMatrix,
|
1270
1281
|
concat,
|
1271
1282
|
equalScalar,
|
1272
1283
|
matrix,
|
@@ -7,8 +7,8 @@ exports.ceilDocs = void 0;
|
|
7
7
|
const ceilDocs = exports.ceilDocs = {
|
8
8
|
name: 'ceil',
|
9
9
|
category: 'Arithmetic',
|
10
|
-
syntax: ['ceil(x)'],
|
10
|
+
syntax: ['ceil(x)', 'ceil(x, n)', 'ceil(unit, valuelessUnit)', 'ceil(unit, n, valuelessUnit)'],
|
11
11
|
description: 'Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.',
|
12
|
-
examples: ['ceil(3.2)', 'ceil(3.8)', 'ceil(-4.2)'],
|
12
|
+
examples: ['ceil(3.2)', 'ceil(3.8)', 'ceil(-4.2)', 'ceil(3.241cm, cm)', 'ceil(3.241cm, 2, cm)'],
|
13
13
|
seealso: ['floor', 'fix', 'round']
|
14
14
|
};
|
@@ -7,8 +7,8 @@ exports.fixDocs = void 0;
|
|
7
7
|
const fixDocs = exports.fixDocs = {
|
8
8
|
name: 'fix',
|
9
9
|
category: 'Arithmetic',
|
10
|
-
syntax: ['fix(x)'],
|
10
|
+
syntax: ['fix(x)', 'fix(x, n)', 'fix(unit, valuelessUnit)', 'fix(unit, n, valuelessUnit)'],
|
11
11
|
description: 'Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.',
|
12
|
-
examples: ['fix(3.2)', 'fix(3.8)', 'fix(-4.2)', 'fix(-4.8)'],
|
12
|
+
examples: ['fix(3.2)', 'fix(3.8)', 'fix(-4.2)', 'fix(-4.8)', 'fix(3.241cm, cm)', 'fix(3.241cm, 2, cm)'],
|
13
13
|
seealso: ['ceil', 'floor', 'round']
|
14
14
|
};
|
@@ -7,8 +7,8 @@ exports.floorDocs = void 0;
|
|
7
7
|
const floorDocs = exports.floorDocs = {
|
8
8
|
name: 'floor',
|
9
9
|
category: 'Arithmetic',
|
10
|
-
syntax: ['floor(x)'],
|
10
|
+
syntax: ['floor(x)', 'floor(x, n)', 'floor(unit, valuelessUnit)', 'floor(unit, n, valuelessUnit)'],
|
11
11
|
description: 'Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.',
|
12
|
-
examples: ['floor(3.2)', 'floor(3.8)', 'floor(-4.2)'],
|
12
|
+
examples: ['floor(3.2)', 'floor(3.8)', 'floor(-4.2)', 'floor(3.241cm, cm)', 'floor(3.241cm, 2, cm)'],
|
13
13
|
seealso: ['ceil', 'fix', 'round']
|
14
14
|
};
|
@@ -939,7 +939,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
939
939
|
*/
|
940
940
|
function parseAddSubtract(state) {
|
941
941
|
let node, name, fn, params;
|
942
|
-
node =
|
942
|
+
node = parseMultiplyDivideModulusPercentage(state);
|
943
943
|
const operators = {
|
944
944
|
'+': 'add',
|
945
945
|
'-': 'subtract'
|
@@ -948,7 +948,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
948
948
|
name = state.token;
|
949
949
|
fn = operators[name];
|
950
950
|
getTokenSkipNewline(state);
|
951
|
-
const rightNode =
|
951
|
+
const rightNode = parseMultiplyDivideModulusPercentage(state);
|
952
952
|
if (rightNode.isPercentage) {
|
953
953
|
params = [node, new OperatorNode('*', 'multiply', [node, rightNode])];
|
954
954
|
} else {
|
@@ -960,11 +960,11 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
960
960
|
}
|
961
961
|
|
962
962
|
/**
|
963
|
-
* multiply, divide
|
963
|
+
* multiply, divide, modulus, percentage
|
964
964
|
* @return {Node} node
|
965
965
|
* @private
|
966
966
|
*/
|
967
|
-
function
|
967
|
+
function parseMultiplyDivideModulusPercentage(state) {
|
968
968
|
let node, last, name, fn;
|
969
969
|
node = parseImplicitMultiplication(state);
|
970
970
|
last = node;
|
@@ -972,7 +972,9 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
972
972
|
'*': 'multiply',
|
973
973
|
'.*': 'dotMultiply',
|
974
974
|
'/': 'divide',
|
975
|
-
'./': 'dotDivide'
|
975
|
+
'./': 'dotDivide',
|
976
|
+
'%': 'mod',
|
977
|
+
mod: 'mod'
|
976
978
|
};
|
977
979
|
while (true) {
|
978
980
|
if ((0, _object.hasOwnProperty)(operators, state.token)) {
|
@@ -980,8 +982,23 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
980
982
|
name = state.token;
|
981
983
|
fn = operators[name];
|
982
984
|
getTokenSkipNewline(state);
|
983
|
-
|
984
|
-
|
985
|
+
if (name === '%' && state.tokenType === TOKENTYPE.DELIMITER && state.token !== '(') {
|
986
|
+
// If the expression contains only %, then treat that as /100
|
987
|
+
if (state.token !== '' && operators[state.token]) {
|
988
|
+
const left = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true);
|
989
|
+
name = state.token;
|
990
|
+
fn = operators[name];
|
991
|
+
getTokenSkipNewline(state);
|
992
|
+
last = parseImplicitMultiplication(state);
|
993
|
+
node = new OperatorNode(name, fn, [left, last]);
|
994
|
+
} else {
|
995
|
+
node = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true);
|
996
|
+
}
|
997
|
+
// return node
|
998
|
+
} else {
|
999
|
+
last = parseImplicitMultiplication(state);
|
1000
|
+
node = new OperatorNode(name, fn, [node, last]);
|
1001
|
+
}
|
985
1002
|
} else {
|
986
1003
|
break;
|
987
1004
|
}
|
@@ -1024,7 +1041,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
1024
1041
|
* @private
|
1025
1042
|
*/
|
1026
1043
|
function parseRule2(state) {
|
1027
|
-
let node =
|
1044
|
+
let node = parseUnary(state);
|
1028
1045
|
let last = node;
|
1029
1046
|
const tokenStates = [];
|
1030
1047
|
while (true) {
|
@@ -1046,7 +1063,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
1046
1063
|
// Rewind once and build the "number / number" node; the symbol will be consumed later
|
1047
1064
|
(0, _extends2.default)(state, tokenStates.pop());
|
1048
1065
|
tokenStates.pop();
|
1049
|
-
last =
|
1066
|
+
last = parseUnary(state);
|
1050
1067
|
node = new OperatorNode('/', 'divide', [node, last]);
|
1051
1068
|
} else {
|
1052
1069
|
// Not a match, so rewind
|
@@ -1066,33 +1083,6 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
1066
1083
|
return node;
|
1067
1084
|
}
|
1068
1085
|
|
1069
|
-
/**
|
1070
|
-
* modulus and percentage
|
1071
|
-
* @return {Node} node
|
1072
|
-
* @private
|
1073
|
-
*/
|
1074
|
-
function parseModulusPercentage(state) {
|
1075
|
-
let node, name, fn, params;
|
1076
|
-
node = parseUnary(state);
|
1077
|
-
const operators = {
|
1078
|
-
'%': 'mod',
|
1079
|
-
mod: 'mod'
|
1080
|
-
};
|
1081
|
-
while ((0, _object.hasOwnProperty)(operators, state.token)) {
|
1082
|
-
name = state.token;
|
1083
|
-
fn = operators[name];
|
1084
|
-
getTokenSkipNewline(state);
|
1085
|
-
if (name === '%' && state.tokenType === TOKENTYPE.DELIMITER && state.token !== '(') {
|
1086
|
-
// If the expression contains only %, then treat that as /100
|
1087
|
-
node = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true);
|
1088
|
-
} else {
|
1089
|
-
params = [node, parseUnary(state)];
|
1090
|
-
node = new OperatorNode(name, fn, params);
|
1091
|
-
}
|
1092
|
-
}
|
1093
|
-
return node;
|
1094
|
-
}
|
1095
|
-
|
1096
1086
|
/**
|
1097
1087
|
* Unary plus and minus, and logical and bitwise not
|
1098
1088
|
* @return {Node} node
|
@@ -11,7 +11,7 @@ var _util = require("./simplify/util.js");
|
|
11
11
|
var _object = require("../../utils/object.js");
|
12
12
|
var _map = require("../../utils/map.js");
|
13
13
|
const name = 'simplify';
|
14
|
-
const dependencies = ['typed', 'parse', 'equal', 'resolve', 'simplifyConstant', 'simplifyCore', 'AccessorNode', 'ArrayNode', 'ConstantNode', 'FunctionNode', 'IndexNode', 'ObjectNode', 'OperatorNode', 'ParenthesisNode', 'SymbolNode'];
|
14
|
+
const dependencies = ['typed', 'parse', 'equal', 'resolve', 'simplifyConstant', 'simplifyCore', 'AccessorNode', 'ArrayNode', 'ConstantNode', 'FunctionNode', 'IndexNode', 'ObjectNode', 'OperatorNode', 'ParenthesisNode', 'SymbolNode', 'replacer'];
|
15
15
|
const createSimplify = exports.createSimplify = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
|
16
16
|
let {
|
17
17
|
typed,
|
@@ -28,7 +28,8 @@ const createSimplify = exports.createSimplify = /* #__PURE__ */(0, _factory.fact
|
|
28
28
|
ObjectNode,
|
29
29
|
OperatorNode,
|
30
30
|
ParenthesisNode,
|
31
|
-
SymbolNode
|
31
|
+
SymbolNode,
|
32
|
+
replacer
|
32
33
|
} = _ref;
|
33
34
|
const {
|
34
35
|
hasProperty,
|
@@ -1004,7 +1005,7 @@ const createSimplify = exports.createSimplify = /* #__PURE__ */(0, _factory.fact
|
|
1004
1005
|
const uniqueSets = [];
|
1005
1006
|
const unique = {};
|
1006
1007
|
for (let i = 0; i < sets.length; i++) {
|
1007
|
-
const s = JSON.stringify(sets[i]);
|
1008
|
+
const s = JSON.stringify(sets[i], replacer);
|
1008
1009
|
if (!unique[s]) {
|
1009
1010
|
unique[s] = true;
|
1010
1011
|
uniqueSets.push(sets[i]);
|
@@ -200,17 +200,11 @@ const createSimplifyConstant = exports.createSimplifyConstant = /* #__PURE__ */(
|
|
200
200
|
return new OperatorNode('-', 'unaryMinus', [n]);
|
201
201
|
}
|
202
202
|
function _fractionToNode(f) {
|
203
|
-
|
204
|
-
const
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
n = new ConstantNode(vn);
|
209
|
-
}
|
210
|
-
if (f.d === 1) {
|
211
|
-
return n;
|
212
|
-
}
|
213
|
-
return new OperatorNode('/', 'divide', [n, new ConstantNode(f.d)]);
|
203
|
+
// note: we convert await from bigint values, because bigint values gives issues with divisions: 1n/2n=0n and not 0.5
|
204
|
+
const fromBigInt = value => config.number === 'BigNumber' && bignumber ? bignumber(value) : Number(value);
|
205
|
+
const numeratorValue = f.s * f.n;
|
206
|
+
const numeratorNode = numeratorValue < 0n ? new OperatorNode('-', 'unaryMinus', [new ConstantNode(-fromBigInt(numeratorValue))]) : new ConstantNode(fromBigInt(numeratorValue));
|
207
|
+
return f.d === 1n ? numeratorNode : new OperatorNode('/', 'divide', [numeratorNode, new ConstantNode(fromBigInt(f.d))]);
|
214
208
|
}
|
215
209
|
|
216
210
|
/* Handles constant indexing of ArrayNodes, matrices, and ObjectNodes */
|
@@ -76,6 +76,8 @@ const createCeil = exports.createCeil = /* #__PURE__ */(0, _factory.factory)(nam
|
|
76
76
|
*
|
77
77
|
* math.ceil(x)
|
78
78
|
* math.ceil(x, n)
|
79
|
+
* math.ceil(unit, valuelessUnit)
|
80
|
+
* math.ceil(unit, n, valuelessUnit)
|
79
81
|
*
|
80
82
|
* Examples:
|
81
83
|
*
|
@@ -93,6 +95,12 @@ const createCeil = exports.createCeil = /* #__PURE__ */(0, _factory.factory)(nam
|
|
93
95
|
* math.ceil(c) // returns Complex 4 - 2i
|
94
96
|
* math.ceil(c, 1) // returns Complex 3.3 - 2.7i
|
95
97
|
*
|
98
|
+
* const unit = math.unit('3.241 cm')
|
99
|
+
* const cm = math.unit('cm')
|
100
|
+
* const mm = math.unit('mm')
|
101
|
+
* math.ceil(unit, 1, cm) // returns Unit 3.3 cm
|
102
|
+
* math.ceil(unit, 1, mm) // returns Unit 32.5 mm
|
103
|
+
*
|
96
104
|
* math.ceil([3.2, 3.8, -4.7]) // returns Array [4, 4, -4]
|
97
105
|
* math.ceil([3.21, 3.82, -4.71], 1) // returns Array [3.3, 3.9, -4.7]
|
98
106
|
*
|
@@ -100,9 +108,10 @@ const createCeil = exports.createCeil = /* #__PURE__ */(0, _factory.factory)(nam
|
|
100
108
|
*
|
101
109
|
* floor, fix, round
|
102
110
|
*
|
103
|
-
* @param {number | BigNumber | Fraction | Complex | Array | Matrix} x
|
111
|
+
* @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Value to be rounded
|
104
112
|
* @param {number | BigNumber | Array} [n=0] Number of decimals
|
105
|
-
* @
|
113
|
+
* @param {Unit} [valuelessUnit] A valueless unit
|
114
|
+
* @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Rounded value
|
106
115
|
*/
|
107
116
|
return typed('ceil', {
|
108
117
|
number: ceilNumber.signatures.number,
|
@@ -139,6 +148,16 @@ const createCeil = exports.createCeil = /* #__PURE__ */(0, _factory.factory)(nam
|
|
139
148
|
'Fraction, BigNumber': function (x, n) {
|
140
149
|
return x.ceil(n.toNumber());
|
141
150
|
},
|
151
|
+
'Unit, number, Unit': typed.referToSelf(self => function (x, n, unit) {
|
152
|
+
const valueless = x.toNumeric(unit);
|
153
|
+
return unit.multiply(self(valueless, n));
|
154
|
+
}),
|
155
|
+
'Unit, BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => self(x, n.toNumber(), unit)),
|
156
|
+
'Array | Matrix, number | BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => {
|
157
|
+
// deep map collection, skip zeros since ceil(0) = 0
|
158
|
+
return (0, _collection.deepMap)(x, value => self(value, n, unit), true);
|
159
|
+
}),
|
160
|
+
'Array | Matrix | Unit, Unit': typed.referToSelf(self => (x, unit) => self(x, 0, unit)),
|
142
161
|
'Array | Matrix': typed.referToSelf(self => x => {
|
143
162
|
// deep map collection, skip zeros since ceil(0) = 0
|
144
163
|
return (0, _collection.deepMap)(x, self, true);
|
@@ -12,7 +12,7 @@ var _matAlgo11xS0s = require("../../type/matrix/utils/matAlgo11xS0s.js");
|
|
12
12
|
var _matAlgo12xSfs = require("../../type/matrix/utils/matAlgo12xSfs.js");
|
13
13
|
var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js");
|
14
14
|
const name = 'dotDivide';
|
15
|
-
const dependencies = ['typed', 'matrix', 'equalScalar', 'divideScalar', 'DenseMatrix', 'concat'];
|
15
|
+
const dependencies = ['typed', 'matrix', 'equalScalar', 'divideScalar', 'DenseMatrix', 'concat', 'SparseMatrix'];
|
16
16
|
const createDotDivide = exports.createDotDivide = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
|
17
17
|
let {
|
18
18
|
typed,
|
@@ -20,7 +20,8 @@ const createDotDivide = exports.createDotDivide = /* #__PURE__ */(0, _factory.fa
|
|
20
20
|
equalScalar,
|
21
21
|
divideScalar,
|
22
22
|
DenseMatrix,
|
23
|
-
concat
|
23
|
+
concat,
|
24
|
+
SparseMatrix
|
24
25
|
} = _ref;
|
25
26
|
const matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({
|
26
27
|
typed,
|
@@ -31,7 +32,7 @@ const createDotDivide = exports.createDotDivide = /* #__PURE__ */(0, _factory.fa
|
|
31
32
|
});
|
32
33
|
const matAlgo07xSSf = (0, _matAlgo07xSSf.createMatAlgo07xSSf)({
|
33
34
|
typed,
|
34
|
-
|
35
|
+
SparseMatrix
|
35
36
|
});
|
36
37
|
const matAlgo11xS0s = (0, _matAlgo11xS0s.createMatAlgo11xS0s)({
|
37
38
|
typed,
|