def recipr0(X):
 test = np.equal(np.asarray(X), 0)
 return np.where(test, 0, (1.0 / X))

def recipr0 ( X ) : test = np . equal ( np . asarray ( X ) , 0 ) return np . where ( test , 0 , ( 1.0 / X ) )
return the reciprocal of an array .