def fapply(f, x, tz=False):
if sps.issparse(x):<EOL><INDENT>y = x.copy()<EOL>y.data = f(x.data)<EOL>if tz and y.getnnz() < np.prod(y.shape):<EOL><INDENT>z = f(np.array(<NUM_LIT:0>))<EOL>if z != <NUM_LIT:0>:<EOL><INDENT>y = y.toarray()<EOL>y[y == <NUM_LIT:0>] = z<EOL><DEDENT><DEDENT>return y<EOL><DEDENT>else: return f(x)<EOL>
fapply(f,x) yields the result of applying f either to x, if x is a normal value or array, or to
  x.data if x is a sparse matrix. Does not modify x (unless f modifiex x).

The optional argument tz (default: False) may be set to True to specify that, if x is a sparse 
matrix that contains at least 1 element that is a sparse-zero, then f(0) should replace all the
sparse-zeros in x (unless f(0) == 0).