matrix addition skipping nan values
===

I would like to do element wise addition over matrices while skipping NaN values. 
matlab and octave have nansum, but it does column wise addition within a matrix.
let<br>
a = NaN * zeros(3)<br>
b = ones(3)

i want <br>
c = nan+(a, b)<br>
and <br>
c = b <br><br>
and <br> <br>
d = nan+(a,a)<br>
and<br>
d = a