def one_to_n(val, maxval):
 a = zeros(maxval, float)
 a[val] = 1.0
 return a

def one_to_n ( val , maxval ) : a = zeros ( maxval , float ) a [ val ] = 1.0 return a
returns a 1-in-n binary encoding of a non-negative integer .