mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
82 lines (80 loc) • 2.75 kB
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");
var name = 'dotDivide';
var dependencies = ['typed', 'matrix', 'equalScalar', 'divideScalar', 'DenseMatrix', 'concat'];
var createDotDivide = exports.createDotDivide = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
var typed = _ref.typed,
matrix = _ref.matrix,
equalScalar = _ref.equalScalar,
divideScalar = _ref.divideScalar,
DenseMatrix = _ref.DenseMatrix,
concat = _ref.concat;
var matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({
typed: typed,
equalScalar: equalScalar
});
var matAlgo03xDSf = (0, _matAlgo03xDSf.createMatAlgo03xDSf)({
typed: typed
});
var matAlgo07xSSf = (0, _matAlgo07xSSf.createMatAlgo07xSSf)({
typed: typed,
DenseMatrix: DenseMatrix
});
var matAlgo11xS0s = (0, _matAlgo11xS0s.createMatAlgo11xS0s)({
typed: typed,
equalScalar: equalScalar
});
var matAlgo12xSfs = (0, _matAlgo12xSfs.createMatAlgo12xSfs)({
typed: typed,
DenseMatrix: DenseMatrix
});
var matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({
typed: typed,
matrix: matrix,
concat: 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
}));
});