jiangchengfeiyi-xiaochengxu/node_modules/mathjs/lib/cjs/function/arithmetic/dotDivide.js
2025-01-02 11:13:50 +08:00

85 lines
2.5 KiB
JavaScript

"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', 'SparseMatrix'];
const createDotDivide = exports.createDotDivide = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
matrix,
equalScalar,
divideScalar,
DenseMatrix,
concat,
SparseMatrix
} = _ref;
const matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({
typed,
equalScalar
});
const matAlgo03xDSf = (0, _matAlgo03xDSf.createMatAlgo03xDSf)({
typed
});
const matAlgo07xSSf = (0, _matAlgo07xSSf.createMatAlgo07xSSf)({
typed,
SparseMatrix
});
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
}));
});