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

41
node_modules/mathjs/lib/esm/function/arithmetic/abs.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
import { factory } from '../../utils/factory.js';
import { deepMap } from '../../utils/collection.js';
import { absNumber } from '../../plain/number/index.js';
var name = 'abs';
var dependencies = ['typed'];
export var createAbs = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
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: 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 => deepMap(x, self, true))
});
});

83
node_modules/mathjs/lib/esm/function/arithmetic/add.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
import { factory } from '../../utils/factory.js';
import { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js';
import { createMatAlgo04xSidSid } from '../../type/matrix/utils/matAlgo04xSidSid.js';
import { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js';
import { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js';
var name = 'add';
var dependencies = ['typed', 'matrix', 'addScalar', 'equalScalar', 'DenseMatrix', 'SparseMatrix', 'concat'];
export var createAdd = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
typed,
matrix,
addScalar,
equalScalar,
DenseMatrix,
SparseMatrix,
concat
} = _ref;
var matAlgo01xDSid = createMatAlgo01xDSid({
typed
});
var matAlgo04xSidSid = createMatAlgo04xSidSid({
typed,
equalScalar
});
var matAlgo10xSids = createMatAlgo10xSids({
typed,
DenseMatrix
});
var 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) => {
var result = self(x, y);
for (var 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,49 @@
import { factory } from '../../utils/factory.js';
import { addNumber } from '../../plain/number/index.js';
var name = 'addScalar';
var dependencies = ['typed'];
export var createAddScalar = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
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': addNumber,
'Complex, Complex': function Complex_Complex(x, y) {
return x.add(y);
},
'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {
return x.plus(y);
},
'bigint, bigint': function bigint_bigint(x, y) {
return x + y;
},
'Fraction, Fraction': function Fraction_Fraction(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');
var res = x.clone();
res.value = typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value);
res.fixPrefix = false;
return res;
})
});
});

131
node_modules/mathjs/lib/esm/function/arithmetic/cbrt.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

161
node_modules/mathjs/lib/esm/function/arithmetic/ceil.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
import { factory } from '../../utils/factory.js';
import { cubeNumber } from '../../plain/number/index.js';
var name = 'cube';
var dependencies = ['typed'];
export var createCube = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
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: cubeNumber,
Complex: function Complex(x) {
return x.mul(x).mul(x); // Is faster than pow(x, 3)
},
BigNumber: function BigNumber(x) {
return x.times(x).times(x);
},
bigint: function bigint(x) {
return x * x * x;
},
Fraction: function Fraction(x) {
return x.pow(3); // Is faster than mul()mul()mul()
},
Unit: function Unit(x) {
return x.pow(3);
}
});
});

View File

@@ -0,0 +1,79 @@
import { factory } from '../../utils/factory.js';
import { extend } from '../../utils/object.js';
import { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js';
import { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js';
var name = 'divide';
var dependencies = ['typed', 'matrix', 'multiply', 'equalScalar', 'divideScalar', 'inv'];
export var createDivide = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
typed,
matrix,
multiply,
equalScalar,
divideScalar,
inv
} = _ref;
var matAlgo11xS0s = createMatAlgo11xS0s({
typed,
equalScalar
});
var 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', extend({
// we extend the signatures of divideScalar with signatures dealing with matrices
'Array | Matrix, Array | Matrix': function Array__Matrix_Array__Matrix(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 DenseMatrix_any(x, y) {
return matAlgo14xDs(x, y, divideScalar, false);
},
'SparseMatrix, any': function SparseMatrix_any(x, y) {
return matAlgo11xS0s(x, y, divideScalar, false);
},
'Array, any': function Array_any(x, y) {
// use matrix implementation
return matAlgo14xDs(matrix(x), y, divideScalar, false).valueOf();
},
'any, Array | Matrix': function any_Array__Matrix(x, y) {
return multiply(x, inv(y));
}
}, divideScalar.signatures));
});

View File

@@ -0,0 +1,40 @@
import { factory } from '../../utils/factory.js';
var name = 'divideScalar';
var dependencies = ['typed', 'numeric'];
export var createDivideScalar = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
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 number_number(x, y) {
return x / y;
},
'Complex, Complex': function Complex_Complex(x, y) {
return x.div(y);
},
'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {
return x.div(y);
},
'bigint, bigint': function bigint_bigint(x, y) {
return x / y;
},
'Fraction, Fraction': function Fraction_Fraction(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,78 @@
import { factory } from '../../utils/factory.js';
import { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js';
import { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js';
import { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js';
import { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js';
import { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js';
import { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js';
var name = 'dotDivide';
var dependencies = ['typed', 'matrix', 'equalScalar', 'divideScalar', 'DenseMatrix', 'concat'];
export var createDotDivide = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
typed,
matrix,
equalScalar,
divideScalar,
DenseMatrix,
concat
} = _ref;
var matAlgo02xDS0 = createMatAlgo02xDS0({
typed,
equalScalar
});
var matAlgo03xDSf = createMatAlgo03xDSf({
typed
});
var matAlgo07xSSf = createMatAlgo07xSSf({
typed,
DenseMatrix
});
var matAlgo11xS0s = createMatAlgo11xS0s({
typed,
equalScalar
});
var matAlgo12xSfs = createMatAlgo12xSfs({
typed,
DenseMatrix
});
var 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,66 @@
import { factory } from '../../utils/factory.js';
import { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js';
import { createMatAlgo09xS0Sf } from '../../type/matrix/utils/matAlgo09xS0Sf.js';
import { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js';
import { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js';
var name = 'dotMultiply';
var dependencies = ['typed', 'matrix', 'equalScalar', 'multiplyScalar', 'concat'];
export var createDotMultiply = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
typed,
matrix,
equalScalar,
multiplyScalar,
concat
} = _ref;
var matAlgo02xDS0 = createMatAlgo02xDS0({
typed,
equalScalar
});
var matAlgo09xS0Sf = createMatAlgo09xS0Sf({
typed,
equalScalar
});
var matAlgo11xS0s = createMatAlgo11xS0s({
typed,
equalScalar
});
var 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