feat:node-modules
This commit is contained in:
111
node_modules/mathjs/lib/esm/function/matrix/apply.js
generated
vendored
Normal file
111
node_modules/mathjs/lib/esm/function/matrix/apply.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
59
node_modules/mathjs/lib/esm/function/matrix/column.js
generated
vendored
Normal file
59
node_modules/mathjs/lib/esm/function/matrix/column.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import { factory } from '../../utils/factory.js';
|
||||
import { isMatrix } from '../../utils/is.js';
|
||||
import { clone } from '../../utils/object.js';
|
||||
import { validateIndex } from '../../utils/array.js';
|
||||
var name = 'column';
|
||||
var dependencies = ['typed', 'Index', 'matrix', 'range'];
|
||||
export var createColumn = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
Index,
|
||||
matrix,
|
||||
range
|
||||
} = _ref;
|
||||
/**
|
||||
* Return a column from a Matrix.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.column(value, index)
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* // get a column
|
||||
* const d = [[1, 2], [3, 4]]
|
||||
* math.column(d, 1) // returns [[2], [4]]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* row
|
||||
*
|
||||
* @param {Array | Matrix } value An array or matrix
|
||||
* @param {number} column The index of the column
|
||||
* @return {Array | Matrix} The retrieved column
|
||||
*/
|
||||
return typed(name, {
|
||||
'Matrix, number': _column,
|
||||
'Array, number': function Array_number(value, column) {
|
||||
return _column(matrix(clone(value)), column).valueOf();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieve a column of a matrix
|
||||
* @param {Matrix } value A matrix
|
||||
* @param {number} column The index of the column
|
||||
* @return {Matrix} The retrieved column
|
||||
*/
|
||||
function _column(value, column) {
|
||||
// check dimensions
|
||||
if (value.size().length !== 2) {
|
||||
throw new Error('Only two dimensional matrix is supported');
|
||||
}
|
||||
validateIndex(column, value.size()[1]);
|
||||
var rowRange = range(0, value.size()[0]);
|
||||
var index = new Index(rowRange, column);
|
||||
var result = value.subset(index);
|
||||
return isMatrix(result) ? result : matrix([[result]]);
|
||||
}
|
||||
});
|
||||
104
node_modules/mathjs/lib/esm/function/matrix/concat.js
generated
vendored
Normal file
104
node_modules/mathjs/lib/esm/function/matrix/concat.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
39
node_modules/mathjs/lib/esm/function/matrix/count.js
generated
vendored
Normal file
39
node_modules/mathjs/lib/esm/function/matrix/count.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'count';
|
||||
var dependencies = ['typed', 'size', 'prod'];
|
||||
export var createCount = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
size,
|
||||
prod
|
||||
} = _ref;
|
||||
/**
|
||||
* Count the number of elements of a matrix, array or string.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.count(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.count('hello world') // returns 11
|
||||
* const A = [[1, 2, 3], [4, 5, 6]]
|
||||
* math.count(A) // returns 6
|
||||
* math.count(math.range(1,6)) // returns 5
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* size
|
||||
*
|
||||
* @param {string | Array | Matrix} x A matrix or string
|
||||
* @return {number} An integer with the elements in `x`.
|
||||
*/
|
||||
return typed(name, {
|
||||
string: function string(x) {
|
||||
return x.length;
|
||||
},
|
||||
'Matrix | Array': function Matrix__Array(x) {
|
||||
return prod(size(x));
|
||||
}
|
||||
});
|
||||
});
|
||||
81
node_modules/mathjs/lib/esm/function/matrix/cross.js
generated
vendored
Normal file
81
node_modules/mathjs/lib/esm/function/matrix/cross.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
import { arraySize, squeeze } from '../../utils/array.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'cross';
|
||||
var dependencies = ['typed', 'matrix', 'subtract', 'multiply'];
|
||||
export var createCross = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
matrix,
|
||||
subtract,
|
||||
multiply
|
||||
} = _ref;
|
||||
/**
|
||||
* Calculate the cross product for two vectors in three dimensional space.
|
||||
* The cross product of `A = [a1, a2, a3]` and `B = [b1, b2, b3]` is defined
|
||||
* as:
|
||||
*
|
||||
* cross(A, B) = [
|
||||
* a2 * b3 - a3 * b2,
|
||||
* a3 * b1 - a1 * b3,
|
||||
* a1 * b2 - a2 * b1
|
||||
* ]
|
||||
*
|
||||
* If one of the input vectors has a dimension greater than 1, the output
|
||||
* vector will be a 1x3 (2-dimensional) matrix.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.cross(x, y)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.cross([1, 1, 0], [0, 1, 1]) // Returns [1, -1, 1]
|
||||
* math.cross([3, -3, 1], [4, 9, 2]) // Returns [-15, -2, 39]
|
||||
* math.cross([2, 3, 4], [5, 6, 7]) // Returns [-3, 6, -3]
|
||||
* math.cross([[1, 2, 3]], [[4], [5], [6]]) // Returns [[-3, 6, -3]]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* dot, multiply
|
||||
*
|
||||
* @param {Array | Matrix} x First vector
|
||||
* @param {Array | Matrix} y Second vector
|
||||
* @return {Array | Matrix} Returns the cross product of `x` and `y`
|
||||
*/
|
||||
return typed(name, {
|
||||
'Matrix, Matrix': function Matrix_Matrix(x, y) {
|
||||
return matrix(_cross(x.toArray(), y.toArray()));
|
||||
},
|
||||
'Matrix, Array': function Matrix_Array(x, y) {
|
||||
return matrix(_cross(x.toArray(), y));
|
||||
},
|
||||
'Array, Matrix': function Array_Matrix(x, y) {
|
||||
return matrix(_cross(x, y.toArray()));
|
||||
},
|
||||
'Array, Array': _cross
|
||||
});
|
||||
|
||||
/**
|
||||
* Calculate the cross product for two arrays
|
||||
* @param {Array} x First vector
|
||||
* @param {Array} y Second vector
|
||||
* @returns {Array} Returns the cross product of x and y
|
||||
* @private
|
||||
*/
|
||||
function _cross(x, y) {
|
||||
var highestDimension = Math.max(arraySize(x).length, arraySize(y).length);
|
||||
x = squeeze(x);
|
||||
y = squeeze(y);
|
||||
var xSize = arraySize(x);
|
||||
var ySize = arraySize(y);
|
||||
if (xSize.length !== 1 || ySize.length !== 1 || xSize[0] !== 3 || ySize[0] !== 3) {
|
||||
throw new RangeError('Vectors with length 3 expected ' + '(Size A = [' + xSize.join(', ') + '], B = [' + ySize.join(', ') + '])');
|
||||
}
|
||||
var product = [subtract(multiply(x[1], y[2]), multiply(x[2], y[1])), subtract(multiply(x[2], y[0]), multiply(x[0], y[2])), subtract(multiply(x[0], y[1]), multiply(x[1], y[0]))];
|
||||
if (highestDimension > 1) {
|
||||
return [product];
|
||||
} else {
|
||||
return product;
|
||||
}
|
||||
}
|
||||
});
|
||||
37
node_modules/mathjs/lib/esm/function/matrix/ctranspose.js
generated
vendored
Normal file
37
node_modules/mathjs/lib/esm/function/matrix/ctranspose.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'ctranspose';
|
||||
var dependencies = ['typed', 'transpose', 'conj'];
|
||||
export var createCtranspose = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
transpose,
|
||||
conj
|
||||
} = _ref;
|
||||
/**
|
||||
* Transpose and complex conjugate a matrix. All values of the matrix are
|
||||
* reflected over its main diagonal and then the complex conjugate is
|
||||
* taken. This is equivalent to complex conjugation for scalars and
|
||||
* vectors.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.ctranspose(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* const A = [[1, 2, 3], [4, 5, math.complex(6,7)]]
|
||||
* math.ctranspose(A) // returns [[1, 4], [2, 5], [3, {re:6,im:7}]]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* transpose, diag, inv, subset, squeeze
|
||||
*
|
||||
* @param {Array | Matrix} x Matrix to be ctransposed
|
||||
* @return {Array | Matrix} The ctransposed matrix
|
||||
*/
|
||||
return typed(name, {
|
||||
any: function any(x) {
|
||||
return conj(transpose(x));
|
||||
}
|
||||
});
|
||||
});
|
||||
142
node_modules/mathjs/lib/esm/function/matrix/det.js
generated
vendored
Normal file
142
node_modules/mathjs/lib/esm/function/matrix/det.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
155
node_modules/mathjs/lib/esm/function/matrix/diag.js
generated
vendored
Normal file
155
node_modules/mathjs/lib/esm/function/matrix/diag.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
163
node_modules/mathjs/lib/esm/function/matrix/diff.js
generated
vendored
Normal file
163
node_modules/mathjs/lib/esm/function/matrix/diff.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
156
node_modules/mathjs/lib/esm/function/matrix/dot.js
generated
vendored
Normal file
156
node_modules/mathjs/lib/esm/function/matrix/dot.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user