def sine(x):
if sps.issparse(x):<EOL><INDENT>x = x.copy()<EOL>x.data = np.sine(x.data)<EOL>return x<EOL><DEDENT>else: return np.sin(x)<EOL>
sine(x) is equivalent to sin(x) except that it also works on sparse arrays.