add#

bamengine.ops.add(a, b, out=None)[source]#

Add two arrays or array and scalar.

Parameters:
  • a (array) – First array.

  • b (array or float) – Second array or scalar.

  • out (array, optional) – Output array. If provided, result is written in-place.

Returns:

Result of addition.

Return type:

array

Examples

>>> import bamengine.ops as ops
>>> prices = np.array([1.0, 2.0, 3.0])
>>> markup = 0.5
>>> new_prices = ops.add(prices, markup)
>>> # new_prices: [1.5, 2.5, 3.5]