copysign

Contents

copysign#

class saiunit.math.copysign(x1, x2, **kwargs)#

Return a copy of the first array elements with the sign of the second array.

Parameters:
  • x1 (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

  • x2 (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

Returns:

out – Quantity if x1 and x2 are Quantities that have the same unit, else an array.

Return type:

saiunit.Quantity | Array

Examples

>>> import saiunit as u
>>> a = [-1.0, 2.0] * u.meter
>>> b = [1.0, -3.0] * u.meter
>>> u.math.copysign(a, b)