Easiest solution I would suggest is using numpy for handling any matrix operations so you won't have to reimplement the wheel. Maybe it would be worth looking into numpy masking operations, like masked_where
I'm not saying this is the most efficient solution, really don't know what you consider big matrix and what sort of efficiency you need, I would probably try several approaches, and compare them using profiler and decide which is best for you.
>>> import numpy
>>> x = numpy.array([1, 2, 3, -99, 5])
>>> c = numpy.ma.masked_where(x < 0, x, copy=False)
>>> c
masked_array(data = [1 2 3 -- 5],
mask = [False False False True False],
fill_value = 999999)
>>> x2 = c.filled(0)
>>> x2
array([1, 2, 3, 0, 5])