Skip to main content
Log in

Mojo function

exp

exp[type: DType, simd_width: Int, //](x: SIMD[type, simd_width]) -> SIMD[type, simd_width]

Calculates elementwise exponential of the input vector.

Given an input vector XX and an output vector YY, sets Yi=eXiY_i = e^{X_i} for each position ii in the input vector (where ee is the mathematical constant ee).

Constraints:

The input must be a floating-point type.

Parameters:

  • type (DType): The dtype of the input and output SIMD vector.
  • simd_width (Int): The width of the input and output SIMD vector.

Args:

  • x (SIMD[type, simd_width]): The input SIMD vector.

Returns:

A SIMD vector containing ee raised to the power XiX_i where XiX_i is an element in the input SIMD vector.