Skip to content

Instantly share code, notes, and snippets.

@iskandr
Created January 30, 2013 00:57
Show Gist options
  • Select an option

  • Save iskandr/4669628 to your computer and use it in GitHub Desktop.

Select an option

Save iskandr/4669628 to your computer and use it in GitHub Desktop.
def count_thresh(values :: array1(float64), thresh :: float64) => int64:
shape_tuple :: struct(int64) = values.shape
data :: ptr(float64) = values.data
base_offset :: int64 = values.offset
for i in range(0, shape_tuple.elt0, 1):
(header)
n_loop <- phi(0 :: int64, n2)
(body)
offset :: int64 = offset + i
elt :: float64 = data[offset]
less_tmp :: bool = elt < thresh
n2 :: int64 = n_loop + cast<int64>(less_tmp)
return n_loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment