feat:node-modules

This commit is contained in:
houjunxiang
2025-11-24 10:26:18 +08:00
parent 753766893b
commit 8a3e48d856
8825 changed files with 567399 additions and 1 deletions

47
node_modules/mathjs/lib/cjs/function/arithmetic/abs.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAbs = void 0;
var _factory = require("../../utils/factory.js");
var _collection = require("../../utils/collection.js");
var _index = require("../../plain/number/index.js");
const name = 'abs';
const dependencies = ['typed'];
const createAbs = exports.createAbs = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Calculate the absolute value of a number. For matrices, the function is
* evaluated element wise.
*
* Syntax:
*
* math.abs(x)
*
* Examples:
*
* math.abs(3.5) // returns number 3.5
* math.abs(-4.2) // returns number 4.2
*
* math.abs([3, -5, -1, 0, 2]) // returns Array [3, 5, 1, 0, 2]
*
* See also:
*
* sign
*
* @param {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit} x
* A number or matrix for which to get the absolute value
* @return {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit}
* Absolute value of `x`
*/
return typed(name, {
number: _index.absNumber,
'Complex | BigNumber | Fraction | Unit': x => x.abs(),
bigint: x => x < 0n ? -x : x,
// deep map collection, skip zeros since abs(0) = 0
'Array | Matrix': typed.referToSelf(self => x => (0, _collection.deepMap)(x, self, true))
});
});

89
node_modules/mathjs/lib/cjs/function/arithmetic/add.js generated vendored Normal file
View File

@@ -0,0 +1,89 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAdd = void 0;
var _factory = require("../../utils/factory.js");
var _matAlgo01xDSid = require("../../type/matrix/utils/matAlgo01xDSid.js");
var _matAlgo04xSidSid = require("../../type/matrix/utils/matAlgo04xSidSid.js");
var _matAlgo10xSids = require("../../type/matrix/utils/matAlgo10xSids.js");
var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js");
const name = 'add';
const dependencies = ['typed', 'matrix', 'addScalar', 'equalScalar', 'DenseMatrix', 'SparseMatrix', 'concat'];
const createAdd = exports.createAdd = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
matrix,
addScalar,
equalScalar,
DenseMatrix,
SparseMatrix,
concat
} = _ref;
const matAlgo01xDSid = (0, _matAlgo01xDSid.createMatAlgo01xDSid)({
typed
});
const matAlgo04xSidSid = (0, _matAlgo04xSidSid.createMatAlgo04xSidSid)({
typed,
equalScalar
});
const matAlgo10xSids = (0, _matAlgo10xSids.createMatAlgo10xSids)({
typed,
DenseMatrix
});
const matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({
typed,
matrix,
concat
});
/**
* Add two or more values, `x + y`.
* For matrices, the function is evaluated element wise.
*
* Syntax:
*
* math.add(x, y)
* math.add(x, y, z, ...)
*
* Examples:
*
* math.add(2, 3) // returns number 5
* math.add(2, 3, 4) // returns number 9
*
* const a = math.complex(2, 3)
* const b = math.complex(-4, 1)
* math.add(a, b) // returns Complex -2 + 4i
*
* math.add([1, 2, 3], 4) // returns Array [5, 6, 7]
*
* const c = math.unit('5 cm')
* const d = math.unit('2.1 mm')
* math.add(c, d) // returns Unit 52.1 mm
*
* math.add("2.3", "4") // returns number 6.3
*
* See also:
*
* subtract, sum
*
* @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x First value to add
* @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} y Second value to add
* @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Sum of `x` and `y`
*/
return typed(name, {
'any, any': addScalar,
'any, any, ...any': typed.referToSelf(self => (x, y, rest) => {
let result = self(x, y);
for (let i = 0; i < rest.length; i++) {
result = self(result, rest[i]);
}
return result;
})
}, matrixAlgorithmSuite({
elop: addScalar,
DS: matAlgo01xDSid,
SS: matAlgo04xSidSid,
Ss: matAlgo10xSids
}));
});

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAddScalar = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'addScalar';
const dependencies = ['typed'];
const createAddScalar = exports.createAddScalar = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Add two scalar values, `x + y`.
* This function is meant for internal use: it is used by the public function
* `add`
*
* This function does not support collections (Array or Matrix).
*
* @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value to add
* @param {number | BigNumber | bigint | Fraction | Complex} y Second value to add
* @return {number | BigNumber | bigint | Fraction | Complex | Unit} Sum of `x` and `y`
* @private
*/
return typed(name, {
'number, number': _index.addNumber,
'Complex, Complex': function (x, y) {
return x.add(y);
},
'BigNumber, BigNumber': function (x, y) {
return x.plus(y);
},
'bigint, bigint': function (x, y) {
return x + y;
},
'Fraction, Fraction': function (x, y) {
return x.add(y);
},
'Unit, Unit': typed.referToSelf(self => (x, y) => {
if (x.value === null || x.value === undefined) {
throw new Error('Parameter x contains a unit with undefined value');
}
if (y.value === null || y.value === undefined) {
throw new Error('Parameter y contains a unit with undefined value');
}
if (!x.equalBase(y)) throw new Error('Units do not match');
const res = x.clone();
res.value = typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value);
res.fixPrefix = false;
return res;
})
});
});

137
node_modules/mathjs/lib/cjs/function/arithmetic/cbrt.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

168
node_modules/mathjs/lib/cjs/function/arithmetic/ceil.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCube = void 0;
var _factory = require("../../utils/factory.js");
var _index = require("../../plain/number/index.js");
const name = 'cube';
const dependencies = ['typed'];
const createCube = exports.createCube = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed
} = _ref;
/**
* Compute the cube of a value, `x * x * x`.
* To avoid confusion with `pow(M,3)`, this function does not apply to matrices.
* If you wish to cube every entry of a matrix, see the examples.
*
* Syntax:
*
* math.cube(x)
*
* Examples:
*
* math.cube(2) // returns number 8
* math.pow(2, 3) // returns number 8
* math.cube(4) // returns number 64
* 4 * 4 * 4 // returns number 64
*
* math.map([1, 2, 3, 4], math.cube) // returns Array [1, 8, 27, 64]
*
* See also:
*
* multiply, square, pow, cbrt
*
* @param {number | BigNumber | bigint | Fraction | Complex | Unit} x Number for which to calculate the cube
* @return {number | BigNumber | bigint | Fraction | Complex | Unit} Cube of x
*/
return typed(name, {
number: _index.cubeNumber,
Complex: function (x) {
return x.mul(x).mul(x); // Is faster than pow(x, 3)
},
BigNumber: function (x) {
return x.times(x).times(x);
},
bigint: function (x) {
return x * x * x;
},
Fraction: function (x) {
return x.pow(3); // Is faster than mul()mul()mul()
},
Unit: function (x) {
return x.pow(3);
}
});
});

View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createDivide = void 0;
var _factory = require("../../utils/factory.js");
var _object = require("../../utils/object.js");
var _matAlgo11xS0s = require("../../type/matrix/utils/matAlgo11xS0s.js");
var _matAlgo14xDs = require("../../type/matrix/utils/matAlgo14xDs.js");
const name = 'divide';
const dependencies = ['typed', 'matrix', 'multiply', 'equalScalar', 'divideScalar', 'inv'];
const createDivide = exports.createDivide = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
matrix,
multiply,
equalScalar,
divideScalar,
inv
} = _ref;
const matAlgo11xS0s = (0, _matAlgo11xS0s.createMatAlgo11xS0s)({
typed,
equalScalar
});
const matAlgo14xDs = (0, _matAlgo14xDs.createMatAlgo14xDs)({
typed
});
/**
* Divide two values, `x / y`.
* To divide matrices, `x` is multiplied with the inverse of `y`: `x * inv(y)`.
*
* Syntax:
*
* math.divide(x, y)
*
* Examples:
*
* math.divide(2, 3) // returns number 0.6666666666666666
*
* const a = math.complex(5, 14)
* const b = math.complex(4, 1)
* math.divide(a, b) // returns Complex 2 + 3i
*
* const c = [[7, -6], [13, -4]]
* const d = [[1, 2], [4, 3]]
* math.divide(c, d) // returns Array [[-9, 4], [-11, 6]]
*
* const e = math.unit('18 km')
* math.divide(e, 4.5) // returns Unit 4 km
*
* See also:
*
* multiply
*
* @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x Numerator
* @param {number | BigNumber | bigint | Fraction | Complex | Array | Matrix} y Denominator
* @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Quotient, `x / y`
*/
return typed('divide', (0, _object.extend)({
// we extend the signatures of divideScalar with signatures dealing with matrices
'Array | Matrix, Array | Matrix': function (x, y) {
// TODO: implement matrix right division using pseudo inverse
// https://www.mathworks.nl/help/matlab/ref/mrdivide.html
// https://www.gnu.org/software/octave/doc/interpreter/Arithmetic-Ops.html
// https://stackoverflow.com/questions/12263932/how-does-gnu-octave-matrix-division-work-getting-unexpected-behaviour
return multiply(x, inv(y));
},
'DenseMatrix, any': function (x, y) {
return matAlgo14xDs(x, y, divideScalar, false);
},
'SparseMatrix, any': function (x, y) {
return matAlgo11xS0s(x, y, divideScalar, false);
},
'Array, any': function (x, y) {
// use matrix implementation
return matAlgo14xDs(matrix(x), y, divideScalar, false).valueOf();
},
'any, Array | Matrix': function (x, y) {
return multiply(x, inv(y));
}
}, divideScalar.signatures));
});

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createDivideScalar = void 0;
var _factory = require("../../utils/factory.js");
const name = 'divideScalar';
const dependencies = ['typed', 'numeric'];
const createDivideScalar = exports.createDivideScalar = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
numeric
} = _ref;
/**
* Divide two scalar values, `x / y`.
* This function is meant for internal use: it is used by the public functions
* `divide` and `inv`.
*
* This function does not support collections (Array or Matrix).
*
* @param {number | BigNumber | bigint | Fraction | Complex | Unit} x Numerator
* @param {number | BigNumber | bigint | Fraction | Complex} y Denominator
* @return {number | BigNumber | bigint | Fraction | Complex | Unit} Quotient, `x / y`
* @private
*/
return typed(name, {
'number, number': function (x, y) {
return x / y;
},
'Complex, Complex': function (x, y) {
return x.div(y);
},
'BigNumber, BigNumber': function (x, y) {
return x.div(y);
},
'bigint, bigint': function (x, y) {
return x / y;
},
'Fraction, Fraction': function (x, y) {
return x.div(y);
},
'Unit, number | Complex | Fraction | BigNumber | Unit': (x, y) => x.divide(y),
'number | Fraction | Complex | BigNumber, Unit': (x, y) => y.divideInto(x)
});
});

View File

@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createDotDivide = void 0;
var _factory = require("../../utils/factory.js");
var _matAlgo02xDS = require("../../type/matrix/utils/matAlgo02xDS0.js");
var _matAlgo03xDSf = require("../../type/matrix/utils/matAlgo03xDSf.js");
var _matAlgo07xSSf = require("../../type/matrix/utils/matAlgo07xSSf.js");
var _matAlgo11xS0s = require("../../type/matrix/utils/matAlgo11xS0s.js");
var _matAlgo12xSfs = require("../../type/matrix/utils/matAlgo12xSfs.js");
var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js");
const name = 'dotDivide';
const dependencies = ['typed', 'matrix', 'equalScalar', 'divideScalar', 'DenseMatrix', 'concat'];
const createDotDivide = exports.createDotDivide = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
matrix,
equalScalar,
divideScalar,
DenseMatrix,
concat
} = _ref;
const matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({
typed,
equalScalar
});
const matAlgo03xDSf = (0, _matAlgo03xDSf.createMatAlgo03xDSf)({
typed
});
const matAlgo07xSSf = (0, _matAlgo07xSSf.createMatAlgo07xSSf)({
typed,
DenseMatrix
});
const matAlgo11xS0s = (0, _matAlgo11xS0s.createMatAlgo11xS0s)({
typed,
equalScalar
});
const matAlgo12xSfs = (0, _matAlgo12xSfs.createMatAlgo12xSfs)({
typed,
DenseMatrix
});
const matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({
typed,
matrix,
concat
});
/**
* Divide two matrices element wise. The function accepts both matrices and
* scalar values.
*
* Syntax:
*
* math.dotDivide(x, y)
*
* Examples:
*
* math.dotDivide(2, 4) // returns 0.5
*
* a = [[9, 5], [6, 1]]
* b = [[3, 2], [5, 2]]
*
* math.dotDivide(a, b) // returns [[3, 2.5], [1.2, 0.5]]
* math.divide(a, b) // returns [[1.75, 0.75], [-1.75, 2.25]]
*
* See also:
*
* divide, multiply, dotMultiply
*
* @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Numerator
* @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} y Denominator
* @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Quotient, `x ./ y`
*/
return typed(name, matrixAlgorithmSuite({
elop: divideScalar,
SS: matAlgo07xSSf,
DS: matAlgo03xDSf,
SD: matAlgo02xDS0,
Ss: matAlgo11xS0s,
sS: matAlgo12xSfs
}));
});

View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createDotMultiply = void 0;
var _factory = require("../../utils/factory.js");
var _matAlgo02xDS = require("../../type/matrix/utils/matAlgo02xDS0.js");
var _matAlgo09xS0Sf = require("../../type/matrix/utils/matAlgo09xS0Sf.js");
var _matAlgo11xS0s = require("../../type/matrix/utils/matAlgo11xS0s.js");
var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js");
const name = 'dotMultiply';
const dependencies = ['typed', 'matrix', 'equalScalar', 'multiplyScalar', 'concat'];
const createDotMultiply = exports.createDotMultiply = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
matrix,
equalScalar,
multiplyScalar,
concat
} = _ref;
const matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({
typed,
equalScalar
});
const matAlgo09xS0Sf = (0, _matAlgo09xS0Sf.createMatAlgo09xS0Sf)({
typed,
equalScalar
});
const matAlgo11xS0s = (0, _matAlgo11xS0s.createMatAlgo11xS0s)({
typed,
equalScalar
});
const matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({
typed,
matrix,
concat
});
/**
* Multiply two matrices element wise. The function accepts both matrices and
* scalar values.
*
* Syntax:
*
* math.dotMultiply(x, y)
*
* Examples:
*
* math.dotMultiply(2, 4) // returns 8
*
* a = [[9, 5], [6, 1]]
* b = [[3, 2], [5, 2]]
*
* math.dotMultiply(a, b) // returns [[27, 10], [30, 2]]
* math.multiply(a, b) // returns [[52, 28], [23, 14]]
*
* See also:
*
* multiply, divide, dotDivide
*
* @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Left hand value
* @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} y Right hand value
* @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Multiplication of `x` and `y`
*/
return typed(name, matrixAlgorithmSuite({
elop: multiplyScalar,
SS: matAlgo09xS0Sf,
DS: matAlgo02xDS0,
Ss: matAlgo11xS0s
}));
});

Some files were not shown because too many files have changed in this diff Show More