ulab.vector – Element-by-element functions

These functions can operate on numbers, 1-D iterables, 1-D arrays, or 2-D arrays by applying the function to every element in the array. This is typically much more efficient than expressing the same operation as a Python loop.

ulab.vector.acos(a: ulab._ArrayLike)ulab.array

Computes the inverse cosine function

ulab.vector.acosh(a: ulab._ArrayLike)ulab.array

Computes the inverse hyperbolic cosine function

ulab.vector.asin(a: ulab._ArrayLike)ulab.array

Computes the inverse sine function

ulab.vector.asinh(a: ulab._ArrayLike)ulab.array

Computes the inverse hyperbolic sine function

ulab.vector.around(a: ulab._ArrayLike, *, decimals: int = 0)ulab.array

Returns a new float array in which each element is rounded to decimals places.

ulab.vector.atan(a: ulab._ArrayLike)ulab.array

Computes the inverse tangent function; the return values are in the range [-pi/2,pi/2].

ulab.vector.arctan2(ya: ulab._ArrayLike, xa: ulab._ArrayLike)ulab.array

Computes the inverse tangent function of y/x; the return values are in the range [-pi, pi].

ulab.vector.atanh(a: ulab._ArrayLike)ulab.array

Computes the inverse hyperbolic tangent function

ulab.vector.ceil(a: ulab._ArrayLike)ulab.array

Rounds numbers up to the next whole number

ulab.vector.cos(a: ulab._ArrayLike)ulab.array

Computes the cosine function

ulab.vector.cosh(a: ulab._ArrayLike)ulab.array

Computes the hyperbolic cosine function

ulab.vector.degrees(a: ulab._ArrayLike)ulab.array

Converts angles from radians to degrees

ulab.vector.erf(a: ulab._ArrayLike)ulab.array

Computes the error function, which has applications in statistics

ulab.vector.erfc(a: ulab._ArrayLike)ulab.array

Computes the complementary error function, which has applications in statistics

ulab.vector.exp(a: ulab._ArrayLike)ulab.array

Computes the exponent function.

ulab.vector.expm1(a: ulab._ArrayLike)ulab.array

Computes $e^x-1$. In certain applications, using this function preserves numeric accuracy better than the exp function.

ulab.vector.floor(a: ulab._ArrayLike)ulab.array

Rounds numbers up to the next whole number

ulab.vector.gamma(a: ulab._ArrayLike)ulab.array

Computes the gamma function

ulab.vector.lgamma(a: ulab._ArrayLike)ulab.array

Computes the natural log of the gamma function

ulab.vector.log(a: ulab._ArrayLike)ulab.array

Computes the natural log

ulab.vector.log10(a: ulab._ArrayLike)ulab.array

Computes the log base 10

ulab.vector.log2(a: ulab._ArrayLike)ulab.array

Computes the log base 2

ulab.vector.radians(a: ulab._ArrayLike)ulab.array

Converts angles from degrees to radians

ulab.vector.sin(a: ulab._ArrayLike)ulab.array

Computes the sine function

ulab.vector.sinh(a: ulab._ArrayLike)ulab.array

Computes the hyperbolic sine

ulab.vector.sqrt(a: ulab._ArrayLike)ulab.array

Computes the square root

ulab.vector.tan(a: ulab._ArrayLike)ulab.array

Computes the tangent

ulab.vector.tanh(a: ulab._ArrayLike)ulab.array

Computes the hyperbolic tangent

ulab.vector.vectorize(f: Union[Callable[[int], float], Callable[[float], float]], *, otypes: Optional[ulab._DType] = None)Callable[[ulab._ArrayLike], ulab.array]
Parameters
  • f (callable) – The function to wrap

  • otypes – List of array types that may be returned by the function. None is interpreted to mean the return value is float.

Wrap a Python function f so that it can be applied to arrays. The callable must return only values of the types specified by otypes, or the result is undefined.