in reply to Calculate log of matrix values

My suggestion: don't try to take the log of zero as it's not defined :) see logarithm

Really, it'll depends on what you're going to do with the logs. You could set the result to undef and detect that in your later code.