UNPKG

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

80 lines (78 loc) • 2.59 kB
"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 _matAlgo12xSfs = require("../../type/matrix/utils/matAlgo12xSfs.js"); var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js"); const name = 'dotDivide'; const dependencies = ['typed', 'matrix', 'divideScalar', 'DenseMatrix', 'SparseMatrix']; const createDotDivide = exports.createDotDivide = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => { let typed = _ref.typed, matrix = _ref.matrix, divideScalar = _ref.divideScalar, DenseMatrix = _ref.DenseMatrix, SparseMatrix = _ref.SparseMatrix; const matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({ typed }); const matAlgo03xDSf = (0, _matAlgo03xDSf.createMatAlgo03xDSf)({ typed }); const matAlgo07xSSf = (0, _matAlgo07xSSf.createMatAlgo07xSSf)({ typed, SparseMatrix }); const matAlgo12xSfs = (0, _matAlgo12xSfs.createMatAlgo12xSfs)({ typed, DenseMatrix }); const matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({ typed, matrix }); /** * 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 * * History: * * v14.0.0 Return a sparse matrix for sparse inputs * v11.6 Support matrix broadcasting * v0.23 Renamed from `edivide` * * @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: matAlgo12xSfs, sS: matAlgo12xSfs })); });