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

31 lines (30 loc) • 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMatAlgo15xAs = void 0; var _factory = require("../../../utils/factory.js"); var _array = require("../../../utils/array.js"); const name = 'matAlgo15xAs'; const dependencies = []; const createMatAlgo15xAs = exports.createMatAlgo15xAs = /* #__PURE__ */(0, _factory.factory)(name, dependencies, () => { /** * Deeply iterates over Array items and invokes the callback function * f(Aij..z, b) for each nested scalar. * The callback function is invoked once for each item. * * C(i,j,...z) = f(Aij..z, b) * * @param {Array} a The Array instance (A) * @param {Scalar} b The Scalar value * @param {Function} cf The f(Aij..z,b) operation to invoke * @param {boolean} inverse A true value indicates callback should be invoked f(b,Aij..z) * * @return {Array} Array (C) * * https://github.com/josdejong/mathjs/pull/346#issuecomment-97659042 */ return function matAlgo15xAs(a, b, cf, inverse) { return inverse ? (0, _array.deepMap)(a, v => cf(b, v), true) : (0, _array.deepMap)(a, v => cf(v, b), true); }; });