ldltup.m
来自「这是在网上下的一个东东」· M 代码 · 共 43 行
M
43 行
%% [newL,newD]=ldltup(L,D,v)%% This function updates the Cholesky factorization of A to the Cholesky % factorization of A+vv'. i.e. If%% A=L*D*L'%% then%% A+v*v'=newL*newD*newL'%% It is assumed that A is symmetric and postive definite.%% Reference: Gill, Murray, and Wright, "Practical Optimization", p43.% Author: Brian Borchers (borchers@nmt.edu)%function [newL,newD]=ldltup(L,D,v)%% First, find the size of the matrix. %n=size(L,1);%% Initialize newL, newD, and t.%newL=L;newD=D;oldt=1;%% The main loop. See Gill, Murray, and Wright for details. %for j=1:n p=v(j); t=oldt+p^2/D(j,j); newD(j,j)=D(j,j)*t/oldt; beta=p/(D(j,j)*t); if (j < n) v(j+1:n)=v(j+1:n)-p*L(j+1:n,j); newL(j+1:n,j)=L(j+1:n,j)+beta*v(j+1:n); end oldt=t;end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?