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
70 lines (68 loc) • 2.34 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createDotMultiply = void 0;
var _factory = require("../../utils/factory.js");
var _matAlgo02xDS = require("../../type/matrix/utils/matAlgo02xDS0.js");
var _matAlgo09xS0Sf = require("../../type/matrix/utils/matAlgo09xS0Sf.js");
var _matAlgo11xS0s = require("../../type/matrix/utils/matAlgo11xS0s.js");
var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js");
var name = 'dotMultiply';
var dependencies = ['typed', 'matrix', 'equalScalar', 'multiplyScalar', 'concat'];
var createDotMultiply = exports.createDotMultiply = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
var typed = _ref.typed,
matrix = _ref.matrix,
equalScalar = _ref.equalScalar,
multiplyScalar = _ref.multiplyScalar,
concat = _ref.concat;
var matAlgo02xDS0 = (0, _matAlgo02xDS.createMatAlgo02xDS0)({
typed: typed,
equalScalar: equalScalar
});
var matAlgo09xS0Sf = (0, _matAlgo09xS0Sf.createMatAlgo09xS0Sf)({
typed: typed,
equalScalar: equalScalar
});
var matAlgo11xS0s = (0, _matAlgo11xS0s.createMatAlgo11xS0s)({
typed: typed,
equalScalar: equalScalar
});
var matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({
typed: typed,
matrix: matrix,
concat: 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
}));
});