Singularity for inverse matrix

六月ゝ 毕业季﹏ 提交于 2019-12-13 06:24:53

问题


As data I get a matrix A but in my algorithm I need to work on its inverse. What I do is:

C = inv(A) + B;

Then in another line I update A. In the next cycles I also need (updated) A inverse, again for this algorithm. And so on. In the later cycles I get this:

Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.425117e-019

or this:

Warning: Matrix is singular to working precision.

or this:

Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

Can you help me how to avoid such singularity? Matrix is squared always.


回答1:


You can add some minute identity matrix to A:

A = A + small_coeff * eye(size(A));

so that resulting matrix will be sufficiently non-singular



来源:https://stackoverflow.com/questions/17263873/singularity-for-inverse-matrix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!