inv_posdef.m

来自「This a collection of MATLAB functions fo」· M 代码 · 共 13 行

M
13
字号
function Pinv = inv_posdef(P)
%function Pinv = inv_posdef(P)
%
% Invert a positive definite matrix P. More numerically stable than Pinv = inv(P)
% and result is guaranteed to remain symmetric.
% Adapted from INV_POSDEF.m of the Lightspeed library by Minka.
%
% Tim Bailey 2005.

Pc = chol(P);
Pci = inv(Pc);
Pinv = Pci*Pci';

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?