"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createBitAnd = void 0; var _bitwise = require("../../utils/bignumber/bitwise.js"); var _algorithm = require("../../type/matrix/utils/algorithm02.js"); var _algorithm2 = require("../../type/matrix/utils/algorithm11.js"); var _algorithm3 = require("../../type/matrix/utils/algorithm13.js"); var _algorithm4 = require("../../type/matrix/utils/algorithm14.js"); var _algorithm5 = require("../../type/matrix/utils/algorithm06.js"); var _factory = require("../../utils/factory.js"); var _index = require("../../plain/number/index.js"); var name = 'bitAnd'; var dependencies = ['typed', 'matrix', 'equalScalar']; var createBitAnd = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) { var typed = _ref.typed, matrix = _ref.matrix, equalScalar = _ref.equalScalar; var algorithm02 = (0, _algorithm.createAlgorithm02)({ typed: typed, equalScalar: equalScalar }); var algorithm06 = (0, _algorithm5.createAlgorithm06)({ typed: typed, equalScalar: equalScalar }); var algorithm11 = (0, _algorithm2.createAlgorithm11)({ typed: typed, equalScalar: equalScalar }); var algorithm13 = (0, _algorithm3.createAlgorithm13)({ typed: typed }); var algorithm14 = (0, _algorithm4.createAlgorithm14)({ typed: typed }); /** * Bitwise AND two values, `x & y`. * For matrices, the function is evaluated element wise. * * Syntax: * * math.bitAnd(x, y) * * Examples: * * math.bitAnd(53, 131) // returns number 1 * * math.bitAnd([1, 12, 31], 42) // returns Array [0, 8, 10] * * See also: * * bitNot, bitOr, bitXor, leftShift, rightArithShift, rightLogShift * * @param {number | BigNumber | Array | Matrix} x First value to and * @param {number | BigNumber | Array | Matrix} y Second value to and * @return {number | BigNumber | Array | Matrix} AND of `x` and `y` */ return typed(name, { 'number, number': _index.bitAndNumber, 'BigNumber, BigNumber': _bitwise.bitAndBigNumber, 'SparseMatrix, SparseMatrix': function SparseMatrixSparseMatrix(x, y) { return algorithm06(x, y, this, false); }, 'SparseMatrix, DenseMatrix': function SparseMatrixDenseMatrix(x, y) { return algorithm02(y, x, this, true); }, 'DenseMatrix, SparseMatrix': function DenseMatrixSparseMatrix(x, y) { return algorithm02(x, y, this, false); }, 'DenseMatrix, DenseMatrix': function DenseMatrixDenseMatrix(x, y) { return algorithm13(x, y, this); }, 'Array, Array': function ArrayArray(x, y) { // use matrix implementation return this(matrix(x), matrix(y)).valueOf(); }, 'Array, Matrix': function ArrayMatrix(x, y) { // use matrix implementation return this(matrix(x), y); }, 'Matrix, Array': function MatrixArray(x, y) { // use matrix implementation return this(x, matrix(y)); }, 'SparseMatrix, any': function SparseMatrixAny(x, y) { return algorithm11(x, y, this, false); }, 'DenseMatrix, any': function DenseMatrixAny(x, y) { return algorithm14(x, y, this, false); }, 'any, SparseMatrix': function anySparseMatrix(x, y) { return algorithm11(y, x, this, true); }, 'any, DenseMatrix': function anyDenseMatrix(x, y) { return algorithm14(y, x, this, true); }, 'Array, any': function ArrayAny(x, y) { // use matrix implementation return algorithm14(matrix(x), y, this, false).valueOf(); }, 'any, Array': function anyArray(x, y) { // use matrix implementation return algorithm14(matrix(y), x, this, true).valueOf(); } }); }); exports.createBitAnd = createBitAnd;