Skip to main content

function

select

select[type: DType, simd_width: Int](cond: SIMD[bool, simd_width], true_case: SIMD[type, simd_width], false_case: SIMD[type, simd_width]) -> SIMD[$0, $1]

Performs an elementwise select based on the input condition value.

Parameters:

  • type (DType): dtype used for the computation.
  • simd_width (Int): SIMD width used for the computation.

Args:

  • cond (SIMD[bool, simd_width]): The condition.
  • true_case (SIMD[type, simd_width]): The value to pick if the condition is True.
  • false_case (SIMD[type, simd_width]): The value to pick if the condition is False.

Returns:

A SIMD value where the element at position i contains true_case[i] if cond[i] is True and false_case[i] otherwise.