This centers each column of mat around the mean of its non-zero values.
mat
xform(mat, scale = FALSE)
matrix