Skip to main content

function

pow

pow[type: DType, simd_width: Int](lhs: SIMD[type, simd_width], rhs: Int) -> SIMD[$0, $1]

Computes the pow of the inputs.

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:

  • lhs (SIMD[type, simd_width]): The first input argument.
  • rhs (Int): The second input argument.

Returns:

The pow of the inputs.

pow[dtype: DType, simd_width: Int](lhs: SIMD[dtype, simd_width], rhs: SIMD[dtype, simd_width]) -> SIMD[$0, $1]

Computes elementwise power of a floating point type raised to another floating point type.

An element of the result SIMD vector will be the result of raising the corresponding element of lhs to the corresponding element of rhs.

Parameters:

  • dtype (DType): The dtype of the SIMD vectors. Constraints: must be a floating-point type.
  • simd_width (Int): The width of the input and output SIMD vectors.

Args:

  • lhs (SIMD[dtype, simd_width]): Base of the power operation.
  • rhs (SIMD[dtype, simd_width]): Exponent of the power operation.

Returns:

A SIMD vector containing elementwise lhs raised to the power of rhs.

pow[n: Int, type: DType, simd_width: Int](x: SIMD[type, simd_width]) -> SIMD[$1, $2]

Computes the elementwise power where the exponent is an integer known at compile time.

Parameters:

  • n (Int): Exponent of the power operation. Constraints: must be a signed si32 type.
  • type (DType): The dtype of the x SIMD vector.
  • simd_width (Int): The width of the input and output SIMD vectors.

Args:

  • x (SIMD[type, simd_width]): Base of the power operation.

Returns:

A SIMD vector containing elementwise x raised to the power of n.