Ways around pinv([inf])=NaN in Octave/Matlab
问题 I am using Octave 3.8.1, a Matlab-like program. I'd like to generalize 1/x to the case where x may be a scalar or a matrix. Replacing 1/x with inv(x) or pinv(x) works for most x , except: octave:1> 1/inf ans = 0 octave:2> pinv([inf]) ans = NaN octave:3> inv([inf]) warning: inverse: matrix singular to machine precision, rcond = 0 ans = Inf Should I convert NaN to 0 afterwards to get this to work? Or have I missed something? Thanks! 回答1: The Moore–Penrose pseudo inverse, which is the basis for